![]() |
Public Member Functions | |
(ResponseFactory *) | - responseFactory |
(PropertyGenerator *) | - propertyGenerator |
(id) | - initWithCommandQueue:withReceiveBuffer:withResponseFactory:withPropertyGenerator: |
(BOOL) | - addHandler: |
(BOOL) | - removeHandler: |
(BOOL) | - hasHandler: |
(ResponseHandlerCollection *) | - handlers |
(NSString *) | - incomingBufferContents |
(int) | - incomingBufferCount |
(void) | - onPacketReceived:withHandler: |
(BOOL) | - notifyAsyncResponse: |
(BOOL) | - notifySyncResponse: |
IDBlueResponseProcessor is responsible for converting incoming data from IDBLUE into IDBlueResponse objects and notifing listeners of received responses
- (BOOL) addHandler: | (id<IResponseHandler>) | handler |
Add an ResponseHandler to the list of handlers that are notified of respones received from an IDBLUE device.
Gets the array of ResponseHandler objects
- (BOOL) hasHandler: | (id<IResponseHandler>) | handler |
Determines if the given ResponseHandler is contained in the list of handlers that are notified of responses received from an IDBLUE device.
- (NSString *) incomingBufferContents |
Gets the data in the incoming buffer, in hex format
- (int) incomingBufferCount |
Gets the number of bytes in the incoming buffer
- (id) initWithCommandQueue: | (CommandQueue*) | queue | |
withReceiveBuffer: | (PacketQueue*) | receiveBuffer | |
withResponseFactory: | (ResponseFactory*) | factory | |
withPropertyGenerator: | (PropertyGenerator*) | generator | |
Initialize an IDBlueResponseProcessor with the given CommandQueue
queue | The CommandQueue that will hold commands sent to IDBLUE, awaiting responses |
receiveBuffer | The PacketQueue that will be used to store incoming data, and convert the bytes into IDBluePackets. |
factory | The ResponseFactory that creates IDBleuResponse objects |
generator | The PropertyGenerator that creates IDBlueProeprty objets |
- (BOOL) notifyAsyncResponse: | (IDBlueResponse*) | response |
Notifies all ResponseHandler objects (registered with addHandler or passed into the constructor) of an asynchronous response from an IDBLUE device. notifyAsyncResponse is called from within IDBlueCommandSender afer a call to onDataReceived if the incoming data is an asynchronous response (e.g. a the user presses the front button of IDBLUE, resulting in a tag scan being sent back to the host).
response | the asynchronous response received from an IDBLUE device. |
- (BOOL) notifySyncResponse: | (IDBlueCommand*) | command |
Notifies the ResponseHandler assigned to the IDBlueCommand sent to IDBLUE that a synchronous response has been received (a synchronous response is a response sent from an IDBLUE device in response to an IDBlueCommand).
command | The IDBlueCommand object that was sent to IDBLUE that received the response (use the method [command response] to get the IDBlueResponse). |
- (void) onPacketReceived: | (IDBluePacket*) | packet | |
withHandler: | (id<IResponseHandler>) | handler | |
Notifies the given ResponseHandler that an IDBluePacket has been received from IDBLUE. onPacketReceived is called from within IDBlueCommandSender. It should not be called externally.
packet | the IDBluePacket received from IDBLUE |
handler | the ResponseHandler object to notify |
Gets the PropertyGenerator
- (BOOL) removeHandler: | (id<IResponseHandler>) | handler |
Removes an ResponseHandler from the list of handlers that are notified of responses received from an IDBLUE device.
Gets the ResponseFactory