GCKDevice.h
1 // Copyright 2012 Google Inc.
2 
3 #import <GoogleCast/GCKDefines.h>
4 
5 #import <Foundation/Foundation.h>
6 
7 #import <GoogleCast/GCKNetworkAddress.h>
8 
14 GCK_ASSUME_NONNULL_BEGIN
15 
20 typedef NS_ENUM(NSInteger, GCKDeviceStatus) {
22  GCKDeviceStatusUnknown = -1,
24  GCKDeviceStatusIdle = 0,
26  GCKDeviceStatusBusy = 1,
27 };
28 
33 typedef NS_ENUM(NSInteger, GCKDeviceCapability) {
35  GCKDeviceCapabilityVideoOut = 1 << 0,
37  GCKDeviceCapabilityVideoIn = 1 << 1,
39  GCKDeviceCapabilityAudioOut = 1 << 2,
41  GCKDeviceCapabilityAudioIn = 1 << 3,
43  GCKDeviceCapabilityMultizoneGroup = 1 << 5,
45  GCKDeviceCapabilityMasterOrFixedVolume = 1 << 11,
47  GCKDeviceCapabilityAttenuationOrFixedVolume = 1 << 12,
48 };
49 
55 typedef NS_ENUM(NSInteger, GCKDeviceType) {
57  GCKDeviceTypeGeneric = 0,
59  GCKDeviceTypeTV,
61  GCKDeviceTypeSpeaker,
63  GCKDeviceTypeSpeakerGroup,
67  GCKDeviceTypeNearbyUnpaired
68 };
69 
74 GCK_EXTERN NSString *const kGCKCastDeviceCategory;
75 
76 @class GCKImage;
77 
81 GCK_EXPORT
82 @interface GCKDevice : NSObject <NSCopying, NSSecureCoding>
83 
84 - (instancetype)init NS_UNAVAILABLE;
85 
91 @property(nonatomic, copy, readonly)
92  NSString *ipAddress GCK_DEPRECATED("Use networkAddress for both IPv4 and IPv6 support");
93 
98 @property(nonatomic, copy, readonly) GCKNetworkAddress *networkAddress;
99 
101 @property(nonatomic, assign, readonly) uint16_t servicePort;
102 
104 @property(nonatomic, copy, readonly) NSString *deviceID;
105 
107 @property(nonatomic, copy, readwrite, GCK_NULLABLE) NSString *friendlyName;
108 
110 @property(nonatomic, copy, readwrite, GCK_NULLABLE) NSString *modelName;
111 
113 @property(nonatomic, copy, readwrite, GCK_NULLABLE) NSArray<GCKImage *> *icons;
114 
116 @property(nonatomic, assign, readwrite) GCKDeviceStatus status;
117 
119 @property(nonatomic, copy, readwrite, GCK_NULLABLE) NSString *statusText;
120 
122 @property(nonatomic, copy, readwrite, GCK_NULLABLE) NSString *deviceVersion;
123 
125 @property(nonatomic, assign, readonly) BOOL isOnLocalNetwork;
126 
132 @property(nonatomic, assign, readonly) GCKDeviceType type;
133 
138 @property(nonatomic, copy, readonly) NSString *category;
139 
144 @property(nonatomic, copy, readonly) NSString *uniqueID;
145 
151 - (BOOL)isSameDeviceAs:(const GCKDevice *)other;
152 
158 - (BOOL)hasCapabilities:(NSInteger)deviceCapabilities;
159 
169 - (void)setAttribute:(NSObject<NSSecureCoding> *)attribute forKey:(NSString *)key;
170 
178 - (NSObject<NSSecureCoding> * GCK_NULLABLE_TYPE)attributeForKey:(NSString *)key;
179 
186 - (void)removeAttributeForKey:(NSString *)key;
187 
191 - (void)removeAllAttributes;
192 
196 + (NSString *)deviceCategoryForDeviceUniqueID:(NSString *)deviceUniqueID;
197 
198 @end
199 
200 GCK_ASSUME_NONNULL_END
NSArray< GCKImage * > * icons
An array of GCKImage objects containing icons for the device.
Definition: GCKDevice.h:113
GCKDeviceType type
The device type.
Definition: GCKDevice.h:132
An object representing a receiver device.
Definition: GCKDevice.h:82
instancetype NS_UNAVAILABLE()
NSString * uniqueID
A globally unique ID for this device.
Definition: GCKDevice.h:144
NSString * modelName
The device&#39;s model name.
Definition: GCKDevice.h:110
NSString * category
The device category, a string that uniquely identifies the type of device.
Definition: GCKDevice.h:138
An object that represents a network IP address.
Definition: GCKNetworkAddress.h:34
NSString * friendlyName
The device&#39;s friendly name.
Definition: GCKDevice.h:107
BOOL isOnLocalNetwork
YES if this device is on the local network.
Definition: GCKDevice.h:125
NSString * deviceID
A unique identifier for the device.
Definition: GCKDevice.h:104
A class that represents an image that is located on a web server.
Definition: GCKImage.h:14
NSString * deviceVersion
The device&#39;s protocol version.
Definition: GCKDevice.h:122
GCKNetworkAddress * networkAddress
The device&#39;s IP address.
Definition: GCKDevice.h:98
GCKDeviceStatus status
The device&#39;s status at the time that it was most recently scanned.
Definition: GCKDevice.h:116
NSString *ipAddress GCK_DEPRECATED("Use networkAddress for both IPv4 and IPv6 support")
uint16_t servicePort
The device&#39;s service port.
Definition: GCKDevice.h:101
void removeAllAttributes()
Removes all attributes from the object.
NSString * statusText
The status text reported by the currently running receiver application, if any.
Definition: GCKDevice.h:119