EMConnection Class Reference
Inherits from | NSObject |
Conforms to | EMDeviceDelegate |
Declared in | EMConnection.h EMConnection.m |
Overview
The state of the current connection. Use KVO to receive updates on this property and react to changes.
Tasks
-
connectionClosedBlock
This block will be called when an open connection is closed for any reason
property -
connectionAttemptTimeout
The timeout interval for a pending connection
property -
connectionDelegate
The connection delegate. EMConnectionManager will post connect and disconnect delegate messages to this object if it is set.
property -
device
The EMDeviceBasicDescription used for conenction
property -
schema
The schema for connection
property -
– initWithDevice:
Creates a new EMConnection object. Actual connection and disconnection to the named target occurs through calls to open and close on this object.
-
– initWithDevice:schema:
Creates a new EMTargetConnection object. Actual connection and disconnection to the named target occurs through calls to open and close on this object.
-
– isConnected
Returns true if connected and false otherwise.
-
– openConnectionWithSuccess:onFail:
-
– cancelOpen
Cancels the attempt to open this EMTargetConnection, posting the open block with a failed status.
-
– closeConnectionWithSuccess:onFail:
Closes the connection
-
– readValueNamed:onSuccess:onFail:
Reads a value
-
– writeResource:onSuccess:onFail:
Writes a resource to the device
Properties
connectionAttemptTimeout
The timeout interval for a pending connection
@property (atomic) NSTimeInterval connectionAttemptTimeout
Discussion
The timeout interval for a pending connection
Declared In
EMConnection.h
connectionClosedBlock
This block will be called when an open connection is closed for any reason
@property (atomic, strong) EMResourceBlock connectionClosedBlock
Discussion
This block will be called when an open connection is closed for any reason
Declared In
EMConnection.h
connectionDelegate
The connection delegate. EMConnectionManager will post connect and disconnect delegate messages to this object if it is set.
@property (nonatomic, unsafe_unretained) id<EMConnectionDelegate> connectionDelegate
Discussion
The connection delegate. EMConnectionManager will post connect and disconnect delegate messages to this object if it is set.
Declared In
EMConnection.h
device
The EMDeviceBasicDescription used for conenction
@property (nonatomic, strong) EMDeviceBasicDescription *device
Discussion
The EMDeviceBasicDescription used for conenction
Declared In
EMConnection.h
Instance Methods
cancelOpen
Cancels the attempt to open this EMTargetConnection, posting the open block with a failed status.
- (void)cancelOpen
Discussion
Cancels the attempt to open this EMTargetConnection, posting the open block with a failed status.
Declared In
EMConnection.h
closeConnectionWithSuccess:onFail:
Closes the connection
- (void)closeConnectionWithSuccess:(EMResourceBlock)successBlock onFail:(EMFailBlock)failBlock
Parameters
- successBlock
A block to call on a successful disconnect
- failBlock
A block to call on a failed disconnect
Discussion
Closes the connection
Declared In
EMConnection.h
initWithDevice:
Creates a new EMConnection object. Actual connection and disconnection to the named target occurs through calls to open and close on this object.
- (id)initWithDevice:(EMDeviceBasicDescription *)device
Parameters
- device
The basic description of a device
Discussion
Creates a new EMConnection object. Actual connection and disconnection to the named target occurs through calls to open and close on this object.
Declared In
EMConnection.h
initWithDevice:schema:
Creates a new EMTargetConnection object. Actual connection and disconnection to the named target occurs through calls to open and close on this object.
- (id)initWithDevice:(EMDeviceBasicDescription *)device schema:(EMSchema *)resourceSchema
Parameters
- device
the name of the target device, including one of the pre-defined prefixes
- resourceSchema
the schema describing the resources available in this connection
Discussion
Creates a new EMTargetConnection object. Actual connection and disconnection to the named target occurs through calls to open and close on this object.
Declared In
EMConnection.h
isConnected
Returns true if connected and false otherwise.
- (BOOL)isConnected
Discussion
Returns true if connected and false otherwise.
Declared In
EMConnection.h
openConnectionWithSuccess:onFail:
- (void)openConnectionWithSuccess:(EMResourceBlock)successBlock onFail:(EMFailBlock)failBlock
Parameters
- successBlock
A block to call on a successful connect
- failBlock
A block to call on a failed connect
Declared In
EMConnection.h
readValueNamed:onSuccess:onFail:
Reads a value
- (void)readValueNamed:(NSString *)resourceName onSuccess:(EMResourceBlock)successBlock onFail:(EMFailBlock)failBlock
Parameters
- resourceName
The name of the resource to read
- successBlock
A block to call on a successful read
- failBlock
A block to call on a failed read
Discussion
Reads a value
Declared In
EMConnection.h
writeResource:onSuccess:onFail:
Writes a resource to the device
- (void)writeResource:(EMResourceValue *)resourceValue onSuccess:(EMResourceBlock)successBlock onFail:(EMFailBlock)failBlock
Parameters
- resourceValue
The resource value
- successBlock
A block to call on a successful write
- failBlock
A block to call on a failed write
Discussion
Writes a resource to the device
Declared In
EMConnection.h