Skip to content

Commit

Permalink
wakaama: changed signature of callback function to new one
Browse files Browse the repository at this point in the history
wakaama: changed signature of callback function to new one
  • Loading branch information
moritzholzer committed Oct 21, 2024
1 parent 6d6300d commit daf550d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 35 deletions.
36 changes: 14 additions & 22 deletions pkg/wakaama/contrib/objects/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ static bool reboot;

/**
* @brief 'Execute' callback for the Device object.
*
*
* @param[in] context Lwm2m Context.
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
* @param[in] resource_id ID of the resource to execute.
* @param[in] buffer Information needed for the execution.
Expand Down Expand Up @@ -70,6 +71,7 @@ static uint8_t _read_cb(lwm2m_context_t *context, uint16_t instance_id, int *num
/**
* @brief 'Discover' callback for the Device object.
*
* @param[in] context Lwm2m Context.
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
* @param[in, out] num_data Number of resources requested. 0 means all.
* @param[in, out] data_array Initialized data array to determine if the resource exists,
Expand All @@ -80,29 +82,21 @@ static uint8_t _read_cb(lwm2m_context_t *context, uint16_t instance_id, int *num
* @return COAP_404_NOT_FOUND when a resource is not supported
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
*/
static uint8_t _discover_cb(lwm2m_context_t *context, uint16_t instance_id, int *num_data,
lwm2m_data_t **data_array, lwm2m_object_t *object);
static uint8_t _discover_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,

typedef struct {
lwm2m_list_t list; /**< Linked list handle */
} lwm2m_obj_device_inst_t;

static const lwm2m_obj_device_inst_t _instance;

/**
* @brief Implementation of the object interface for the Device Object.
*/
static lwm2m_object_t _device_object = {
.next = NULL,
.objID = LWM2M_DEVICE_OBJECT_ID,
.instanceList = (lwm2m_list_t *)&_instance,
.readFunc = _read_cb,
.executeFunc = _execute_cb,
.discoverFunc = _discover_cb,
.writeFunc = NULL,
.deleteFunc = NULL,
.createFunc = NULL,
.userData = NULL
.next = NULL,
.objID = LWM2M_DEVICE_OBJECT_ID,
.instanceList = (lwm2m_list_t *)&_instance,
.readFunc = _read_cb,
.executeFunc = _execute_cb,
.discoverFunc = _discover_cb,
.writeFunc = NULL,
.deleteFunc = NULL,
.createFunc = NULL,
.userData = NULL
};

static uint8_t _discover_cb(lwm2m_context_t *context, uint16_t instance_id, int *num_data,
Expand Down Expand Up @@ -272,8 +266,6 @@ static uint8_t _execute_cb(lwm2m_context_t *context, uint16_t instance_id, uint1
{
(void)context;
(void)buffer;
(void)object;

/* single instance object */
if (instance_id != 0) {
return COAP_404_NOT_FOUND;
Expand Down
9 changes: 0 additions & 9 deletions pkg/wakaama/contrib/objects/light_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ static uint8_t _write_cb(lwm2m_context_t *context, uint16_t instance_id, int num
lwm2m_data_t *data_array, lwm2m_object_t *object,
lwm2m_write_type_t write_type);

/**
* @brief Gets the current value of a given @p instance.
*
* @param[in, out] data Initialized data structure.
* @param[in] instance Pointer to the instance to get the value from.
*
* @return COAP_205_CONTENT on success
Expand Down Expand Up @@ -220,11 +216,6 @@ static uint8_t _read_cb(lwm2m_context_t *context, uint16_t instance_id, int *num
static uint8_t _write_cb(lwm2m_context_t *context, uint16_t instance_id, int num_data,
lwm2m_data_t *data_array, lwm2m_object_t *object,
lwm2m_write_type_t write_type)
{
(void)context;
(void)write_type;

lwm2m_obj_light_control_inst_t *instance;
uint8_t result = COAP_204_CHANGED;
bool call_cb = false;

Expand Down
4 changes: 0 additions & 4 deletions pkg/wakaama/contrib/objects/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,6 @@ static uint8_t _delete_cb(lwm2m_context_t *context, uint16_t instance_id,
static uint8_t _create_cb(lwm2m_context_t *context, uint16_t instance_id, int num_data,
lwm2m_data_t *data_array, lwm2m_object_t *object)
{
(void)context;

lwm2m_obj_security_inst_t *instance;
uint8_t result;

mutex_lock(&_security_object.lock);

Expand Down

0 comments on commit daf550d

Please sign in to comment.