1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #21034 from leandrolanzieri/pr/wakaama/fix_uri

pkg/wakaama: Fix usages of `lwm2m_uri_t` and ISPO sensor
This commit is contained in:
Teufelchen 2024-11-25 10:10:53 +00:00 committed by GitHub
commit 3a7f3b4880
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 49 deletions

View File

@ -117,9 +117,9 @@ static credman_tag_t _get_credential(const sock_udp_ep_t *ep, uint8_t security_m
}
/* prepare query */
lwm2m_uri_t query_uri = {
.objectId = LWM2M_SECURITY_OBJECT_ID,
};
lwm2m_uri_t query_uri;
LWM2M_URI_RESET(&query_uri);
query_uri.objectId = LWM2M_SECURITY_OBJECT_ID;
lwm2m_list_t *instance = sec->instanceList;
@ -409,9 +409,9 @@ void lwm2m_client_refresh_dtls_credentials(void)
}
/* prepare query */
lwm2m_uri_t query_uri = {
.objectId = LWM2M_SECURITY_OBJECT_ID,
};
lwm2m_uri_t query_uri;
LWM2M_URI_RESET(&query_uri);
query_uri.objectId = LWM2M_SECURITY_OBJECT_ID;
lwm2m_list_t *instance = sec->instanceList;
int64_t val;

View File

@ -280,11 +280,11 @@ static lwm2m_client_connection_t *_connection_create(uint16_t sec_obj_inst_id,
DEBUG("Creating connection\n");
/* prepare Server URI query */
lwm2m_uri_t resource_uri = {
.objectId = LWM2M_SECURITY_URI_ID,
.instanceId = sec_obj_inst_id,
.resourceId = LWM2M_SECURITY_URI_ID,
};
lwm2m_uri_t resource_uri;
LWM2M_URI_RESET(&resource_uri);
resource_uri.objectId = LWM2M_SECURITY_URI_ID;
resource_uri.instanceId = sec_obj_inst_id;
resource_uri.resourceId = LWM2M_SECURITY_URI_ID;
int res = lwm2m_get_string(client_data, &resource_uri, uri, &uri_len);
if (res < 0) {

View File

@ -257,7 +257,7 @@ out:
}
static uint8_t _exec_cb(lwm2m_context_t * context, uint16_t instance_id, uint16_t resource_id,
uint8_t * buffer, int length, lwm2m_object_t * object);
uint8_t * buffer, int length, lwm2m_object_t * object)
{
(void)context;
(void)buffer;
@ -380,13 +380,12 @@ static void _mark_resource_as_changed(const lwm2m_object_t *object, uint16_t ins
uint16_t resource_id)
{
lwm2m_uri_t uri;
LWM2M_URI_RESET(&uri);
uri.objectId = object->objID;
uri.instanceId = instance_id;
uri.resourceId = resource_id;
uri.flag = LWM2M_URI_FLAG_OBJECT_ID | LWM2M_URI_FLAG_INSTANCE_ID | LWM2M_URI_FLAG_RESOURCE_ID;
lwm2m_resource_value_changed(lwm2m_client_get_ctx(object->userData), &uri);
}

View File

@ -343,6 +343,7 @@ free_out:
static void _mark_resource_changed(uint16_t instance_id, uint16_t resource_id)
{
lwm2m_uri_t uri;
LWM2M_URI_RESET(&uri);
uri.objectId = LWM2M_LIGHT_CONTROL_OBJECT_ID;
uri.instanceId = instance_id;
uri.resourceId = resource_id;

View File

@ -507,41 +507,6 @@ int lwm2m_set_objlink(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri,
int lwm2m_set_objlink_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
uint16_t object_id_in, uint16_t instance_id_in);
#ifdef DOXYGEN
/**
* @name URI representation
* @brief Note that these are defined in `liblwm2m.h`.
* @{
*/
/**
* @brief Flag to indicate in @ref lwm2m_uri_t::flag that the object ID is present.
*/
#define LWM2M_URI_FLAG_OBJECT_ID (uint8_t)0x04
/**
* @brief Flag to indicate in @ref lwm2m_uri_t::flag that the instance ID is present.
*/
#define LWM2M_URI_FLAG_INSTANCE_ID (uint8_t)0x02
/**
* @brief Flag to indicate in @ref lwm2m_uri_t::flag that the resource ID is present.
*/
#define LWM2M_URI_FLAG_RESOURCE_ID (uint8_t)0x01
/**
* @brief Representation of an URI in a LwM2M client (defined in `liblwm2m.h`).
*/
typedef struct {
uint8_t flag; /**< indicates which segments are present */
uint16_t objectId; /**< object ID */
uint16_t instanceId; /**< instance ID */
uint16_t resourceId; /**< resource ID */
} lwm2m_uri_t;
/** @} */
#endif /* DOXYGEN */
#ifdef __cplusplus
}
#endif