Data Delivery C API Library Reference
2.0
|
Data Structures | |
struct | ddca_devadpt_context_t |
Device Adapter context variable type for DDCA Device Adapter API. More... | |
Functions | |
int | ddca_devadpt_context_create (ddca_devadpt_context_t **context) |
create connection for device adapter | |
int | ddca_devadpt_init (const ddca_devadpt_context_t *context, const char *devadpt_profile_name) |
initialize connection for device adapter | |
int | ddca_devadpt_emit (const ddca_event_t *evt) |
emit given event data to Edge Delivery Core | |
int | ddca_devadpt_emit_with_data_type (const ddca_event_t *evt) |
emit given event data with data_type to Edge Delivery Core | |
int | ddca_devadpt_destroy () |
destroy the context | |
int | ddca_devadpt_register_device (const char *device_profile_name, char **device_id) |
register device to the system | |
int | ddca_devadpt_register_multi_devices (const char *device_profile_name, int device_number, char ***device_ids) |
register devices to the system | |
int | ddca_devadpt_register_event_cb (int(*EVENT_CB)(const ddca_event_t *event)) |
register the event callback function | |
int | ddca_devadpt_register_operation_cb (int(*AP_OPERATION_CB)(ddca_event_t *event)) |
register the operation callback function | |
int | ddca_devadpt_register_notification_cb (int(*NOTIFICATION_CB)(const ddca_event_t *event)) |
register the notification callback function | |
int | ddca_devadpt_respond (const char *op_id, const ddca_bool_t success, const char *device_id) |
send an acknowledgement of the message from REST API to the backend | |
int | ddca_devadpt_start () |
start to receive the event callback request | |
int | ddca_devadpt_stop () |
stop to receive the event callback request | |
int | ddca_devadpt_join () |
join the event callback receive thread | |
int | ddca_devadpt_get_profile (const char *device_id, ddca_conf_profile_t **profile) |
get a registered profile | |
int | ddca_devadpt_update_profile (const char *device_id) |
update profile |
int ddca_devadpt_context_create | ( | ddca_devadpt_context_t ** | context | ) |
create connection for device adapter
This function creates the connection context for a given device adapter to Edge delivery core.
[in,out] | *context | connection context |
ADPT_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_destroy | ( | ) |
destroy the context
This function destroys the context of connection. The function must be called before the end of the program to exit cleanly.
ADPT_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_emit | ( | const ddca_event_t * | evt | ) |
emit given event data to Edge Delivery Core
This function emits the given evt data to Edge Delivery Core indicated by the context.
[in] | *evt | data to be emitted |
ADPT_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_emit_with_data_type | ( | const ddca_event_t * | evt | ) |
emit given event data with data_type to Edge Delivery Core
This function emits the given evt data with data_type to Edge Delivery Core indicated by the context.
[in] | *evt | data to be emitted |
ADPT_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_get_profile | ( | const char * | device_id, |
ddca_conf_profile_t ** | profile | ||
) |
get a registered profile
This function returns a pointer to a registered profile. If device_id is "", the return value is profile of device adapter.
[in] | *device_id | device_id strings assigned to the device |
[out] | **profile | a regitered profile |
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_init | ( | const ddca_devadpt_context_t * | context, |
const char * | devadpt_profile_name | ||
) |
initialize connection for device adapter
This function initializes the connection for a given device adapter to Edge delivery core using a context given as a parameter.
[in] | *context | connection context |
[in] | *ddca_devadpt_profile | device adapter profile |
ADPT_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_join | ( | ) |
join the event callback receive thread
This function waits to join to the event callback receive thread. The function must be called between the call of ddca_devadpt_start and ddca_devadpt_destroy to terminate the program cleanly.
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_register_device | ( | const char * | device_profile_name, |
char ** | device_id | ||
) |
register device to the system
This function registers the information of given device to the system. Devices which is going to emit the data to the system must be registered beforehand.
[in] | *device_profile_name | name of device profile to be registered |
[out] | **device_id | device_id strings assigned by the registration |
ADPT_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_register_event_cb | ( | int(*)(const ddca_event_t *event) | EVENT_CB | ) |
register the event callback function
This function marks the given function as the event callback function. This event callback function will be called when the new event is notified to this Deivce Adapter.
[in] | *EVENT_CB | function pointer to be marked as the event callback function |
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_register_multi_devices | ( | const char * | device_profile_name, |
int | device_number, | ||
char *** | device_ids | ||
) |
register devices to the system
This function registers the information of given multi devices to the system. Devices which is going to emit the data to the system must be registered beforehand.
[in] | *device_profile_name | name of multi devices profile to be registered |
[in] | device_number | the number of devices to be registered by this function call |
[out] | ***device_ids | an array of device_id strings assigned by the registration |
ADPT_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_register_notification_cb | ( | int(*)(const ddca_event_t *event) | NOTIFICATION_CB | ) |
register the notification callback function
This function marks the given function as the notification callback function. This notification callback function will be called when the notification message is delivered from ICE Core. This notification callback function is used to receive the ddca_event_t variable as the command from ICE Core and expected to act following to its context.
[in] | *NOTIFICATION_CB | the pointer which indicates the notifiaction callback function |
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_register_operation_cb | ( | int(*)(ddca_event_t *event) | AP_OPERATION_CB | ) |
register the operation callback function
This function marks the given function as the operation callback function. This operation callback function will be called when the operation message is delivered from REST API to this device adapter or one of devices managed by this device adapter via ICE Core(the sink variable of the given event variable stands for the target device id if the target of the message is the device; it is empty string if the target is device adapter itself). This operation callback function is used to receive the ddca_event_t variable as the command from REST and expected to act following to its context. ddca_devadpt_respond API is available to respond an acknowledgement to the backend in the callback function.
[in] | *AP_OPERATION_CB | the pointer which indicates the operation callback function |
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_respond | ( | const char * | op_id, |
const ddca_bool_t | success, | ||
const char * | device_id | ||
) |
send an acknowledgement of the message from REST API to the backend
This function sends an acknowledgement of the message from REST API to the backend. The response can be associated with the message with an op_id and accumulated to the database on the backend. This function is intended to use to the case that to tell the REST API operator the published message is delivered to the application properly which do not return any result, or which return the result after a while. This functoin can be called only once by an operation. If device_id is "", the sender of this response is set to the device adapter.
[in] | *op_id | operation id to be reported with the result |
[in] | success | result to be reported |
[in] | *device_id | device_id strings assigned to the device |
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_start | ( | ) |
start to receive the event callback request
This function starts to receive the event callback request. The event callback request will be delivered after this function is called.
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_stop | ( | ) |
stop to receive the event callback request
This function stops to receive the event callback request. The event callback request will not be delivered after this function is called.
DDCA_SUCCESS | operation success |
others | operation failure |
int ddca_devadpt_update_profile | ( | const char * | device_id | ) |
update profile
This function notifies C API of renewing a profile. A profile is read in C API, and it's re-registered. If device_id is "", the profile of device adapter is updated.
[in] | *device_id | device_id strings assigned to the device |
DDCA_SUCCESS | operation success |
others | operation failure |