Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite38f212

Browse files
authored
First pass at serial protocol.
1 parent854bb0c commite38f212

File tree

1 file changed

+124
-3
lines changed

1 file changed

+124
-3
lines changed

‎serial_protocol.md

Lines changed: 124 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Protocol:
1+
#GeneralProtocol:
22
During the first use, or when the chiplet changes environments a “NETWORK” call is expected to initialize the wifi parameters.
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.
@@ -29,9 +29,11 @@ Only needs to be called when the chiplet is in a new environment and needs to co
2929
<< +CONNECTED
3030
>> NETWORK home-guest
3131
<< -UNABLE_TO_CONNECT
32+
33+
#Database Protocol
3234

33-
##BEGIN
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+
##BEGIN_DB
36+
Called to start communicating with the Firebase database, 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.
3537
###Usage
3638
BEGIN %Host%
3739
BEGIN %Host% %Secret%
@@ -186,3 +188,122 @@ Used to stop listening to events at a given path. This must be the same path pro
186188
>>BEGIN_STREAM /user/aturing
187189
>>END_STREAM /user/aturing
188190
<<+OK
191+
192+
#Messaging Protocol
193+
194+
##BEGIN_MESSAGING
195+
Called to start communicating with Firebase Cloud Messaging, it requires a server key.
196+
###Usage
197+
BEGIN %Server_Key%
198+
###Response
199+
+OK - Accepted initialization parameters
200+
###Examples
201+
>> BEGINhttps://samplechat.firebaseio-demo.com
202+
<< +OK
203+
204+
##MESSAGE_TO_USERS
205+
Called to start composing a message to users by registration id. You can specify as many as you wish separated by spaces on the same line.
206+
##Usage
207+
MESSAGE_TO_USERS %Registration_id% ...
208+
###Response
209+
+OK - Ready to specify rest of message.
210+
###Examples
211+
>> MESSAGE_TO_USERS fQCLfBOGdh0...9k0
212+
<< +OK
213+
>> MESSAGE_TO_USERS fQCLfBOGdh0...9k0 fQCLfBOGdh0...5j1
214+
<< +OK
215+
216+
##MESSAGE_TO_TOPIC
217+
Called to start composing a message to a topic.
218+
##Usage
219+
MESSAGE_TO_TOPIC %Topic_Name% ...
220+
###Response
221+
+OK - Ready to specify rest of message.
222+
###Examples
223+
>> MESSAGE_TO_TOPIC news
224+
<< +OK
225+
226+
##COLLAPSE_KEY
227+
Sets a collapse key on the message. When the server recieves a message with a collapse key it will discard any pending messages it has with the same key. So the client will only see the most recent one when it checks in.
228+
##Usage
229+
COLLAPSE_KEY %Collapse_Key% ...
230+
###Response
231+
+OK - Ready to specify rest of message.
232+
###Examples
233+
>> COLLAPSE_KEY LatestUpdate
234+
<< +OK
235+
236+
##HIGH_PRIORITY
237+
If set to true the user's device will wake up to receive the message. This is used when the message is high priority but a cost it paid in battery life for the user.
238+
##Usage
239+
HIGH_PRIORITY True|False
240+
###Response
241+
+OK - Ready to specify rest of message.
242+
###Examples
243+
>> HIGH_PRIORITY TRUE
244+
<< +OK
245+
>> HIGH_PRIORITY false
246+
<< +OK
247+
248+
##DELAY_WHILE_IDLE
249+
If set to true the message will not be delivered until the user's device is active. This is used when the message can wait to be seen until the user is available.
250+
We are not case sensitive on True/False.
251+
##Usage
252+
DELAY_WHILE_IDLE True|False
253+
###Response
254+
+OK - Ready to specify rest of message.
255+
###Examples
256+
>> HIGH_PRIORITY TRUE
257+
<< +OK
258+
>> HIGH_PRIORITY false
259+
<< +OK
260+
261+
262+
##TIME_TO_LIVE
263+
The message will expire after this amount of time in seconds. The default (and max value) is four weeks.
264+
##Usage
265+
TIME_TO_LIVE[0,2419200]
266+
###Response
267+
+OK - Ready to specify rest of message.
268+
-ERROR_OUT_OF_RANGE - Value provided was not in range[0,2419200].
269+
###Examples
270+
>> TIME_TO_LIVE 10
271+
<< +OK
272+
>> TIME_TO_LIVE -1
273+
<< -ERROR_OUT_OF_RANGE
274+
>> TIME_TO_LIVE 2500000
275+
<< -ERROR_OUT_OF_RANGE
276+
277+
##NOTIFICATION
278+
Notification to display to the user, is made up of a title and a body. The title is specified on the first line and the first line ends with a count of bytes in the body. We will then read the next %Body_Byte_Count% bytes (after the line break) and interpret them as the body. If there is no body specify 0 for the byte count.
279+
##Usage
280+
NOTIFICATION %Title% %Body_Byte_Count%
281+
%Body%
282+
###Response
283+
+OK - Ready to specify rest of message.
284+
-ERROR_INCORRECT_FORMAT - The message format was incorrect.
285+
###Examples
286+
>> NOTIFICATION This is a test. 0
287+
<< +OK
288+
>> NOTIFICATION This is a test.
289+
<< -ERROR_INCORRECT_FORMAT
290+
>> NOTIFICATION This is a test with a body. 12
291+
>> Hello World!
292+
<< +OK
293+
294+
##ADD_DATA
295+
Data to delivery to client application. This is comprised of Key->Value pairs. The Key is specified on the first line and the first line ends with a count of bytes in the value. We will then read the next %Value_Byte_Count% bytes (after the line break) and interpret them as the value. If there is no value specify 0 forthe byte count.
296+
##Usage
297+
ADD_DATA %KEY% %VALUE_BYTE_COUNT%
298+
%VALUE%
299+
###Response
300+
+OK - Ready to specify rest of message.
301+
-ERROR_INCORRECT_FORMAT - The message format was incorrect.
302+
###Examples
303+
>> ADD_DATA Temperature_Ready 0
304+
<< +OK
305+
>> ADD_DATA Temperature_Ready
306+
<< -ERROR_INCORRECT_FORMAT
307+
>> ADD_DATA Temperature 3
308+
>> 104
309+
<< +OK

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp