Rest Cloud Communication
Essay by goakes • April 29, 2016 • Presentation or Speech • 746 Words (3 Pages) • 871 Views
Page 1 of 3
REST Cloud Communication
Demand Assigned Multiple Channel
Low Power Consuming Application
via HTTP (Quasi-Restful) API
REST Cloud Communication
Transmitting Data to the Cloud
Open Endpoint’s Dedicated Cloud Service Feed
For Each Channel
Tally Quantity of New Data Points
Create Quantity-Sized Data Stream
Buffer Data Points into Data Stream
Flush Data Stream out to the Network
Close Endpoint’s Dedicated Cloud Service Feed
Stdby Return to LPS Mode and Wait for Next Event
REST Cloud Communication
Opening Endpoint’s Cloud Service Feed
Identity Endpoint Feed ID and API Key are the Feed’s Identity Attributes
Lookup DNS Hostname (returns IPv4/IPv6 address)
TLS Init Transport Layer Security (Cert, Private Key, and Encryption)
Socket Create TCP Socket and Bind to a Port
TLS Enbl Place Socket within Feed’s TLS Context
Connect Socket to IPv4/IPv6 address for HTTP Protocol
[DNS Hostname : api.tastradesoft.com]
Involves Configuring Thermostat, No Cloud Communication
REST Cloud Communication
Creating Quantity-Sized TCP Data Stream
TCP Init For TCP Stream: Init Tx/Rx Packet Buffers, Provide TCP Socket
Config Configure Stream : Channel Name, DP Quant, DP Size
Load Data Stream with:
Header1 Protocol Method and API Endpoint
Header2 Host ID
Header3 API Key
Header4 Content Identifier Label
Header5 Length of Data Content to be Transferred
Header6 2 sets of newline characters
Involves Preparing Data Stream for Cloud Communication
REST Cloud Communication
Sample Header
PUT /v2/feeds/rest123456.csv HTTP/1.1\r\n
Host: api.tastradesoft.com\r\n
X-ApiKey: HCEDA-XZYWK-CC2CA-LVRPT-DONQV-
SBGJT-BXYYQ-MRPQT-UNBSZ-KLOPS\r\n
Content-Length: 64\r\n
\r\n
REST Cloud Communication
Buffering Data Points into Data Stream
For Every DP Ready to be Loaded to the Data Stream, Load:
Channel Name Configured at Data Stream Creation
CSV Separator ”,”
Timestamp ISO8601 Time when Data Point Collected
CSV Separator ”,”
Data Point Data Point Value
Newline 1 set of newline character
Involves Preparing Thermostat for Cloud Communication
REST Cloud Communication
Sample Buffer Data
SetPoint-Weekday-Sleep,20150911T025959Z,74\r\n
REST Cloud Communication
Sample Header + 4 Data Points
PUT /v2/feeds/rest123456.csv HTTP/1.1\r\n
Host: api.tastradesoft.com\r\n
X-ApiKey: HCEDA-XZYWK-CC2CA-LVRPT-DONQV-
SBGJT-BXYYQ-MRPQT-UNBSZ-KLOPS\r\n
Content-Length: 04\r\n
\r\n
SetPoint-Weekday-Eve,20150911T235959Z,74\r\n
SetPoint-Weekday-Sleep,20150912T000000Z,78\r\n
SetPoint-Weekday-Sleep,20150912T075959Z,78\r\n
SetPoint-Weekday-Wake,20150912T080000Z,72\r\n
REST Cloud Communication
Flushing Data Stream Out to the Network
Link Check Is IP Network Interface “Up” ?
Encrypt Packet Encrypt Entire Loaded Data Stream as TCP Packet
Send Network TCP Send Packet
Involves Transmitting Data Stream Packet to Cloud
Rcv Resp Packet Receive TCP/TLS Response Packet
Parse Response Parse TCP/TLS Response Packet using HTTP Method
Delete Packet Remove Packet from Network Buffers
Verify “OK” HTTP “OK” Expected as Acknowledge Response
DNS Query On next Transmission if not acknowledged “OK”
Involves Receiving Cloud Acknowledgement Communication
REST Cloud Communication
Mapping Thermostat Data to Channels
Note that SetPoint-Weekday-Sleep is a Channel ID
Thus, each Data Type/Item is transferred via a dedicated channel
Data Point snapshot sequences are saved onboard until next Xmt event
Thus Transmit Events can occur less often than are snapshots taken
Snapshots taken only when the Data Item changes in value
Further optimizes power consumed in transmissions
Thermostat Command Reception constitutes a Data Item value change
Enacting Remote Command Results in taking a Data Point Snapshot
Originating, relayed Mobile App message not saved in Cloud
Cloud is maintaining a record of Thermostat State, not App State
REST Cloud Communication
Channel Identifiers – Thermostat XMT
Reference Doc Channel Identifiers–Thermostat Transmission.xls
Channel Identifiers – Thermostat RCV
Reference Doc Channel Identifiers–Thermostat Reception.xls
...
...
Only available on Essays24.com