This is the synchronous version of the AWT-DA HL library. More...
#include "libAwtDaProtocol.h"
#include "libAwtCom_sync.h"
#include "libAwtDaHL.h"
#include <stdint.h>
#include "libAwtDaHL.h"
Typedefs | |
typedef void(* | AwtOnMessageCB )(AwtDaObject *message, int needAnAck, void *pUserData) |
Callback type for message reception. | |
Functions | |
HL_API const char * | AWT_HL_S_Version (void) |
Get the version of the library. | |
HL_API AwtStatus | AWT_HL_S_DataManager_Create (AwtDataManager **ppDataManager, char *pAssetId, void *pUserData) |
Create the library context. | |
HL_API AwtStatus | AWT_HL_S_DataManager_Destroy (AwtDataManager *pDataManager) |
Destroy the library context, and release all associated resources. | |
HL_API AwtStatus | AWT_HL_S_DataManager_AddDataContainer (AwtDataManager *pDataManager, AwtDataContainer *pDataContainer, int32_t *requestId, AwtOnAckCB onAckCB) |
Add a Data Container into the "to send" queue. | |
HL_API AwtStatus | AWT_HL_S_DataManager_AddEvents (AwtDataManager *pDataManager, char *pRelativePath, int32_t startTime, AwtDaObject *pTimeDeltasList, AwtDaObject *pEventList, int32_t *requestId, AwtOnAckCB onAckCB) |
Add an Event list to the "to send" queue. | |
HL_API AwtStatus | AWT_HL_S_DataManager_AddEvent (AwtDataManager *pDataManager, char *pRelativePath, int32_t timestamp, AwtDaObject *pEvent, int32_t *requestId, AwtOnAckCB onAckCB) |
Add a single Event to the "to send" queue. | |
HL_API AwtStatus | AWT_HL_S_DataManager_SetMessageListener (AwtDataManager *pDataManager, const char *relativePath, int messageType, AwtOnMessageCB onMessageCB) |
Register a message reception listener. | |
HL_API AwtStatus | AWT_HL_S_DataManager_AddAcknowledgement (AwtDataManager *pDataManager, AwtDaObject *message, AwtDaObject *data, AwtStatus status) |
Send an acknowledgment of a received message. | |
HL_API AwtStatus | AWT_HL_S_DataManager_Flush (AwtDataManager *pDataManager) |
Flush the "to send" queue so that the stored messages are actually sent to the ReadyAgent. | |
HL_API AwtStatus | AWT_HL_S_DataManager_GetComHandle (AwtDataManager *pDataManager, AwtComContext **plibComContext) |
Retrieve the handle to the libCom Library. |
This is the synchronous version of the AWT-DA HL library.
Multithread safeness: The Data Manager API is protected by mutexes so it safe to call all the API from different thread on the same context. There is one exception though: the AWT_HL_S_DataManager_Destroy function is not protected and thus not thread-safe. The Data Containers API is not thread safe on the same object. It is safe to use the API into several threads, but not with the same object.
typedef void(* AwtOnMessageCB)(AwtDaObject *message, int needAnAck, void *pUserData) |
Callback type for message reception.
message | the message needs to be released once done with it, see AWT_DaObject_Release. | |
needAnAck | if non null, an acknowledge is requested by the other peer, use AWT_HL_S_DataManager_AddAcknowledgement to send back the acknowledgment. | |
pUserData | the user data value is the one given in the AWT_HL_S_DataManager_Create function. |
HL_API AwtStatus AWT_HL_S_DataManager_AddAcknowledgement | ( | AwtDataManager * | pDataManager, | |
AwtDaObject * | message, | |||
AwtDaObject * | data, | |||
AwtStatus | status | |||
) |
Send an acknowledgment of a received message.
The given message must have a non null ticketId. This function can only be used with messages received with AwtOnMessageCB listener.
pDataManager | the library context to use. | |
message | the message to acknowledge | |
data | the data object to send with the response object | |
status | the status to send with the response object |
HL_API AwtStatus AWT_HL_S_DataManager_AddDataContainer | ( | AwtDataManager * | pDataManager, | |
AwtDataContainer * | pDataContainer, | |||
int32_t * | requestId, | |||
AwtOnAckCB | onAckCB | |||
) |
Add a Data Container into the "to send" queue.
Data Container can be set to request an acknowledge on reception.
pDataManager | the library context to use. | |
pDataContainer | the Data Container to add in the "to send" queue. | |
requestId | if set to non-null and if onAckCB is non-null, a requestId will be associated with the Data Container. It will be send again when onAckCB is called, to be compared with the one returned by this function. | |
onAckCB | if set to non-null, the callback to use for the data acknowledgment. When the Server will receive the data it will send an acknowledge when the data are processed. This will cause a call to this callback. |
HL_API AwtStatus AWT_HL_S_DataManager_AddEvent | ( | AwtDataManager * | pDataManager, | |
char * | pRelativePath, | |||
int32_t | timestamp, | |||
AwtDaObject * | pEvent, | |||
int32_t * | requestId, | |||
AwtOnAckCB | onAckCB | |||
) |
Add a single Event to the "to send" queue.
As Data Containers, the Event can be set to request an acknowledge on reception.
pDataManager | the library context to use. | |
pRelativePath | the path (relative to the library root path) of the events sent. | |
timestamp | the timestamp of the event. | |
pEvent | the Event to send. | |
requestId | if set to non-null and if onAckCB is non-null, a requestId will be associated with the Data Container. It will be send again when onAckCB is called, to be compared with the one returned by this function. | |
onAckCB | if set to non-null, the callback to use for the data acknowledgment. When the Server will receive the data it will send an acknowledge when the data are processed. This will cause a call to this callback. |
HL_API AwtStatus AWT_HL_S_DataManager_AddEvents | ( | AwtDataManager * | pDataManager, | |
char * | pRelativePath, | |||
int32_t | startTime, | |||
AwtDaObject * | pTimeDeltasList, | |||
AwtDaObject * | pEventList, | |||
int32_t * | requestId, | |||
AwtOnAckCB | onAckCB | |||
) |
Add an Event list to the "to send" queue.
As Data Containers, the Event list can be set to request an acknowledge on reception.
pDataManager | the library context to use. | |
pRelativePath | the path (relative to the library root path) of the events sent. | |
startTime | timestamp of the 1st event of the list. | |
pTimeDeltasList | list of timestamp delta ( tsdelta(n) = ts(n)-ts(n-1) ) of the event n+1 in the event list. | |
pEventList | list of events. | |
requestId | if set to non-null and if onAckCB is non-null, a requestId will be associated with the Data Container. It will be send again when onAckCB is called, to be compared with the one returned by this function. | |
onAckCB | if set to non-null, the callback to use for the data acknowledgment. When the Server will receive the data it will send an acknowledge when the data are processed. This will cause a call to this callback. |
HL_API AwtStatus AWT_HL_S_DataManager_Create | ( | AwtDataManager ** | ppDataManager, | |
char * | pAssetId, | |||
void * | pUserData | |||
) |
Create the library context.
This function also set the root path of the library. The initialization is complete when the function returns.
ppDataManager | the pointer to store the created AwtDataManager* context, must be non NULL | |
pAssetId | the name of the application asset. All sent messages will be prefixed with this asset name. | |
pUserData | the user data that is given back in the different notification callbacks below. |
HL_API AwtStatus AWT_HL_S_DataManager_Flush | ( | AwtDataManager * | pDataManager | ) |
Flush the "to send" queue so that the stored messages are actually sent to the ReadyAgent.
pDataManager | the library context to use. |
HL_API AwtStatus AWT_HL_S_DataManager_GetComHandle | ( | AwtDataManager * | pDataManager, | |
AwtComContext ** | plibComContext | |||
) |
Retrieve the handle to the libCom Library.
The libCom context can be used to call libCom specific functions. For instance, in order to force a connection to the server AWT_Com_S_ForceConnectionToServer function can be used.
pDataManager | the library context to use. | |
plibComContext | the pointer where to store the AwtComContext*, must be non NULL. |
HL_API AwtStatus AWT_HL_S_DataManager_SetMessageListener | ( | AwtDataManager * | pDataManager, | |
const char * | relativePath, | |||
int | messageType, | |||
AwtOnMessageCB | onMessageCB | |||
) |
Register a message reception listener.
Call with a null callback in order to un-register a message reception listener.
pDataManager | the library context to use. | |
relativePath | relative path to register the listener on. | |
messageType | type of message to register the listener on, see AwtDaMessageType enum in libAwtDaProtocol.h . | |
onMessageCB | message reception listener |
HL_API const char* AWT_HL_S_Version | ( | void | ) |
Get the version of the library.
The string is statically allocated, and thus need not to be released.