|Re: [om2m-dev] maybe a stupid question on the things' side|
Thank you for your comment. I really appreciate the things that your are trying to do and put together in your project.
There are two mechanisms to integrate legacy devices into OM2M.
Case 1) HTTP or CoAP enabled devices.
Let's suppose that you have a HTTP-enabled plug device with IP address 192.168.0.4 and listening port 9090.
You can monitor and control this plug using this two specific HTTP requests:
HTTP request example:
<om2m:application xmlns:om2m="http://uri.etsi.org/m2m" appId="MY_DEVICE">
That's all. Now when you send a HTTP GET request to the GSCL with this URI "127.0.0.1:8080/om2m/gscl/applications/MY_DEVICE/state", the GSCL will automatically translate it to http://192.168.0.4:9090/state based on the information stored on the APoC.
Then, the HTTP request is re-targeted to your plug device, and the HTTP response is returned to you.
If you send a HTTP POST request with empty body to the GSCL with this URI "127.0.0.1:8080/om2m/gscl/applications/MY_DEVICE/toggle", it will be automatically translated to http://192.168.0.4:9090/toggle and re-targeted to your device to toggle it.
In addition, you can create an oBIX XML description for the MY_DEVICE application within a specific container to advertise your device operations and simplify their discovery.
Let's suppose that the "DESCRIPTOR" container is already created in this URL: /gscl/applications/MY_DEVICE/containers/DESCRIPTIOR
HTTP request example:
<str name="type" val="xxxx"/>
<str name="location" val="yyyy"/>
<op name="get" href="" is="retrieve"/>
<op name="toggle" href="" is="execute"/>
If you check the created contentInstance on the OM2M web interface, you will find the device attributes and nice buttons that you can use to monitor and control your device.
You can use also use "create" (is="create") and delete (is="delete") operations if needed.
Since OM2M implements the CoAP communication binding, CoAP-enabled devices can be integrated using the same approach explained for HTTP.
Case 2) Other legacy devices
To integrate IP-enabled devices speaking other protocols like MQTT or non IP-enabled devices like Zigbee, you need to create a specific Interworking Proxy Unit (IPU) plugin to make the required mapping.
You can check the following developer guide https://wiki.eclipse.org/OM2M/Developer to learn how to add a new plugin to OM2M and implement you own IPU.
Hope this can help,
Le 09/02/2015 22:41, Massimo Vecchio a écrit :
Back to the top