Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit e5570d6

Browse files
committed
switched variable marker from $ to %%
1 parent 8ced4fb commit e5570d6

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

serial_protocol.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ During the first use, or when the chiplet changes environments a “NETWORK” c
33

44
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.
55

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.
77

88
##Response Format Byte
99
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
1717
##NETWORK
1818
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.
1919
###Usage
20-
NETWORK $SSID
21-
NETWORK $SSID $PASSWORD
20+
NETWORK %SSID%
21+
NETWORK %SSID% %PASSWORD%
2222
###Response
2323
+CONNECTED - When connected to new network
2424
-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
3333
##BEGIN
3434
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.
3535
###Usage
36-
BEGIN $Host
37-
BEGIN $Host $Secret
36+
BEGIN %Host%
37+
BEGIN %Host% %Secret%
3838
###Response
3939
+OK - Accepted initialization parameters
4040
###Examples
@@ -43,12 +43,12 @@ Must be called after creating a Serial connection, it can take either just a hos
4343
>> BEGIN https://samplechat.firebaseio-demo.com nnz...sdf
4444
<< +OK
4545
##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.
4747
###Usage
48-
GET $PATH
48+
GET %PATH%
4949
###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
5252
###Examples
5353
>>GET /user/aturing/first
5454
<<+Alan
@@ -59,12 +59,12 @@ Fetches the value at $PATH and returns it on the serial line. If $PATH points to
5959
##GET{+,*,#,.,?,$}
6060
Same as GET but will either return the value in the format specified (by the format byte) or return an error.
6161
###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%
6666
###Response
67-
$FORMATED_RESPONSE
67+
%FORMATED_RESPONSE%
6868
###Examples
6969
>>GET? /user/aturing/was_human
7070
<<?true
@@ -73,7 +73,7 @@ Same as GET but will either return the value in the format specified (by the for
7373
##SET
7474
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.
7575
###Usage
76-
SET $PATH $DATA
76+
SET %PATH% %DATA%
7777
###Response
7878
+OK
7979
-FAIL
@@ -83,11 +83,11 @@ Store the data provided at the path provided. This method should be used for sim
8383
##SET$
8484
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.
8585

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.
8787
###Usage
88-
SET$ $PATH
89-
$DATA_BYTE_COUNT
90-
$DATA
88+
SET$ %PATH%
89+
%DATA_BYTE_COUNT%
90+
%DATA%
9191
###Response
9292
+OK
9393
-FAIL
@@ -102,9 +102,9 @@ Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of
102102
##SET{+,*,#,.,?}
103103
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.
104104
###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%
108108
###Response
109109
+OK
110110
-INCORRECT_TYPE
@@ -117,7 +117,7 @@ Same as SET but will force the value to be stored in the given type or return an
117117
##REMOVE
118118
Deletes the value located at the path provided.
119119
###Usage
120-
REMOVE $PATH
120+
REMOVE %PATH%
121121
###Response
122122
+OK
123123
-FAIL
@@ -128,9 +128,9 @@ Deletes the value located at the path provided.
128128
##PUSH
129129
Adds a value to the list located at the path provided and returns the key at which the new object is located.
130130
###Usage
131-
PUSH $PATH $DATA
131+
PUSH %PATH% %DATA%
132132
###Response
133-
$KEY
133+
%KEY%
134134
###Examples
135135
>>PUSH /user/aturing/login_timestamps 1455052043
136136
<<+-K94eLnB0rAAvfkh_WC2
@@ -140,10 +140,10 @@ Similar to PUSH but used to write multiline strings or raw binary data. Data for
140140

141141
Receiver will wait until a timeout for client to send $DATA_BYTE_COUNT worth of data before becoming responsive again.
142142
###Usage
143-
PUSH$ $PATH $DATA_BYTE_COUNT
144-
$DATA
143+
PUSH$ %PATH% %DATA_BYTE_COUNT%
144+
%DATA%
145145
###Response
146-
$KEY
146+
%KEY%
147147
###Examples
148148
>>PUSH$ /user/aturing/quotes 91
149149
>>We can only see a short distance ahead,
@@ -159,10 +159,10 @@ The event stream will continue until you send END_STREAM.
159159

160160
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.
161161
###Usage
162-
BEGIN_STREAM $PATH
162+
BEGIN_STREAM %PATH%
163163
###Response
164-
$EVENT_NAME $SUB_PATH
165-
$DATA
164+
%EVENT_NAME% %SUB_PATH%
165+
%DATA%
166166
+OK
167167
###Examples
168168
>>BEGIN_STREAM /user/aturing
@@ -176,7 +176,7 @@ When there is an ongoing event stream no other commands can be processed until y
176176
Used to stop listening to events at a given path. This must be the same path provided to a previous BEGIN_STREAM call.
177177

178178
###Usage
179-
END_STREAM $PATH
179+
END_STREAM %PATH%
180180
###Response
181181
+OK
182182
-NOT_STREAMING_PATH

0 commit comments

Comments
 (0)