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
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ During the first use, or when the chiplet changes environments a “NETWORK” c
3
3
4
4
Every time a serial connection is established we will expect a “BEGIN” call after which any subsequent calls can be made, until the connection is closed.
5
5
6
-
In the following examples we use $ to represent variables. For example $Host represents your firebase host.
6
+
In the following examples we use %% to represent variables. For example %Host% represents your firebase host.
7
7
8
8
##Response Format Byte
9
9
All responses will be prefixed with one of the following bytes signifying the response type.
@@ -17,8 +17,8 @@ All responses will be prefixed with one of the following bytes signifying the re
17
17
##NETWORK
18
18
Only needs to be called when the chiplet is in a new environment and needs to connect to a new network. This setting will be stored by the chiplet and persisted through power cycles.
19
19
###Usage
20
-
NETWORK $SSID
21
-
NETWORK $SSID $PASSWORD
20
+
NETWORK %SSID%
21
+
NETWORK %SSID% %PASSWORD%
22
22
###Response
23
23
+CONNECTED - When connected to new network
24
24
-UNABLE_TO_CONNECT - When unable to connect
@@ -33,8 +33,8 @@ Only needs to be called when the chiplet is in a new environment and needs to co
33
33
##BEGIN
34
34
Must be called after creating a Serial connection, it can take either just a host for accessing public variables or you may also provide a secret for accessing protected variables in the database.
35
35
###Usage
36
-
BEGIN $Host
37
-
BEGIN $Host $Secret
36
+
BEGIN %Host%
37
+
BEGIN %Host% %Secret%
38
38
###Response
39
39
+OK - Accepted initialization parameters
40
40
###Examples
@@ -43,12 +43,12 @@ Must be called after creating a Serial connection, it can take either just a hos
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
-
GET $PATH
48
+
GET %PATH%
49
49
###Response
50
-
$DATA_AT_PATH
51
-
$JSON_DATA_BYTE_COUNT \n\r $JSON_DATA
50
+
%DATA_AT_PATH%
51
+
$%JSON_DATA_BYTE_COUNT% \r\n %JSON_DATA
52
52
###Examples
53
53
>>GET /user/aturing/first
54
54
<<+Alan
@@ -59,12 +59,12 @@ Fetches the value at $PATH and returns it on the serial line. If $PATH points to
59
59
##GET{+,*,#,.,?,$}
60
60
Same as GET but will either return the value in the format specified (by the format byte) or return an error.
61
61
###Usage
62
-
GET+ $PATH
63
-
GET: $PATH
64
-
GET? $PATH
65
-
GET$ $PATH
62
+
GET+ %PATH%
63
+
GET: %PATH%
64
+
GET? %PATH%
65
+
GET$ %PATH%
66
66
###Response
67
-
$FORMATED_RESPONSE
67
+
%FORMATED_RESPONSE%
68
68
###Examples
69
69
>>GET? /user/aturing/was_human
70
70
<<?true
@@ -73,7 +73,7 @@ Same as GET but will either return the value in the format specified (by the for
73
73
##SET
74
74
Store the data provided at the path provided. This method should be used for simple strings and will assume the first newline is the end of the data.
75
75
###Usage
76
-
SET $PATH $DATA
76
+
SET %PATH% %DATA%
77
77
###Response
78
78
+OK
79
79
-FAIL
@@ -83,11 +83,11 @@ Store the data provided at the path provided. This method should be used for sim
83
83
##SET$
84
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
-
Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of data before becoming responsive again.
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
89
-
$DATA_BYTE_COUNT
90
-
$DATA
88
+
SET$ %PATH%
89
+
%DATA_BYTE_COUNT%
90
+
%DATA%
91
91
###Response
92
92
+OK
93
93
-FAIL
@@ -102,9 +102,9 @@ Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of
102
102
##SET{+,*,#,.,?}
103
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
104
###Usage
105
-
SET+ $PATH $VALUE
106
-
SET: $PATH $VALUE
107
-
SET? $PATH $VALUE
105
+
SET+ %PATH% %VALUE%
106
+
SET: %PATH% %VALUE%
107
+
SET? %PATH% %VALUE%
108
108
###Response
109
109
+OK
110
110
-INCORRECT_TYPE
@@ -117,7 +117,7 @@ Same as SET but will force the value to be stored in the given type or return an
117
117
##REMOVE
118
118
Deletes the value located at the path provided.
119
119
###Usage
120
-
REMOVE $PATH
120
+
REMOVE %PATH%
121
121
###Response
122
122
+OK
123
123
-FAIL
@@ -128,9 +128,9 @@ Deletes the value located at the path provided.
128
128
##PUSH
129
129
Adds a value to the list located at the path provided and returns the key at which the new object is located.
130
130
###Usage
131
-
PUSH $PATH $DATA
131
+
PUSH %PATH% %DATA%
132
132
###Response
133
-
$KEY
133
+
%KEY%
134
134
###Examples
135
135
>>PUSH /user/aturing/login_timestamps 1455052043
136
136
<<+-K94eLnB0rAAvfkh_WC2
@@ -140,10 +140,10 @@ Similar to PUSH but used to write multiline strings or raw binary data. Data for
140
140
141
141
Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of data before becoming responsive again.
142
142
###Usage
143
-
PUSH$ $PATH $DATA_BYTE_COUNT
144
-
$DATA
143
+
PUSH$ %PATH% %DATA_BYTE_COUNT%
144
+
%DATA%
145
145
###Response
146
-
$KEY
146
+
%KEY%
147
147
###Examples
148
148
>>PUSH$ /user/aturing/quotes 91
149
149
>>We can only see a short distance ahead,
@@ -159,10 +159,10 @@ The event stream will continue until you send END_STREAM.
159
159
160
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.
161
161
###Usage
162
-
BEGIN_STREAM $PATH
162
+
BEGIN_STREAM %PATH%
163
163
###Response
164
-
$EVENT_NAME $SUB_PATH
165
-
$DATA
164
+
%EVENT_NAME% %SUB_PATH%
165
+
%DATA%
166
166
+OK
167
167
###Examples
168
168
>>BEGIN_STREAM /user/aturing
@@ -176,7 +176,7 @@ When there is an ongoing event stream no other commands can be processed until y
176
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