mqtt - rest bridge using the smart object api

12
MQTT REST Bridge using the Smart Object API Open Source Internet of Things

Upload: michael-koster

Post on 22-May-2015

3.245 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: MQTT - REST Bridge using the Smart Object API

MQTT  -­‐  REST  Bridge  using  the  Smart  Object  API  

Open  Source  Internet  of  Things  

Page 2: MQTT - REST Bridge using the Smart Object API

SmartObject  API  Web  Object  EncapsulaBon    

Smart  Object  

Web  protocol  interfaces,  also  M2M  e.g.  MQTT  

Event  Model  Links  data  with  acBons  Pub-­‐Sub  and  event  handlers  

Encapsulates  local  soJware    components  and  handlers  

Self-­‐describing  data  model  For  Resource  Discovery    

and  Linkage  

Sensor  or  other  data    JSON,  XML,  data  feeds  

Page 3: MQTT - REST Bridge using the Smart Object API

SmartObject  API  –  Observers  •  Contains  graphs  which  define  endpoints  of  event  driven  processing  and  communicaBon  

•  The  Observer  paTern  is  the  basis  for  M2M  communicaBon  abstracBons  

•  Publisher,  Subscriber,  Event  Handler  classes  •  Reference  ImplementaBon  – create  (POST)  makes  a  new  Observer    

•  Publisher,  Subscriber,  or  Handler  Class  – set  (PUT)  updates  an  Observer’s  seZngs  – get  (GET)  returns  an  Observer’s  seZngs  – delete  (DELETE)  removes  an  Observer  

Page 4: MQTT - REST Bridge using the Smart Object API

MQTT  Observer  •  Implements  the  MQTT  M2M  AbstracBon  Layer  •  Publish,  Subscribe,  or  Pub+Sub  using  the  mqTObserver  resource  class  

•  Prototype  opens  a  connecBon  to  a  specified  broker  for  each  REST  endpoint  

 Observers.create({'resourceName': 'mqttTestObserver',\!

! ! ! ! ! 'resourceClass': 'mqttObserver',\! 'connection': 'smartobjectservice.com',\! 'pubTopic': ’sealevel_pressure',\! 'subTopic': None,\! 'QoS': 0,\! 'keepAlive': 60 })!

Page 5: MQTT - REST Bridge using the Smart Object API

MQTT  Observer  

MQTT  Broker  

REST  Endpoint  ObservableProperty  

mqTObserver  

PUT   GET  

Publish  from  data  producer  

Publish  From  REST  API  

Publish  to  Other  Subscribers  

SUB  Publish  to  REST  API    

Connects  REST  Resource  to  MQTT  Topic  Publish  and  Subscribe  

Page 6: MQTT - REST Bridge using the Smart Object API

MQTT  Observer  

MQTT  Broker  

REST  Endpoint  ObservableProperty  

mqTObserver  

PUT   GET  

Publish  from  data  producer  

Publish  From  REST  API  

Publish  to  Other  Subscribers  

SUB  Publish  to  REST  API    

Publisher    Publishes  REST  Resource  updates  to  the  broker  

Page 7: MQTT - REST Bridge using the Smart Object API

MQTT  Observer  

MQTT  Broker  

REST  Endpoint  ObservableProperty  

mqTObserver  

PUT   GET  

Publish  from  data  producer  

Publish  From  REST  API  

Publish  to  Other  Subscribers  

SUB  Publish  to  REST  API    

Subscriber    Makes  last  published  data  available  at  the  REST  endpoint  

Page 8: MQTT - REST Bridge using the Smart Object API

MQTT  Observer  

MQTT  Broker  

REST  Endpoint  ObservableProperty  

mqTObserver  

PUT   GET  

Publish  from  data  producer  

Publish  From  REST  API  

Publish  to  Other  Subscribers  

SUB  Publish  to  REST  API    

Pub+Sub  Repeats  data  updates  in  both  direcBons  

Page 9: MQTT - REST Bridge using the Smart Object API

MQTT  Bridge  to  mulBple  REST  endpoints  

MQTT  Broker  

REST  Endpoint  ObservableProperty  

mqTObserver  

PUT   GET  

Publish  from  data  producer  

Publish  to  Other  Subscribers  

REST  Endpoint  ObservableProperty  

mqTObserver  

PUT   GET  

Page 10: MQTT - REST Bridge using the Smart Object API

IoT  Toolkit  

•  IoT  Toolkit  is  a  reference  implementaBon  of  the  Smart  Object  API  and  related  tools  

•  REST  API  with  real-­‐Bme  event  model  for  the  Internet  of  Things  

•  Lightweight  server  that  can  run  on  small  computers  e.g.  Raspberry  Pi  

•  Work  in  progress  prototype  (limited  excepBon  handling  and  simple  interfaces)  

Page 11: MQTT - REST Bridge using the Smart Object API

IoT  2.0  –  Interoperability  

M2M  CoAP   M2M  

MQ   SOA  

M2M  HTTP  

Smart  Object  API  IoT  Toolkit  

Discovery  

ApplicaBons  

Thing  Models  

Resource  Models  

•  Object  Model  •  REST  +  Event  Model  •  M2M  Abstrac<ons  

IoT  Toolkit  

Connected  Things,  Sensors,  Actuators,  Data  Sources  

Seman?c  Repository  

•  Easy  to  deploy  new  things  and  applicaBons  using  data  models  

•  Write  once  run  anywhere,  any  app  to  any  thing  via  any  M2M  

•  Network  effect  enabled  

•  Allows  for  appropriate  M2M  choice  

Page 12: MQTT - REST Bridge using the Smart Object API

Interoperability  Architecture  

SO  

SO  

SO  

Gateway   Server  Cloud  Endpoints  

•  Sensors  •  Devices  

ApplicaBon    Components    

And    Resources  

Databases  

Instances  

Classes  SRT  

• Discovery  • Persistence  • ReplicaBon  • Resource  Access  

• Data  Models    • Sensor  Models  • Machine  Models  • Templates