MSFKDeviceManager Class Reference
| Inherits from | NSObject |
| Declared in | MSFKDeviceManager.h MSFKDeviceManager.m |
Tasks
Other Methods
-
isConnectedproperty -
isConnectedToAppproperty -
isReconnectingproperty -
reconnectTimeoutproperty -
deviceVolumeproperty -
deviceMutedproperty -
– initWithDevice:clientPackageName: -
– connect -
– disconnect -
– addChannel: -
– removeChannel: -
– launchApplication: -
– launchApplication:relaunchIfRunning: -
– launchApplication:relaunchIfRunning:useIpc: -
– joinApplication: -
– leaveApplication -
– stopApplication -
– setVolume: -
– setMuted: -
– requestDeviceStatus
Other Methods
-
– dealloc -
– registerForAppStateNotifications -
– connectWithInactivityTimeout: -
– connectInternalUnchecked -
– appDidEnterBackgroundForDM: -
– sendTextMessage:withNamespace: -
– sendTextMessage:withNamespace:toDestinationID: -
– sendBinaryMessage:withNamespace: -
– sendBinaryMessage:withNamespace:toDestinationID: -
– connectToDeviceControl -
– notifyReconnectFailedWithError: -
– deviceControl:volumeDidChangeToLevel:isMuted:
Properties
deviceMuted
The current mute state of the device, if known; otherwise NO.
@property (nonatomic, assign, readonly) BOOL deviceMutedDiscussion
The current mute state of the device, if known; otherwise NO.
Declared In
MSFKDeviceManager.hdeviceVolume
The current volume of the device, if known; otherwise 0.
@property (nonatomic, assign, readonly) float deviceVolumeDiscussion
The current volume of the device, if known; otherwise 0.
Declared In
MSFKDeviceManager.hisReconnecting
True if the device manager is disconnected due to a potentially transient event (e.g. the app is backgrounded, or there was a network error which might be solved by reconnecting). Note that the disconnection/connection callbacks will not be called while the device manager attemps to reconnect after a potentially transient event, but the properties will always reflect the actual current state and can be observed.
@property (nonatomic) BOOL isReconnectingDiscussion
True if the device manager is disconnected due to a potentially transient event (e.g. the app is backgrounded, or there was a network error which might be solved by reconnecting). Note that the disconnection/connection callbacks will not be called while the device manager attemps to reconnect after a potentially transient event, but the properties will always reflect the actual current state and can be observed.
Declared In
MSFKDeviceManager.hreconnectTimeout
Reconnection will be attempted for this long in the event that the socket disconnects with a potentially transient error.
@property (nonatomic) NSTimeInterval reconnectTimeoutDiscussion
Reconnection will be attempted for this long in the event that the socket disconnects with a potentially transient error.
The default timeout is 10s.
Declared In
MSFKDeviceManager.hInstance Methods
addChannel:
Adds a channel which can send and receive messages for this device on a particular namespace.
- (BOOL)addChannel:(MSFKFlintChannel *)channelParameters
- channel
The channel.
Return Value
YES if the channel was added, NO if it was not added because there was already a channel attached for that namespace.
Discussion
Adds a channel which can send and receive messages for this device on a particular namespace.
Declared In
MSFKDeviceManager.happDidEnterBackgroundForDM:
**
- (void)appDidEnterBackgroundForDM:(NSNotification *)notifDiscussion
**
Declared In
MSFKDeviceManager.mconnect
Connects to the device.
- (void)connectDiscussion
Connects to the device.
Declared In
MSFKDeviceManager.hconnectInternalUnchecked
**
- (void)connectInternalUncheckedDiscussion
**
Declared In
MSFKDeviceManager.mconnectToDeviceControl
**
- (void)connectToDeviceControlDiscussion
**
Declared In
MSFKDeviceManager.mconnectWithInactivityTimeout:
**
- (void)connectWithInactivityTimeout:(NSTimeInterval)timeoutDiscussion
**
Declared In
MSFKDeviceManager.mdeviceControl:volumeDidChangeToLevel:isMuted:
Called whenever the volume changes.
- (void)deviceControl:(MSFKDeviceConnectControl *)deviceConnectControl volumeDidChangeToLevel:(float)volumeLevel isMuted:(BOOL)isMutedParameters
- volumeLevel
The current device volume level.
- isMuted
The current device mute state.
Discussion
Called whenever the volume changes.
Declared In
MSFKDeviceManager.mdisconnect
Disconnects from the device.
- (void)disconnectDiscussion
Disconnects from the device.
Declared In
MSFKDeviceManager.hinitWithDevice:clientPackageName:
Designated initializer. Constructs a new MSFKDeviceManager with the given device.
- (id)initWithDevice:(MSFKDevice *)device clientPackageName:(NSString *)clientPackageNameParameters
- device
The device to control.
- clientPackageName
The client package name.
Discussion
Designated initializer. Constructs a new MSFKDeviceManager with the given device.
Declared In
MSFKDeviceManager.hjoinApplication:
Joins an application.
- (BOOL)joinApplication:(NSString *)applicationURLParameters
- applicationURL
The application url.
Return Value
NO if the message could not be sent.
Discussion
Joins an application.
Declared In
MSFKDeviceManager.hlaunchApplication:
Launches an application.
- (BOOL)launchApplication:(NSString *)applicationURLParameters
- applicationURL
The application url.
Return Value
NO if the message could not be sent.
Discussion
Launches an application.
Declared In
MSFKDeviceManager.hlaunchApplication:relaunchIfRunning:
Launches an application, optionally relaunching it if it is already running.
- (BOOL)launchApplication:(NSString *)applicationURL relaunchIfRunning:(BOOL)relaunchIfRunningParameters
- applicationURL
The application url.
- relaunchIfRunning
If YES, relaunches the application if it is already running instead of joining the running applicaiton.
Return Value
NO if the message could not be sent.
Discussion
Launches an application, optionally relaunching it if it is already running.
Declared In
MSFKDeviceManager.hlaunchApplication:relaunchIfRunning:useIpc:
Launches an application, optionally relaunching it if it is already running.
- (BOOL)launchApplication:(NSString *)applicationURL relaunchIfRunning:(BOOL)relaunchIfRunning useIpc:(BOOL)useIpcParameters
- applicationURL
The application url.
- relaunchIfRunning
If YES, relaunches the application if it is already running instead of joining the running applicaiton.
- useIpc
If YES, sender and receiver apps use WebSocket
Return Value
NO if the message could not be sent.
Discussion
Launches an application, optionally relaunching it if it is already running.
Declared In
MSFKDeviceManager.hleaveApplication
Leaves the current application.
- (BOOL)leaveApplicationReturn Value
NO if the message could not be sent.
Discussion
Leaves the current application.
Declared In
MSFKDeviceManager.hnotifyReconnectFailedWithError:
/ * 连接 ReceiverChannel / * 使用连接控制通道发送 ReceiverChannel 创建消息 / */
- (void)notifyReconnectFailedWithError:(NSError *)errorDiscussion
/ * 连接 ReceiverChannel / * 使用连接控制通道发送 ReceiverChannel 创建消息 / */
Declared In
MSFKDeviceManager.mregisterForAppStateNotifications
**
- (void)registerForAppStateNotificationsDiscussion
**
Declared In
MSFKDeviceManager.mremoveChannel:
Removes a previously added channel.
- (BOOL)removeChannel:(MSFKFlintChannel *)channelParameters
- channel
The channel.
Return Value
YES if the channel was removed, NO if it was not removed because the given channel was not previously attached.
Discussion
Removes a previously added channel.
Declared In
MSFKDeviceManager.hrequestDeviceStatus
Requests the device’s current status. This may cause an application status callback, if currently connected to an application, and may cause a device volume callback, if the device volume has changed.
- (NSInteger)requestDeviceStatusReturn Value
The request ID, or kMSFKInvalidRequestID if the request could not be sent.
Discussion
Requests the device’s current status. This may cause an application status callback, if currently connected to an application, and may cause a device volume callback, if the device volume has changed.
Declared In
MSFKDeviceManager.hsendBinaryMessage:withNamespace:
Sends a binary message.
- (BOOL)sendBinaryMessage:(NSData *)data withNamespace:(NSString *)namespace_pParameters
- data
The message binary.
- namespace_p
The namespace of channel
Return Value
YES on success or NO if the message could not be sent (because
the handler is not connected, or because the send buffer is too full at the moment).
Discussion
Sends a binary message.
Declared In
MSFKDeviceManager.msendBinaryMessage:withNamespace:toDestinationID:
Sends a binary message.
- (BOOL)sendBinaryMessage:(NSData *)data withNamespace:(NSString *)namespace_p toDestinationID:(NSString *)destinationIDParameters
- data
The message binary.
- namespace_p
The namespace of channel
- destinationID
The destination id
Return Value
YES on success or NO if the message could not be sent (because
the handler is not connected, or because the send buffer is too full at the moment).
Discussion
Sends a binary message.
Declared In
MSFKDeviceManager.msendTextMessage:withNamespace:
Sends a text message.
- (BOOL)sendTextMessage:(NSString *)message withNamespace:(NSString *)namespace_pParameters
- message
The message string.
- namespace_p
The namespace of channel
Return Value
YES on success or NO if the message could not be sent (because
the handler is not connected, or because the send buffer is too full at the moment).
Discussion
Sends a text message.
Declared In
MSFKDeviceManager.msendTextMessage:withNamespace:toDestinationID:
Sends a text message.
- (BOOL)sendTextMessage:(NSString *)message withNamespace:(NSString *)namespace_p toDestinationID:(NSString *)destinationIDParameters
- message
The message string.
- namespace_p
The namespace of channel
- destinationID
The destination id
Return Value
YES on success or NO if the message could not be sent (because
the handler is not connected, or because the send buffer is too full at the moment).
Discussion
Sends a text message.
Declared In
MSFKDeviceManager.msetMuted:
Turns muting on or off.
- (BOOL)setMuted:(BOOL)mutedParameters
- muted
Whether audio should be muted or unmuted.
Return Value
NO if the message could not be sent.
Discussion
Turns muting on or off.
Declared In
MSFKDeviceManager.h