Lesson 17 Prototyping Online Components for an Smart Umbrella Web API

Chapter-9 L17: " of Things " , Raj Kamal, 2017 1 Publs.: McGraw-Hill Education Smart Umbrella As A Device Platform

• Example 1.1 • The umbrella, behaves smart and alive through computing. An embedded small device interacts with weather web-service and mobile of the owner through Internet

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 2 Publs.: McGraw-Hill Education A Smart Umbrella

Flashing LED

Circuit Weather Website

Internet Weather web- for an umbrella

• Fourteen sequences of message exchanges • Extreme weather-message web-API • Mobile phone web-API, and weather-service API, and their interactions

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 4 Publs.: McGraw-Hill Education Smart and IP Network, MSN Alive Umbrella UDP Weather 9:Published 1:Each 5:callback () Send Application Transport Server City day event Client Messages and DTLS Weather message Weather data for the10: Send Umbrella ID, date Weather WiFi Clients and time, and web API Interface Service Service location stamps API messages for 8:Subscribe city weather 4:callback () 6:callback () 7: Session between 2: Request for Weather web API on new To Weather weather APIs Place and City- Location data of City Location Service web3: Response for Service API for name Event API Place and City-name API Location and Get input 13: Send data for warning messaging 14: Receive warning Session service in case of extreme weather Mobile API message Text from 11: Umbrella Umbrella NFC for Text Smart and Alive Extreme Mobile Interface Messaging Umbrella Weather API Event 12: Warning messages by LED flashes

Fig. 9.5 Umbrella weather web API, location API, Extreme weather warning message Umbrella mobile API, mobile phone Text messaging API, and weather service API, and their interactions, and fourteen sequences of message exchanges Example 9.14 • Explians the concept of APIs and web-APIs for Internet of smart and alive umbrella • ‘Weather’ API at an Umbrella accessing a weather service and communicate an expected extreme weather event, such as rain or hot sunny day to a mobile-phone API by a text message

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 6 Publs.: McGraw-Hill Education Weather at the Umbrella • Using number of APIs and callback functions • Location API gets the name of the city from location server. (Sequences 2 and 3). • The weather web-API callback functions interact with a weather API for the weather service messages. • The API subscribes to MSN or other Weather Server. The server publishes weather messages for the subscribing clients (Sequence 5 to 8).

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 7 Publs.: McGraw-Hill Education Weather web Application at the Umbrella • Weather service API sends service messages as a response which communicates over Internet to the weather-client of the web API • The weather service also communicates in response the present and next two days predications, and expected maximum and minimum temperatures (Sequences 9 and 10). • Umbrella mobile web API

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 8 Publs.: McGraw-Hill Education Implementation Table of an API

• Implementation makes coding easy • Column 1 of each row has the actions in sequences which occur one by one. • Column 2 may specify for each action, the authentication code or method (device platform ID, such as MAC address) • Password can be some code internally generated at device platform using some algorithm using a secret key as input • (Example 9.8)

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 9 Publs.: McGraw-Hill Education Implementable for an API.

• Column 3 specifies the API inputs for initiating the action on event. • Column 4 specifies the API outputs for the inputs. The outputs communicate to other end and initiate the

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 10 Publs.: McGraw-Hill Education Summary

We learnt • Example of smart and alive umbrella showing the uses of APIs and web APIs. • Sequences of 14 sessions using mashed up web APIs in the usages

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 11 Publs.: McGraw-Hill Education Summary We learnt • APIs implements using standard message or object formats, protocols and models • Specify in a row for each action of the sessions and interactions, specifying the authentication methods, inputs and outputs • APIs implementation for the Smart Umbrella example using the weather web-service, location API and mobile

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 12 Publs.: McGraw-Hill Education End of Lesson 17 on Prototyping Online Components for an Smart Umbrella Web API

Chapter-9 L17: "Internet of Things " , Raj Kamal, 2017 13 Publs.: McGraw-Hill Education