Skip to content
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

Merged
merged 3 commits into from Feb 19, 2019
Merged

URI updates #421

merged 3 commits into from Feb 19, 2019

Conversation

sbertin-telular
Copy link
Contributor

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.

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>
@dnav
Copy link
Contributor

dnav commented Feb 14, 2019

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 lwm2m_uri_t::flags is now longer required. When an ID is not set, just put the value 0xFFFF. This translates as:

#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 ?

@sbertin-telular
Copy link
Contributor Author

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

#define LWM2M_URI_FLAG_DM           (uint8_t)0x00
#define LWM2M_URI_FLAG_DELETE_ALL   (uint8_t)0x10
#define LWM2M_URI_FLAG_REGISTRATION (uint8_t)0x20
#define LWM2M_URI_FLAG_BOOTSTRAP    (uint8_t)0x40

will need to be handled differently, but I never really thought they belonged in the URI flags anyway.

@dnav
Copy link
Contributor

dnav commented Feb 14, 2019

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>
@sbertin-telular
Copy link
Contributor Author

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.

@dnav dnav merged commit 4492070 into eclipse-wakaama:master Feb 19, 2019
@sbertin-telular sbertin-telular deleted the uri_updates branch February 19, 2019 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants