Skip to content

LWM2M: send arbitrary data #91590

Open
@jvermillard

Description

@jvermillard

Is your feature request related to a problem? Please describe.

I work on a system where I need to collect various resources according to specific filtering rules (configured using an LWM2M object). After some time, I want to send the accumulated data using an LWM2M send operation.

The problem with the current Zephyr LWM2M API is that you are bound to the values resource changes in the cache system, and trigger the sending. If you want to filter the data according to specific business rules, it's not possible.

The LWM2M 1.1 Core spec says: "The Resources and Resource Instances to send are implementation specific." But the way it's implemented in Zephyr, you will collect all the value changes for the "cached" resources.

Describe the solution you'd like

Either a lower-level send API that permits sending any timeseries payload, or a way to filter the values going into the cache before triggering the LWM2M send operation.

[Edit]

I put more thought into what a solution would look like:

First, manage a sample ring in the application side and not in the Zehpyr LWM2M client, so the application would have the requested flexibility to accumulate and drop samples as the business logic would require.
Now, on the Zephyr LWM2M client side, we would need a new API, allowing us to provide a list of samples in the form of:

struct lwm2m_ts_sample {
    struct lwm2m_obj_path path;   /*  /object/instance/resource[ /res‑inst ] */
    enum lwm2m_value_type type; 
    int64_t timestamp_ms;         /* Epoch milliseconds (UTC)  */
    union {
        int64_t  v_int;
        double   v_float;
        bool     v_bool;
        struct {
            const uint8_t *ptr;
            uint16_t len;
        } v_buf;
    } value;
};

The Zephyr LWM2M client would be responsible for encoding data as SenML (CBOR/JSON) and handling the CoAP blockwise transfer.
Of course, this mechanism would be in parallel with the current cache-based implementation, and the code for encoding/sending the senML payload would be refactored to be used for both code paths.

Describe alternatives you've considered

Using observer (or compose observe) is not an option for me because it generates more packets, so larger payloads and longer on-air time, on a battery-sensitive application.

Contribution?

If I could provide the effort to spearhead this development, would the project be interested in such a contribution?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions