Inherits from NSObject
Declared in MSFKDeviceManager.h
MSFKDeviceManager.m

Properties

deviceMuted

The current mute state of the device, if known; otherwise NO.

@property (nonatomic, assign, readonly) BOOL deviceMuted

Discussion

The current mute state of the device, if known; otherwise NO.

Declared In

MSFKDeviceManager.h

deviceVolume

The current volume of the device, if known; otherwise 0.

@property (nonatomic, assign, readonly) float deviceVolume

Discussion

The current volume of the device, if known; otherwise 0.

Declared In

MSFKDeviceManager.h

isConnected

True if the device manager has established a connection to the device.

@property (nonatomic) BOOL isConnected

Discussion

True if the device manager has established a connection to the device.

Declared In

MSFKDeviceManager.h

isConnectedToApp

True if the device manager has established a connection to an application on the device.

@property (nonatomic) BOOL isConnectedToApp

Discussion

True if the device manager has established a connection to an application on the device.

Declared In

MSFKDeviceManager.h

isReconnecting

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 isReconnecting

Discussion

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.h

reconnectTimeout

Reconnection will be attempted for this long in the event that the socket disconnects with a potentially transient error.

@property (nonatomic) NSTimeInterval reconnectTimeout

Discussion

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.h

Instance Methods

addChannel:

Adds a channel which can send and receive messages for this device on a particular namespace.

- (BOOL)addChannel:(MSFKFlintChannel *)channel

Parameters

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.h

appDidEnterBackgroundForDM:

**

- (void)appDidEnterBackgroundForDM:(NSNotification *)notif

Discussion

**

Declared In

MSFKDeviceManager.m

connect

Connects to the device.

- (void)connect

Discussion

Connects to the device.

Declared In

MSFKDeviceManager.h

connectInternalUnchecked

**

- (void)connectInternalUnchecked

Discussion

**

Declared In

MSFKDeviceManager.m

connectToDeviceControl

**

- (void)connectToDeviceControl

Discussion

**

Declared In

MSFKDeviceManager.m

connectWithInactivityTimeout:

**

- (void)connectWithInactivityTimeout:(NSTimeInterval)timeout

Discussion

**

Declared In

MSFKDeviceManager.m

dealloc

**

- (void)dealloc

Discussion

**

Declared In

MSFKDeviceManager.m

deviceControl:volumeDidChangeToLevel:isMuted:

Called whenever the volume changes.

- (void)deviceControl:(MSFKDeviceConnectControl *)deviceConnectControl volumeDidChangeToLevel:(float)volumeLevel isMuted:(BOOL)isMuted

Parameters

volumeLevel

The current device volume level.

isMuted

The current device mute state.

Discussion

Called whenever the volume changes.

Declared In

MSFKDeviceManager.m

disconnect

Disconnects from the device.

- (void)disconnect

Discussion

Disconnects from the device.

Declared In

MSFKDeviceManager.h

initWithDevice:clientPackageName:

Designated initializer. Constructs a new MSFKDeviceManager with the given device.

- (id)initWithDevice:(MSFKDevice *)device clientPackageName:(NSString *)clientPackageName

Parameters

device

The device to control.

clientPackageName

The client package name.

Discussion

Designated initializer. Constructs a new MSFKDeviceManager with the given device.

Declared In

MSFKDeviceManager.h

joinApplication:

Joins an application.

- (BOOL)joinApplication:(NSString *)applicationURL

Parameters

applicationURL

The application url.

Return Value

NO if the message could not be sent.

Discussion

Joins an application.

Declared In

MSFKDeviceManager.h

launchApplication:

Launches an application.

- (BOOL)launchApplication:(NSString *)applicationURL

Parameters

applicationURL

The application url.

Return Value

NO if the message could not be sent.

Discussion

Launches an application.

Declared In

MSFKDeviceManager.h

launchApplication:relaunchIfRunning:

Launches an application, optionally relaunching it if it is already running.

- (BOOL)launchApplication:(NSString *)applicationURL relaunchIfRunning:(BOOL)relaunchIfRunning

Parameters

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.h

launchApplication:relaunchIfRunning:useIpc:

Launches an application, optionally relaunching it if it is already running.

- (BOOL)launchApplication:(NSString *)applicationURL relaunchIfRunning:(BOOL)relaunchIfRunning useIpc:(BOOL)useIpc

Parameters

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.h

leaveApplication

Leaves the current application.

- (BOOL)leaveApplication

Return Value

NO if the message could not be sent.

Discussion

Leaves the current application.

Declared In

MSFKDeviceManager.h

notifyReconnectFailedWithError:

/ * 连接 ReceiverChannel / * 使用连接控制通道发送 ReceiverChannel 创建消息 / */

- (void)notifyReconnectFailedWithError:(NSError *)error

Discussion

/ * 连接 ReceiverChannel / * 使用连接控制通道发送 ReceiverChannel 创建消息 / */

Declared In

MSFKDeviceManager.m

registerForAppStateNotifications

**

- (void)registerForAppStateNotifications

Discussion

**

Declared In

MSFKDeviceManager.m

removeChannel:

Removes a previously added channel.

- (BOOL)removeChannel:(MSFKFlintChannel *)channel

Parameters

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.h

requestDeviceStatus

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)requestDeviceStatus

Return 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.h

sendBinaryMessage:withNamespace:

Sends a binary message.

- (BOOL)sendBinaryMessage:(NSData *)data withNamespace:(NSString *)namespace_p

Parameters

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.m

sendBinaryMessage:withNamespace:toDestinationID:

Sends a binary message.

- (BOOL)sendBinaryMessage:(NSData *)data withNamespace:(NSString *)namespace_p toDestinationID:(NSString *)destinationID

Parameters

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.m

sendTextMessage:withNamespace:

Sends a text message.

- (BOOL)sendTextMessage:(NSString *)message withNamespace:(NSString *)namespace_p

Parameters

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.m

sendTextMessage:withNamespace:toDestinationID:

Sends a text message.

- (BOOL)sendTextMessage:(NSString *)message withNamespace:(NSString *)namespace_p toDestinationID:(NSString *)destinationID

Parameters

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.m

setMuted:

Turns muting on or off.

- (BOOL)setMuted:(BOOL)muted

Parameters

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

setVolume:

Sets the system volume.

- (BOOL)setVolume:(float)volume

Parameters

volume

The new volume, in the range [0.0, 1.0]. Out of range values will be silently clipped.

Return Value

NO if the message could not be sent.

Discussion

Sets the system volume.

Declared In

MSFKDeviceManager.h

stopApplication

Stops any running application(s).

- (BOOL)stopApplication

Return Value

NO if the message could not be sent.

Discussion

Stops any running application(s).

Declared In

MSFKDeviceManager.h