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

Add Send Operation #971

Merged
merged 9 commits into from
Mar 9, 2021
Merged

Add Send Operation #971

merged 9 commits into from
Mar 9, 2021

Conversation

sbernard31
Copy link
Contributor

This aims to add support of Send Operation to Leshan.

See LWM2M specification for more details :

The API look like this :

Client Side:

// send data
SendResponse r = client.sendData (server,
                                  ContentFormat.SENML_JSON, 
                                  Arrays.asList("/3/0/1", "/3/0/2"),
                                  timeoutInMs);

Server Side:

// listen for new data
server.getSendService().addListener(new SendListener() {
  @Override
  public void dataReceived(Registration registration, Map<LwM2mPath, LwM2mNode> data, SendRequest request) {
      System.out.println(data);
  }
});

List of concerns or potential improvements :

  • at client side, add more low level function allowing to send SendRequest directly.
  • at server side, current Map<LwM2mPath, LwM2mNode> data is not so good. LwM2mPath is largely used internally but generally not so exposed. (we have same problem with WriteComposite)
  • at server side, if an error occurred when handling SendRequest, this is not reported to application layer, it should maybe be reported in SendListener.
  • at server side, in addition of listener maybe we should add a kind of DataCollector which could be able to report the data handling state. This could be useful to let device know when data was not collected/handled correctly.

@sbernard31
Copy link
Contributor Author

I changed the Send API at server side like this :

// listen for new data
server.getSendService().addListener(new SendListener() {
  @Override
  public void dataReceived(Registration registration, Map<String, LwM2mNode> data, SendRequest request) {
      System.out.println(data);
  }
});

(data attribute changed from Map<LwM2mPath, LwM2mNode> to Map<String, LwM2mNode> data)

@sbernard31
Copy link
Contributor Author

Still not entirely satisfied by the API an maybe we should go to something like #981.

@sbernard31 sbernard31 changed the base branch from write_composite to master March 9, 2021 16:58
@sbernard31 sbernard31 merged commit 18990fe into master Mar 9, 2021
@sbernard31 sbernard31 deleted the send branch June 3, 2021 07:52
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.

1 participant