Hi Cristiano,
I added Californium dependency to kura. Then I started implementing by making a new package as you said before. There are several problems that makes it very hard to implement. I have tried days to implement this protocol without changing to the existing code. I'm on the way of finishing implementing that. But I think It is good to mention the problems.
1. MqttDataTransport implements DataTransportService. it contains connect, disconnect, subscribe, unsubscribe, publish, getUserName methods. but since CoAP is not connection oriented, it does not need connect and disconnect methods. but I had to Implement those. so I included things that should be done at the beginning of a communication and end of a communication to those methods. CoAP have GET, POST, PUT, DELETE methods instead of publish and subscribe.
2. When the data flow comes from the above layers, most of those methods have inherited mqtt nature.
For example, when we get a new cloud client in example.publisher by sending APP_ID, CloudServiceImpl have a method publishAppCertificate() which make the topic and send it to publishLifeCycleMessage() method which send the topic and payload to m_dataService.publish() which is a mqtt method. In making that topic it uses the tokens from CloudServiceOptions (like #account-name, client-id, MQTT/BIRTH).
so that, implementation on the existing one without changing it is very challenging. up to now I have implemented isConnect(), connect(), disconnect(), and some more methods in an acceptable way. I have to implement subscribe(), unsubscribe(), pulblish().
we can send requests asynchronously and define a handler to invoke when a response comes from the server. I can use that inside subscribe method. but I have no way to change the topic without changing existing code.
I'm very happy to have a idea about my current situation.
Thank You.