Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Maker of Things - the open IoT cloud for makers chapter.

2,184 views

Published on

Introducing the open IoT cloud for makers. This is the first chapter of the series of 'Maker of Things'.

Published in: Internet
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hey guys! Who wants to chat with me? More photos with me here 👉 http://www.bit.ly/katekoxx
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi Jollen, very interesting approach. Do you have a version 100% in English?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Maker of Things - the open IoT cloud for makers chapter.

  1. 1. 2015.9.7 Taipei Maker of Things Open IoT Cloud for Makers Innovation of Things Mokoversity 姓名標示-非商 業性 4.0 國際
  2. 2. Lecturer Jollen, Founder of WoT.City ! Jollen is a passionate software developer with a breadth of technical experience with software engineering, web technologies, embedded systems, operating systems and distributed systems. ! Jollen specializes in open source software business model and its strategy planning. He is also the founder of Mokoversity and WoT.City. ! Please Email Jollen through jollen@jollen.org
  3. 3. 1 ARM mbed The next big OS to rock the world will be little.
  4. 4. 2 Web Trends 2015 Virtual DOM
  5. 5. 3 Physical Web The future of the IoT is URLs.
  6. 6. 4 W3C WoT
  7. 7. 5 CoAP
  8. 8. WoT Servers: Use Cases
  9. 9. Constrained! Device High Performance MCU WiFi MCU SBC Server ! Farms Platform Portfolio Legacy MCUs ARM mbed OS、 Neuclio ESP8266、 NodeMCU、 EMW3165 Intel Edison、 Qualcomm Dragonboard 410c IoT Diagram (Use Scenario) WoT Architecture IoT Protocols TD
  10. 10. #1: IoT & WoT Introduction
  11. 11. Web of Things 《ARM mbed Practice: RTOS, IoT Client & IoT Cloud》 Copyright (C) 2015 Moko365 Inc. 僅供 QUALCOMM 內部使⽤用.
  12. 12. the Web of Things reuses existing and well-known Web standards[1][2] used in the programmable Web (e.g., REST, HTTP, JSON), semantic Web (e.g., JSON-LD, Microdata, etc.), the real-time Web (e.g., Websockets) and the social Web (e.g., oauth or social networks). ! —Wikipedia Web of Things 《ARM mbed Practice: RTOS, IoT Client & IoT Cloud》 Copyright (C) 2015 Moko365 Inc. 僅供 QUALCOMM 內部使⽤用.
  13. 13. Web IoT 使⽤用情境
  14. 14. HTTP Websocket CoAP http:// ws:// coap://
  15. 15. IP UDP SMTPDNS HTTP TCP CoAP FTP Ethernet Layering of Protocols
  16. 16. IoT WoT 連結⽅方式 Bluetooth HTTP 數據管理 Centerlized Decenterlized Things Objects RESTful Objects 應⽤用開發模式 Native Web (SPA) 硬件概念 Sensor Device Physical Web (Sensor Fusion) Figure: Thinking in WoT. Copyright (C) 2014 Mokoversity Inc. IoT vs WoT: Methdology
  17. 17. IoT WoT Connectivity Machine to Machine LWM2M Machine to Web Networking TCP / UDP HTTP / REST / CoAP Things Sensor Device RESTful Objects Data Streaming Data Time-Series Data Discover MQTT Publish / Subscribe IoT vs WoT: Connectivity
  18. 18. WoT Application
  19. 19. Internet of Things Web of Things An Application Layer that simplifies the creation of Internet of Things applications * of Things
  20. 20. Thinking in WoT IoT WoT 连接⽅方式 Bluetooth HTTP 数据管理哲学 Centerlized Decenterlized Things Objects RESTful Objects IoT App Native Web (SPA) 硬件设计哲学 Sensor Device Physical Web (Sensor Fusion)
  21. 21. IoT & mbed Client - RTOS
  22. 22. ARM mbed mbed OS We are creating a modern full-stack operating system that is designed specifically for ARM Cortex®-M-based MCUs; the worlds leading 32- bit microcontrollers that already sell in the billions. ! mbed Device Server Analogous to a Web Server that accepts connections from mobile phones or web browsers, a Device Server handles the connections from IoT devices. ! mbed Tools online compiler (Web IDE), SDK, HDK and etc.
  23. 23. mbed OS mbed Device Server mbed Tools 《ARM mbed Practice: RTOS, IoT Client & IoT Cloud》 Copyright (C) 2015 Moko365 Inc. 僅供 QUALCOMM 內部使⽤用.
  24. 24. Source: http://mbed.org/technology/os/ mbed OS mbed™ OS is an operating system for IoT devices and is especially well-suited to run in energy constrained environments.
  25. 25. mbed RTOS Thread Mutex Semaphore Message Queue Mail Memory Poll
  26. 26. mbed Libraries Analog I/O Digital I/O Timers Digital Interface Real-time Operating System File System USB (Device and Host) Networking
  27. 27. Connectivity Protocol Stack Bluetooth Low Energy Cellular Ethernet Thread Wi-Fi Zigbee IP Zigbee NAN 6LoWPAN
  28. 28. mbed Memory Sections RW Data Program RAM Flash RW Data Program ZI = 0 RW Data Stack Heap
  29. 29. mbed Threads RAM Flash RW Data ZI: Timer Stack ZI: Idle Stack ZI Scheduler Stack Main Thread Stack Head When you use the RTOS, before explicitly initializing any additional thread, you will have 4 separate stacks: ! • The stack of the Main Thread (executing the main function). ! • The Idle Thread executed each time all the other threads are waiting for external, or scheduled events. This is particularly useful to implement energy saving strategies. (ie sleep). ! • The Timer Thread that executes all the time scheduled tasks (periodic and non periodic). ! • The stack of OS Scheduler itself (also used by the ISRs).
  30. 30. mbed Timer #include "mbed.h" Timer t; int main() { t.start(); printf("Hello World!n"); t.stop(); printf("The time taken was %f secondsn", t.read()); } See: https://developer.mbed.org/handbook/Timer
  31. 31. mbed Thread API #include "mbed.h" #include "rtos.h" DigitalOut led1(LED1); DigitalOut led2(LED2); void led2_thread(void const *args) { while (true) { led2 = !led2; Thread::wait(1000); } } int main() { Thread thread(led2_thread); while (true) { led1 = !led1; Thread::wait(500); } } See: https://developer.mbed.org/handbook/RTOS#thread
  32. 32. mbed Thread Priority See: https://developer.mbed.org/handbook/RTOS#thread int main() { Thread thread(led2_thread); thread.set_priority(osPriorityNormal); ! while (true) { led1 = !led1; Thread::wait(500); } }
  33. 33. mbed Thread States See: https://developer.mbed.org/handbook/RTOS#thread
  34. 34. mbed Mutex See: https://developer.mbed.org/handbook/RTOS #include "mbed.h" #include "rtos.h" Mutex stdio_mutex; void notify(const char* name, int state) { stdio_mutex.lock(); printf("%s: %dnr", name, state); stdio_mutex.unlock(); } void test_thread(void const *args) { while (true) { notify((const char*)args, 0); Thread::wait(1000); notify((const char*)args, 1); Thread::wait(1000); } } int main() { Thread t2(test_thread, (void *)"Th 2"); Thread t3(test_thread, (void *)"Th 3"); test_thread((void *)"Th 1"); }
  35. 35. #include "mbed.h" #include "rtos.h" Semaphore two_slots(2); void test_thread(void const *name) { while (true) { two_slots.wait(); printf("%snr", (const char*)name); Thread::wait(1000); two_slots.release(); } } int main (void) { Thread t2(test_thread, (void *)"Th 2"); Thread t3(test_thread, (void *)"Th 3"); test_thread((void *)"Th 1"); } mbed Semaphore See: https://developer.mbed.org/handbook/RTOS
  36. 36. IoT & mbed Client - IoT
  37. 37. Layering of Protocols IP UDP SMTPDNS HTTP TCP CoAP FTP Ethernet
  38. 38. CoAP CoAP 並不是要取代 HTTP,它是針對 Constrained Device 的 HTTP 需求。CoAP (Constrained Application Protocol)是更 簡單且輕量化的 HTTP 技術,簡單的意思是, CoAP 簡化了 HTTP 的內容,輕量化的意思 是,CoAP 採⽤用 UDP 進⾏行傳輸。
  39. 39. CoAP over UDP UDP IP CoAP WoT Server IoT over the Web Ethernet MAC Ethernet PHY Application Transport Network Data Link Physical TLS (optional) Presentation / Session
  40. 40. HTTP over UDP 簡單來說,CoAP 可以看做是⼀一個 HTTP over UDP 的技術。CoAP 是物聯網的重要技術,它 讓 Constrained Device 都能具備 HTTP 的 能⼒力。⼤大部份的 MCU 裝置都是 Constrained Device,因此,就也像是 MCU + HTTP。
  41. 41. HTTP over TCP TCP IP HTTP 1.1/2.0 WoT Server the Web Ethernet MAC Ethernet PHY Application Transport Network Data Link Physical TLS (optional) Presentation / Session
  42. 42. SPDY 因為 HTTP request/response headers 設 計上的⼀一些缺點,讓 HTTP 的網路傳輸效能無 法提昇。為解決這些問題,Google 便提出了 SPDY 協定。SPDY 協定後來成為 HTTP/2 (HTTP 2.0)的基礎。IETF 在 2015 年 5 ⽉月 正式發佈 HTTP/2 標準(RFC 7540)。 HTTP/2 是基於 TCP 協定,因此要讓物聯網裝 置使⽤用 HTTP over UDP 的話,⺫⽬目前仍必須使 ⽤用 HTTP + QUIC + UDP 的堆疊。
  43. 43. HTTP/1.1 over SPDY+TCP TCP IP HTTP WoT Server the Web Ethernet MAC Ethernet PHY Application Transport Network Data Link Physical SPDY + TLS Presentation / Session
  44. 44. QUIC HTTP over TCP 的 ACK 會造成的⼀一些負擔, 因此如果讓 HTTP over UDP 的話,就可以解 決這個問題。Google 所提出的 QUIC(Quick UDP Internet Connection)就是這樣的技 術。QUIC 可以讓 HTTP 基於 UDP 傳輸層,就 是 HTTP + QUIC + UDP。
  45. 45. HTTP over QUIC+UDP HTTP/2 未來也可能在物聯網應⽤用上,扮演重 要⾓角⾊色。因為 HTTP request/response headers 設計上的⼀一些缺點,讓 HTTP 的網路 傳輸效能無法提昇。為解決這些問題,Google 便提出了 SPDY 協定。SPDY 協定後來成為 HTTP/2(HTTP 2.0)的基礎。IETF 在 2015 年 5 ⽉月正式發佈 HTTP/2 標準(RFC 7540)。HTTP/2 是基於 TCP 協定,因此要 讓物聯網裝置使⽤用 HTTP over UDP 的話,⺫⽬目 前仍必須使⽤用 HTTP + QUIC + UDP 的堆 疊。
  46. 46. UDP + QUIC IP HTTP WoT Server IoT over the Web Ethernet MAC Ethernet PHY Application Transport Network Data Link Physical SPDY + QUIC Presentation / Session HTTP over QUIC+UDP UDP + QUIC IP HTTP WoT Server IoT over the Web Ethernet MAC Ethernet PHY QUIC
  47. 47. HTTP/2 over QUIC 因為 HTTP/2 標準就是 SPDY 的內容,如果有 意在物聯網裝置上使⽤用 HTTP/2 的特性,就要 採⽤用 HTTP + SPDY + QUIC + UDP 的堆疊。 不過,Google 未來有意將 HTTP/2 over QUIC 提交給 IETF,到時就能捨棄 HTTP + SPDY + QUIC + UDP 的做法,畢竟這只是過 渡時期的解決⽅方案。
  48. 48. IP HTTP/2 WoT Server IoT over the Web Ethernet MAC Ethernet PHY Application Transport Network Data Link Physical QUIC + UDP Presentation / Session HTTP/2 over QUIC
  49. 49. CoAP-HTTP Translate CoAP 並⾮非直接採⽤用 HTTP 標準,⽽而是透過轉 換(translate)的⽅方式將訊息對應成標準的 HTTP。CoAP 採納了 REST 架構,並且也是採 取 request/response 的模式。因此,要將 CoAP 轉換為 HTTP,或是將 HTTP 轉換為 CoAP,其實是⾮非常容易的。實際上,CoAP 只 對 request/response 的部份做轉換,也就是 CoAP 的 request 都能轉換為 HTTP request headers;response 的部份亦同。
  50. 50. CoAP-HTTP UDP IP CoAP WoT Server Ethernet MAC Ethernet PHY Application Transport Network Data Link Physical TLS (optional) Presentation / Session TCP IP HTTP WoT Client the Web Ethernet MAC Ethernet PHY TLS (optional) IoT over the Web
  51. 51. Transferring HTTP Message IP TCP HTTP Ethernet Interface Web client IP TCP HTTP Ethernet Interface Web server HTTP message TCP segment
  52. 52. Transferring CoAP Message IP UDP HTTP Ethernet Interface Web client IP UDP HTTP Ethernet Interface Web server CoAP message UDP segment
  53. 53. TCP Connection B SYN A SYN-ACK ACK DATA ACK DATA FIN . . .
  54. 54. IoT/WoT Interoperability Websocket HTTP 1.1/2.0 CoAP IoT Cloud IoT Device IoT Device IoT Device IoT Device Mobile & Client IoT Proxy
  55. 55. Thread A secure wireless mesh network for smart home. IEEE 802.15.4 MAC IEEE 802.15.4 PHY 6LoWPAN (IPv6) IP Routing UDP + DTLS Application Thread RFC 4944, RFC 4862, RFC 6775 RFC 1058, RFC 2080 RFC 768, RFC 6347, RFC 4279 RFC 4492v RFC 3315, 5007
  56. 56. 6LoWPAN IPv6 over Low power Wireless Personal Area Networks. For constrained IoT devices. UDP 6LoWPAN CoAP EXI TCP IP HTTP HTML the Web IoT + the Web
  57. 57. TCP/IP Protocol Stack UDP 6LoWPAN (IPv6) CoAP WoT Application TCP IP HTTP HTML the Web IoT + the Web UDP Ethernet MAC Ethernet PHY IEEE 802.15.4 MAC IEEE 802.15.4 PHY Application Transport Network Data Link Physical
  58. 58. Source: http://coap.technology REST model for small devices ! Like HTTP, CoAP is based on the wildly successful REST model: Servers make resources available under a URL, and clients access these resources using methods such as GET, PUT, POST, and DELETE.
  59. 59. Source: http://coap.technology Made for billions of nodes ! The Internet of Things will need billions of nodes, many of which will need to be inexpensive. CoAP has been designed to work on microcontrollers with as low as 10 KiB of RAM and 100 KiB of code space (RFC 7228).
  60. 60. Source: http://coap.technology Existing skills transfer ! From a developer point of view, CoAP feels very much like HTTP. Obtaining a value from a sensor is not much different from obtaining a value from a Web API.
  61. 61. Source: http://coap.technology ARM IoT Tutorial https://www.youtube.com/watch?v=4bSr5x5gKvA Ready for integration ! Since HTTP and CoAP share the REST model, they can easily be connected using application-agnostic cross-protocol proxies. A Web client may not even notice that it just accessed a sensor resource!
  62. 62. ARM mbed Priactice: CoAP CoapPDU *pdu = new CoapPDU(); ! pdu->setType(CoapPDU::COAP_CONFIRMABLE); pdu->setCode(CoapPDU::COAP_GET); pdu->setToken((uint8_t*)"3210",4); pdu->setMessageID(0x0005); pdu->setURI((char*)"test",4); ! // send packet ret = send(sockfd,pdu->getPDUPointer(),pdu->getPDULength(),0);
  63. 63. cont… // receive packet ret = recvfrom(sockfd,&buffer,BUF_LEN,0, (sockaddr*)&recvAddr,&recvAddrLen); ! CoapPDU *recvPDU = new CoapPDU((uint8_t*)buffer,ret); ! if(recvPDU->validate()) { recvPDU->getURI(uriBuffer,URI_BUF_LEN,&recvURILen); ... }
  64. 64. IoT & mbed Cloud - Device Server
  65. 65. Analogous to a Web Server that accepts connections from mobile phones or web browsers, a Device Server handles the connections from Internet of Things (IoT) devices. A Device Server is a key enabler for cloud service providers, operators and enterprises to access the IoT growth market with production deployments, bringing end node devices in to the world of web services. 《ARM mbed Practice: RTOS, IoT Client & IoT Cloud》 Copyright (C) 2015 Moko365 Inc. 僅供 QUALCOMM 內部使⽤用.
  66. 66. Source: http://mbed.org/technology/device-server/ 《ARM mbed Practice: RTOS, IoT Client & IoT Cloud》 Copyright (C) 2015 Moko365 Inc. 僅供 QUALCOMM 內部使⽤用.
  67. 67. CoAP Server Architecture Websocket HTTP 1.1/2.0 CoAP www.mokoversity.com IoT Cloud IoT Device IoT Device IoT Proxy 1 2 IoT Device 2 3 Mobile & Client 3
  68. 68. RESTful UDP M2M Wireless Sensor Network HTTP in Uniform way Simple Cache CoAP Features IoT Device IoT Device IoT Proxy 1 2 IoT Device 2 3 Constrained Environment 3
  69. 69. Websocket HTTP 1.1/2.0 CoAP CoAP Portfolio IoT Cloud IoT Device IoT Device IoT Proxy (IoT Gateway) 1 2 IoT Device 2 3 Mobile & Client The Web of Things Protocol 3 Arch Pro Arch Pro Arch Pro Seeeduino Cloud
  70. 70. http://50.128.14.32/1/jollenchen/sensor/dust/a IoT Device Mobile HTTP 1.1/2.0HTTP 1.1/2.0 Light-weight Web server Web Frontend Internet Device Server: HTTP
  71. 71. IoT Device Mobile HTTP 1.1/2.0 Streaming Data Physical Object Web Frontend Real-Time Data Broker ws://wot.city/object/jollenchen/sensor/dust/a Device Server: WebSocket
  72. 72. Device Server Architecture Websocket HTTP 1.1/2.0 CoAP IoT Cloud IoT Device IoT Device IoT Device IoT Device Mobile & Client IoT Proxy
  73. 73. Architecture of 6LoWPAN IoT Device Mobile Physical Object Web Frontend Broker IoT Device Proxy (Gateway / Router) IPv6, CoAP 6LoWPAN, CoAP 6LoWPAN, CoAP IPv6, HTTP, HTML5
  74. 74. HTTP/CoAP/MQTT HTTP The Web protocol. ! CoAP The Web of Things Protocol. ! MQTT The TCP Protocol.
  75. 75. HTTP CoAP MQTT Type document oriented document oriented message oriented Purpose server farms constrained devices lightweight M2M communications Transport over TCP over UDP over TCP Model Client/Server Client/Server Client/Server Resolver URI REST Message Interoperate one-to-one many-to-many Architecture request/response request/response publish/subscribe HTTP/CoAP/MQTT
  76. 76. MQTT Clients and Broker Source: http://www.eclipse.org/community/eclipse_newsletter/2014/february/article2.php
  77. 77. ARM mbed Practice
  78. 78. mbed Tools Digital Interface Networking HTTPD & REST API Websocket Device Server 《ARM mbed Practice: RTOS, IoT Client & IoT Cloud》 Copyright (C) 2015 Moko365 Inc. 僅供 QUALCOMM 內部使⽤用.
  79. 79. Digital Interface #include "mbed.h" ! DigitalOut myled1(LED1); ! int main() { wait(0.8); while(1) { myled1 = 0; wait(0.2); myled1 = 1; } }
  80. 80. Networking #include "mbed.h" #include "EthernetInterface.h" ! int main(void) { // Ethernet Interface EthernetInterface eth; ! // use DHCP eth->init(); ! //eth->init(“192.168.21.81”, "255.255.255.0", "192.168.21.2" ); ! if (eth->connect()) return -1; ! printf("IP Address is %srn", eth->getIPAddress()); }
  81. 81. HTTPD httpd = new HTTPD; ! httpd->attach("/1/mbed/lpc1768/sensor/dust/sen12291p", &callback_api); ! httpd->attach("/", "/local/"); ! httpd->start(80);
  82. 82. REST APIs over mbed int main() { printf("HTTP Server...rn"); ! eth = new EthernetInterface; eth->init("192.168.21.81", "255.255.255.0", "192.168.21.2" ); ! if (eth->connect()) return -1; ! printf("IP Address is %srn", eth->getIPAddress()); httpd = new HTTPD; httpd->attach("/1/mbed/lpc1768/sensor/dust/sen12291p", &callback_api); httpd->attach("/", "/local/"); httpd->start(80); printf("httpd readyrn"); led2 = 1; }
  83. 83. mbed WebSocket Server IoT 扮演 Websocket server 的話,會有幾個技 術問題: • ARM mbed 要管理 client 端的 connections • 需要更多的記億體來維護 client connections • 需要實作 Data push 的演算法 • 要考量 error handling 與 exception handling
  84. 84. WebSocket Broker WebSocket Broker 的使⽤用案例: ! 1. 佈署專⽤用的 Websocket broker server 2. ARM mbed 將 data 即時推送(push) 到 Websocket broker server 3. ⽤用⼾戶(user)與 Websocket broker server 建⽴立 Websocket connection 4. ⽤用⼾戶接收 Websocket broker server 的 即時資料
  85. 85. WoT.City Copyright (C) 2015 WoT.City, Inc. All rights reserved. About us. ! Jollen, Founder jollen@wotcity.com
  86. 86. + ARM mbed Available Now ARM mbed with WoT
  87. 87. + Coming Soon Intel Edison with WoT
  88. 88. + Under Development Dragonboard 410c with WoT
  89. 89. + Launch Soon NodeMCU/ESP8266 with WoT
  90. 90. Constrained IoT Devices ws://wot.city Websocket Client 1 Client 2 ... 1 to 1 n to n Sender Client Broker / Load Balancer (Data Channel) Viewer Client WebSocket Broker Server Available Now
  91. 91. Constrained IoT Devices coap://wot.city Websocket & HTTP Client 1 Client 2 ... 1 to 1 n to n Sender Client Broker / Load Balancer (Data Channel) Viewer Client CoAP Broker Server Available Now CoAP
  92. 92. WoT Platform Website WoT Open Source Contact Angel List https://wotcity.com/zh-tw https://github.com/wotcity hello@wotcity.com https://angel.co/wot-city (C) 2015 wotcity.com

×