28312993fdb49e9483880752d8614892.ppt
- Количество слайдов: 8
Iotkit-comm dzung. d. tran@intel. com
Description of the functionality iotkit-comm is a device-to-device and device-to-cloud library that allows Intel Edison devices to conveniently discover and communicate with each other using existing protocols like m. DNS, MQTT, Zero. MQ and Intel® Io. T Analytics Cloud • Designed for Edison but works just as well on other platforms • Come in C and Java. Script • Work over Wi. Fi and BT PAN (future BLE) Additional protocols can be added by extension to iotkit-comm 2
Why we want this functionality? • Provide a simple easy library for D 2 D and D 2 C for Edison that uses existing open source components • Help lower the barriers to entry for makers and pro-makers working in the Internet of Things (Io. T) • Provide as open source software to allow for support and contributions from open source community 3
SW Components Portal: - User accounts - Device registration - Sensor registration - Data visualization Io. T analytics MQTT Publish REST Network Adv Service Desc Network subscribe MDNS Edison Service Desc publish MQTT ZMQ Adv MDNS publish Edison subscribe publish / subscribe MQTT ZMQ request / response 4
Secured Channels • iotkit-comm securely connect to cloud using certificate and assigned token • iotkit-comm securely connect to each other using native protocol if provided otherwise it will create a SSH tunnel • For MQTT, it uses native MQTT support which is user name/password or certificate • For ZMQ, it creates a SSH tunnel 5
Example: D 2 D Client • Client query description file (temperature-query. json): { "name": ”/temperature/cpu. Temp", "properties": {"data. Type": "float", "unit": "F ”, “sensor. Type” : “ambient”} } • Client (client. js): /** * A basic client that prints out the message sent back by the server. * @see example/basic-client-server/server. js */ var iotkit = require('iotkit-comm'); var path = require('path'); var query = new iotkit. Service. Query(path. join(__dirname, ”temperature-query. json")); iotkit. create. Client(query, function (client) { client. comm. set. Received. Message. Handler(function (message) { console. log('Received message', message); var msgobj = JSON. parse(message); if (msgobj. value > 85. 0) { client. comm. done(); } }); 6
Example: D 2 D Server • Server description file (temperature-spec. json): { "name": ”/temperature/cpu. Temp", "properties": {"data. Type": "float", “sensor. Type” : “ambient”}, "advertise": {"locally": true, "cloud": false} } • Server (server. js): /** * @file Basic server that replies with the message 'hi' to any message sent * by the corresponding client. @see example/basic-client-server/ client. js */ var iotkit = require('iotkit-comm'); var path = require('path'); var i = 20. 5; var msg = {”value”: i}; var spec = new iotkit. Service. Spec(path. join(__dirname, "server-spec. json")); Iotkit. create. Service(spec, function(service) { set. Interval(function() { i++; msg = {“value” : i}; service. comm. send(JSON. stringify(msg)); }, 5000); )}; 7
Where to find iotkit-comm? API Spec: http: //iotkit-comm-js. s 3 -website-us-west 2. amazonaws. com/api/index. html Wiki: https: //github. com/intel-iot-devkit/iotkit-commjs/wiki/Iotkit-comm Code: https: //github. com/intel-iot-devkit/iotkit-comm-js Intel® Io. T Analytics: https: //dashboard. us. enableiot. com/ui/auth#/login