21 #ifndef PT_API_VERSION 22 #define PT_API_VERSION 1 24 #if PT_API_VERSION != 1 25 #error "Including mixed versions of Protocol API" 32 #define DEPRECATED(func) func __attribute__((deprecated)) 34 #pragma message("WARNING: Implement DEPRECATED macro, it is missing.") 35 #define DEPRECATED(func) func 42 #include "edge-rpc/rpc.h" 198 const uint8_t *value,
252 typedef int (*pt_received_write_handler)(
struct connection *connection,
253 const char *device_id,
const uint16_t object_id,
254 const uint16_t instance_id,
255 const uint16_t resource_id,
256 const unsigned int operation,
257 const uint8_t *value,
const uint32_t value_size,
266 PT_STATUS_SUCCESS = 0,
268 PT_STATUS_ITEM_EXISTS,
269 PT_STATUS_INVALID_PARAMETERS,
270 PT_STATUS_ALLOCATION_FAIL,
271 PT_STATUS_NOT_CONNECTED
279 unsigned int operations;
285 typedef NS_LIST_HEAD(
pt_resource_t, link) pt_resource_list_t;
290 pt_resource_list_t *resources;
299 pt_object_instance_list_t *instances;
303 typedef NS_LIST_HEAD(
pt_object_t, link) pt_object_list_t;
307 typedef void (*pt_device_free_userdata_cb_t)(
void *
data);
321 pt_device_free_userdata_cb_t
329 queuemode_t queuemode;
331 pt_object_list_t *objects;
351 typedef struct connection connection_t;
401 pt_status_t pt_register_protocol_translator(connection_t *connection,
422 pt_status_t pt_register_device(connection_t *connection,
443 pt_status_t pt_unregister_device(connection_t *connection,
462 pt_device_free_userdata_cb_t free_userdata_cb));
483 pt_device_t *pt_create_device_with_userdata(
char *device_id,
484 const uint32_t lifetime,
485 const queuemode_t queuemode,
506 const uint32_t lifetime,
507 const queuemode_t queuemode,
508 pt_status_t *status));
604 pt_status_t *status));
687 pt_status_t pt_write_value(connection_t *connection,
689 pt_object_list_t *objects,
705 DEPRECATED(
int pt_receive_write_value(json_t *request, json_t *json_params, json_t **result,
void *userdata));
726 connection_t **connection));
Contains fields for client user data.
Definition: pt_api.h:319
Lwm2mResourceType
LwM2M resource type enumeration constants.
Definition: constants.h:48
void(* pt_connection_ready_cb)(connection_id_t connection_id, const char *name, void *userdata)
A function prototype for calling the client code when the connection is ready for passing messages...
Definition: pt_client_api.h:75
void * data
Definition: pt_api.h:320
Common constants used in Edge Core.
struct protocol_translator_callbacks protocol_translator_callbacks_t
A structure to hold the callbacks of the protocol translator.
void(* pt_disconnected_cb)(connection_id_t connection_id, void *userdata)
A function prototype for calling the client code when the connection is disconnected.
Definition: pt_client_api.h:84
pt_status_t pt_client_shutdown(pt_client_t *client)
Gracefully shuts down the protocol translator client.
pt_received_write_handler received_write_cb
Definition: pt_api.h:347
void(* pt_device_response_handler)(const connection_id_t connection_id, const char *device_id, void *userdata)
A function pointer type definition for callbacks given in the device API functions as an argument...
Definition: pt_api.h:211
pt_device_free_userdata_cb_t pt_device_free_userdata
Definition: pt_api.h:322
Default message ID generator for JSON-RPC messages.
pt_status_t(* pt_resource_callback)(const connection_id_t connection_id, const char *device_id, const uint16_t object_id, const uint16_t object_instance_id, const uint16_t resource_id, const uint8_t operation, const uint8_t *value, const uint32_t size, void *userdata)
Callback function prototype for the device resource specific action on OPERATION_WRITE or OPERATION_E...
Definition: pt_api.h:182
A structure to hold the callbacks of the protocol translator.
Definition: pt_api.h:344
void(* pt_connection_shutdown_cb)(connection_id_t connection_id, void *userdata)
A function prototype for calling the client code when the connection is shutting down.
Definition: pt_client_api.h:93
int pt_client_start(pt_client_t *client, pt_response_handler success_handler, pt_response_handler failure_handler, const char *name, void *userdata)
Starts the protocol translator client event loop and tries to connect to a local instance of Device M...
struct pt_device_userdata_s pt_device_userdata_t
Contains fields for client user data.
pt_status_t
Enumeration containing the possible return status codes for Protocol API functions.
Definition: pt_common_api.h:51
void(* pt_response_handler)(void *userdata)
A function pointer type definition for callbacks given in the protocol translator API functions as an...
Definition: pt_client_api.h:65
DEPRECATED(typedef void(*pt_resource_callback)(const pt_resource_t *resource, const uint8_t *value, const uint32_t size, void *userdata))
Callback function prototype for the device resource specific action on OPERATION_WRITE or OPERATION_E...