21 #ifndef PT_API_VERSION 22 #define PT_API_VERSION 2 24 #if PT_API_VERSION != 2 25 #error "Including mixed versions of Protocol API" 179 const char *device_id,
180 const uint16_t object_id,
181 const uint16_t object_instance_id,
182 const uint16_t resource_id,
183 const uint8_t operation,
184 const uint8_t *value,
226 const char *device_id,
227 const uint32_t lifetime,
228 const queuemode_t queuemode,
250 const char *device_id,
251 const uint32_t lifetime,
252 const queuemode_t queuemode,
253 const uint32_t features,
269 const char *device_id,
270 const uint32_t lifetime,
271 const queuemode_t queuemode);
285 const char *device_id,
304 const char *device_id,
325 const char *device_id,
346 const char *device_id,
371 const char *device_id,
372 const uint16_t object_id,
373 const uint16_t object_instance_id,
374 const uint16_t resource_id,
375 const uint8_t *value,
387 bool pt_device_exists(
const connection_id_t connection_id,
const char *device_id);
401 const char *device_id,
402 const uint16_t object_id,
403 const uint16_t object_instance_id,
404 const uint16_t resource_id);
446 const char *device_id,
447 const uint16_t object_id,
448 const uint16_t object_instance_id,
449 const uint16_t resource_id,
506 const char *device_id,
507 const uint16_t object_id,
508 const uint16_t object_instance_id,
509 const uint16_t resource_id,
511 const uint8_t operations,
531 const char *device_id,
532 const uint16_t object_id,
533 const uint16_t object_instance_id,
534 const uint16_t resource_id,
536 uint32_t *value_len_out);
550 const char *device_id,
577 const char *device_id,
578 const uint16_t object_id,
579 const uint16_t object_instance_id,
580 const uint16_t resource_id);
611 const char *device_id,
612 const uint16_t object_id,
613 const uint16_t object_instance_id,
614 const uint16_t resource_id,
pt_status_t pt_device_add_resource(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 Lwm2mResourceType type, uint8_t *value, uint32_t value_size, pt_resource_value_free_callback value_free_cb)
Adds a read-only resource to a device.
int32_t pt_device_get_next_free_object_instance_id(connection_id_t connection_id, const char *device_id, uint16_t object_id)
Get the id of first free object instance for given object.
Lwm2mResourceType
LwM2M resource type enumeration constants.
Definition: constants.h:48
pt_status_t pt_device_set_userdata(connection_id_t connection_id, const char *device_id, pt_userdata_t *userdata)
Set the set user data to the device. This may be useful if the client needs to associate some extra d...
pt_status_t pt_device_get_resource_value(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, uint8_t **value_out, uint32_t *value_len_out)
Utility function to get the current value in a resource.
pt_status_t pt_device_write_values(const connection_id_t connection_id, const char *device_id, pt_device_response_handler success_handler, pt_device_response_handler failure_handler, void *userdata)
Writes changed values from the endpoint device to Edge Core.
pt_status_t pt_device_register(const connection_id_t connection_id, const char *device_id, pt_device_response_handler success_handler, pt_device_response_handler failure_handler, void *userdata)
Endpoint device registration function. Every endpoint device must be registered with the protocol tra...
pt_status_t pt_resource_set_userdata(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, pt_userdata_t *userdata)
Set the set user data to the resource. This may be useful if the client needs to associate some extra...
pt_status_t pt_device_unregister(const connection_id_t connection_id, const char *device_id, pt_device_response_handler success_handler, pt_device_response_handler failure_handler, void *userdata)
Endpoint device unregistration function. If the device unregistration succeeds, the device instance d...
pt_status_t pt_device_create_with_userdata(const connection_id_t connection_id, const char *device_id, const uint32_t lifetime, const queuemode_t queuemode, pt_userdata_t *userdata)
Creates the device structure.
pt_status_t pt_device_get_feature_flags(const connection_id_t connection_id, const char *device_id, uint32_t *features)
Retrieves the feature flags of a device.
Contains the interface to manage multiple devices.
void(* pt_resource_value_free_callback)(void *value)
Callback function prototype for freeing the resource value.
Definition: pt_api.h:193
pt_status_t pt_device_create(const connection_id_t connection_id, const char *device_id, const uint32_t lifetime, const queuemode_t queuemode)
Creates the device structure.
Protocol translator API for client's data.
pt_userdata_t * pt_resource_get_userdata(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)
Retrieve the set user data in the resource. Client needs to provide the full path to the resource...
Contains common structures and definitions for the protocol translator client.
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:207
pt_status_t pt_device_set_resource_value(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 *value, uint32_t value_len, pt_resource_value_free_callback value_free_cb)
Set a new value to resource in the device.
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:178
pt_status_t pt_device_add_resource_with_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 Lwm2mResourceType type, const uint8_t operations, uint8_t *value, uint32_t value_size, pt_resource_value_free_callback value_free_cb, pt_resource_callback callback)
Adds a resource to a device with a callback.
bool pt_device_exists(const connection_id_t connection_id, const char *device_id)
Utility function to check if device already exists for the connection.
pt_status_t pt_device_create_with_feature_flags(const connection_id_t connection_id, const char *device_id, const uint32_t lifetime, const queuemode_t queuemode, const uint32_t features, pt_userdata_t *userdata)
Creates the device structure and enables additional features.
bool pt_device_resource_exists(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)
Utility function to check if resource already exists for the connection and device.
pt_userdata_t * pt_device_get_userdata(connection_id_t connection_id, const char *device_id)
Retrieve the set user data in the device.
pt_status_t
Enumeration containing the possible return status codes for Protocol API functions.
Definition: pt_common_api.h:51
Contains fields for client user data.
Definition: pt_userdata_api.h:62
Contains the interface to create, connect, register, unregister and shut down the protocol translator...