Skip to content

Commit ffbcbb8

Browse files
author
David Gräff
committed
Create simpleudp.md
1 parent cb51f4a commit ffbcbb8

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

doc/simpleudp.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SimpleUDP
2+
3+
## SimpleUDP Packet Format (Receive type)
4+
* All ascii based, two characters not allowed in names and ids: newline (\n) and tabulator (\t).
5+
6+
### General structure (lines are separated by newlines)
7+
Header (always SimpleUDP_info or SimpleUDP_info_ack or SimpleUDP_info_fail)
8+
DeviceUniqueID (often Mac address of peer)
9+
Name of device (english name of device, user may rename it within the app)
10+
Version string (no special formatting)
11+
List of actions (one action per line, action consists of multiple tokens)
12+
13+
If you send SimpleUDP_detect, you will receive a full SimpleUDP_info with all known actions. If
14+
you send a SimpleUDP_cmd, the peer will acknowledge with a SimpleUDP_info_ack where only the affected
15+
actions are listed.
16+
17+
### Structure of an action
18+
TYPE \t actionID string \t action name \t optional value
19+
20+
* **TYPE** is one of (STATELESS,TOGGLE,RANGE,NOTEXIST).
21+
* The **actionID** may be any string but have to be unique among all actions.
22+
* The **action name** can be any string as long as it does not contain \n and \t.
23+
* The value is only necessary if the type is TOGGLE or RANGE. If the Header is equal to SimpleUDP_info_fail
24+
the TYPE may be NOTEXIST if you requested a command on a non existing action.
25+
26+
Example packet:
27+
SimpleUDP_info\n
28+
11:22:33:44:55:66\n
29+
device_name\n
30+
1.0-2015.05.10\n
31+
STATELESS\tACTION1\tAction Name
32+
TOGGLE\tACTION2\tAction Name\t1
33+
34+
## SimpleUDP Packet Format (command type)
35+
* All ascii based, two characters not allowed in names and ids: newline (\n) and tabulator (\t).
36+
37+
### General structure (lines are separated by newlines)
38+
Header (always SimpleUDP_cmd)
39+
UniqueID (we use the android device unique id)
40+
CMD_TYPE \t actionID \t VALUE \t RANDOM_REQUEST_NO
41+
42+
* **CMD_TYPE** is one of (SET,TOGGLE,RENAME), the actionID has been received before and is known.
43+
* **VALUE**: if CMD_TYPE is SET,RENAME a value is necessary else just set it to 0.
44+
* **RANDOM_REQUEST_NO**: A random request number. This is for duplicate detection. The receiver has
45+
to check the current commands request number against the last ~3 requests and ignore (but still
46+
ack) the received but already executed command.
47+
48+
Example packet:
49+
SimpleUDP_cmd\n
50+
NFKAJELAFBAGAHD\n
51+
SET\tACTION2\t1

0 commit comments

Comments
 (0)