You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: serial_protocol.md
+49-18Lines changed: 49 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,8 @@ Only needs to be called when the chiplet is in a new environment and needs to co
20
20
NETWORK $SSID
21
21
NETWORK $SSID $PASSWORD
22
22
###Response
23
-
CONNECTED - When connected to new network
24
-
UNABLE_TO_CONNECT - When unable to connect
23
+
+CONNECTED - When connected to new network
24
+
-UNABLE_TO_CONNECT - When unable to connect
25
25
###Examples
26
26
>> NETWORK home-guest
27
27
<< +CONNECTED
@@ -36,14 +36,14 @@ Must be called after creating a Serial connection, it can take either just a hos
36
36
BEGIN $Host
37
37
BEGIN $Host $Secret
38
38
###Response
39
-
OK - Accepted initialization parameters
39
+
+OK - Accepted initialization parameters
40
40
###Examples
41
41
>> BEGIN https://samplechat.firebaseio-demo.com
42
42
<< +OK
43
43
>> BEGIN https://samplechat.firebaseio-demo.com nnz...sdf
44
44
<< +OK
45
45
##GET
46
-
Fetches the value at $Path and returns it on the serial line. If $PATH points to a leaf node you will get the raw value back, if it points to an internal node you will get a JSON string with all children.
46
+
Fetches the value at $PATH and returns it on the serial line. If $PATH points to a leaf node you will get the raw value back, if it points to an internal node you will get a JSON string with all children.
47
47
###Usage
48
48
GET $PATH
49
49
###Response
@@ -78,24 +78,41 @@ Store the data provided at the path provided. This method should be used for sim
78
78
+OK
79
79
-FAIL
80
80
###Examples
81
-
>>SET /user/aturning/first Alan
81
+
>>SET /user/aturing/first Alan
82
82
<<+OK
83
83
##SET$
84
-
Similar to SET above but used to write multiline strings or raw binary data. Data format is similar to the batch string ($) return type, we specify the $DATA_BYTE_COUNT on the same line as SET$ then a newline and all data.
84
+
Similar to SET above but used to write multiline strings or raw binary data. Data format is similar to the batch string ($) return type, we specify the $DATA_BYTE_COUNT on the same line as SET$ then a newline and all data. However which the batch string ($) return type returns data json escaped and quoted you may provide raw data and we will handle the escaping.
85
85
86
86
Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of data before becoming responsive again.
87
87
###Usage
88
-
SET$ $PATH $DATA_BYTE_COUNT
88
+
SET$ $PATH
89
+
$DATA_BYTE_COUNT
89
90
$DATA
90
91
###Response
91
92
+OK
92
93
-FAIL
93
94
-FAIL_TIMEOUT
94
95
###Examples
95
-
>>SET /user/aturning/address 24
96
+
>>SET /user/aturing/address
97
+
>>24
96
98
>>78 High Street,
97
99
>>Hampton
98
100
<<+OK
101
+
102
+
##SET{+,*,#,.,?}
103
+
Same as SET but will force the value to be stored in the given type or return an error if we cannot parse it as that type.
104
+
###Usage
105
+
SET+ $PATH $VALUE
106
+
SET: $PATH $VALUE
107
+
SET? $PATH $VALUE
108
+
###Response
109
+
+OK
110
+
-INCORRECT_TYPE
111
+
###Examples
112
+
>>SET? /user/aturing/was_human true
113
+
<<+OK
114
+
>>SET? /user/aturing/was_human He was not a computer.
115
+
<<-INCORRECT_TYPE
99
116
100
117
##REMOVE
101
118
Deletes the value located at the path provided.
@@ -105,7 +122,7 @@ Deletes the value located at the path provided.
105
122
+OK
106
123
-FAIL
107
124
###Examples
108
-
>>REMOVE /user/aturning
125
+
>>REMOVE /user/aturing
109
126
<<+OK
110
127
111
128
##PUSH
@@ -115,43 +132,57 @@ Adds a value to the list located at the path provided and returns the key at whi
115
132
###Response
116
133
$KEY
117
134
###Examples
118
-
>>PUSH /user/aturning/login_timestamps 1455052043
135
+
>>PUSH /user/aturing/login_timestamps 1455052043
119
136
<<+-K94eLnB0rAAvfkh_WC2
120
137
121
138
##PUSH$
122
139
Similar to PUSH but used to write multiline strings or raw binary data. Data format is similar to the batch string ($) return type, we specify the $DATA_BYTE_COUNT on the same line as SET$ then a newline and all data. However you are not required to json escape all of your data, that will be handled for you.
123
140
124
141
Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of data before becoming responsive again.
125
142
###Usage
126
-
PUSH_BULK $PATH $DATA_BYTE_COUNT
143
+
PUSH$ $PATH $DATA_BYTE_COUNT
127
144
$DATA
128
145
###Response
129
146
$KEY
130
147
###Examples
131
-
>>PUSH /user/aturning/quotes 91
148
+
>>PUSH$ /user/aturing/quotes 91
132
149
>>We can only see a short distance ahead,
133
150
>>but we can see plenty there that needs to be done.
134
151
<<+-K94eLnB0rAAvfkh_WC3
135
152
136
-
##STREAM
153
+
##BEGIN_STREAM
137
154
Used to register to receive a stream of events that occur to the object at the provided path.
138
155
139
156
After registering you will start receiving events on the response line. They will be formatted as one line with the event type {PUT,PATCH,etc..} followed by the sub_path that changed and the other line with the data associated with that event type. This data will be formatted similar to GET results and can have multi-line batch strings (*) or json strings (&).
140
157
141
-
The event stream will continue until you send CANCEL_STREAM.
158
+
The event stream will continue until you send END_STREAM.
159
+
160
+
When there is an ongoing event stream no other commands can be processed until you call END_STREAM as the event stream owns the return line.
142
161
###Usage
143
-
STREAM $PATH
144
-
CANCEL_STREAM
162
+
BEGIN_STREAM $PATH
145
163
###Response
146
164
$EVENT_NAME $SUB_PATH
147
165
$DATA
148
166
+OK
149
167
###Examples
150
-
>>STREAM /user/aturning
168
+
>>BEGIN_STREAM /user/aturing
151
169
<<+PUT /last_login
152
170
<<:1455052043
153
171
<<+PUT /address
154
172
<<$24
155
173
<<"78 High Street,\r\nHampton"
156
-
>>CANCEL_STREAM
174
+
175
+
##END_STREAM
176
+
Used to stop listening to events at a given path. This must be the same path provided to a previous BEGIN_STREAM call.
0 commit comments