session/1.0/inc/ISession.h
Session Interface
Header:
Returns
0 Success (session is now open and ready for use).
-1 Failure (session remains closed).
Parameters
Returns
0 Success.
-1 Failure, if all callback functions are nullptr for an unregistered SUID.
Parameters
Returns
0 Success
-1 Failure
Session is not open or already closed.
Encoded message size exceeds the allowed limit.
Underlying transport/channel error while sending.
ISession is transport-neutral, OS-agnostic, extensible interface for communicating to Sensing Hub.
Open the session and establish a connection to Sensing Hub. Initiates the client session created using getSession(). Sets up and establishes communication channel between the client and the Sensing Hub framework. This should be called exactly once per ISession instance before any other operations such as setCallBacks() or sendRequest().
Closes the session for this instance and release associated resources. Terminates the communication channel between the client and the Sensing Hub framework and frees any resources held by this session. After close() is called: No further requests should be sent using this ISession instance. Registered callbacks will no longer receive events. The client is expected to call close() once it is done with the session to avoid leaks and dangling resources.
Set the callbacks for specified sensor SUID. Client needs to call only once per given suid. Associates response, error, and event callbacks with the given SUID for this session. These callbacks are invoked for messages received from Sensing Hub that correspond to the specified SUID.
Send an asynchronous request for a given sensor. Sends a protocol-buffer-encoded request message to the Sensing Hub for the specified SUID.
Destructor for ISession. Clients are expected to delete the ISession instance once the use case is complete to avoid memory leaks.
Error codes, if any, from ISession.
This callback is invoked when a response is received for the registered sensor SUID.
This callback is invoked when an error occurs in Sensing Hub.
This callback is invoked when an event is received for the registered sensor SUID.
Was this page helpful?

