-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URI updates #421
URI updates #421
Conversation
This will be needed for many of the commands in the LWM2M 1.1 Device Managenent and Service Enablement Interface and Information Reporting Interface. Also prevents transactions from generating bad URI paths. Signed-off-by: Scott Bertin <sbertin@telular.com>
The output of each is now valid as input to the other. Also adds a uri_depth_t of URI_DEPTH_NONE and uri_toString return the depth of the URI instead of one lower. Signed-off-by: Scott Bertin <sbertin@telular.com>
You beat me to this one. I was writing something on my side. There is one improvment in lwm2m_uri_t to do: Now in LwM2M (1.0 and 1.1), 65535 is a reserved value for every IDs. Thus #define LWM2M_MAX_ID ((uint16_t)0xFFFF)
#define LWM2M_URI_IS_SET_INSTANCE(uri) ((uri)->instanceId != LWM2M_MAX_ID)
#define LWM2M_URI_IS_SET_RESOURCE(uri) ((uri)->resourceId != LWM2M_MAX_ID)
#define LWM2M_URI_IS_SET_RESOURCE_INSTANCE(uri) ((uri)->resInstanceId != LWM2M_MAX_ID)
typedef struct
{
uint16_t objectId;
uint16_t instanceId;
uint16_t resourceId;
#ifndef LWM2M_VERSION_1_0
uint16_t resInstanceId;
#endif
} lwm2m_uri_t;
#define LWM2M_URI_RESET(uri) memset((uri), 0xFF, sizeof(lwm2m_uri_t)) Your thoughts ? |
I wasn't planning to do it yet, but I ended up wanting it in place while I worked on the SenML JSON support. I like your suggestion and will work on the changes for it. These existing flags
will need to be handled differently, but I never really thought they belonged in the URI flags anyway. |
Right. I was planning to change lwm2m_uri_t * uri_decode(char * altPath, multi_option_t *uriPath); to typedef enum
{
LWM2M_URI_TYPE_UNKNOWN,
LWM2M_URI_TYPE_DM,
LWM2M_URI_TYPE_REGISTRATION,
LWM2M_URI_TYPE_BOOTSTRAP
} lwm2m_uri_type_t;
lwm2m_uri_type_t uri_decode(char * altPath, multi_option_t *uriPath, lwm2m_uri_t *uriP); |
IDs of LWM2M_MAX_ID now indicate an unset ID. Adds LWM2M_URI_RESET to properly initialize an lwm2m_uri_t. uri_decode changed to return the request type seperately. Pointer to uri to be set now passed in instead of allocated. discover_serialize and object_create changed to not modify the passed in uri. Additional validation of the created response. Remove isUri from bs_data_t. Signed-off-by: Scott Bertin <sbertin@telular.com>
I do have SenML JSON support ready to go once this is merged. It depends on having the resource instance ID in lwm2m_uri_t. |
Expand lwm2m_uri_t to have resourceInstanceId. This will be needed for many of the commands in the LWM2M 1.1 Device Managenent and Service Enablement Interface and Information Reporting Interface.
Also makes uri_toString and lwm2m_stringToUri proper inverses.