Skip to content

Commit f5abfe6

Browse files
committed
release beta 1
1 parent 25f7990 commit f5abfe6

File tree

3 files changed

+218
-98
lines changed

3 files changed

+218
-98
lines changed

README.md

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,34 @@ IOT PROTOCOL uses middlewares and router's filtering features based on [express
2020
- Request-response model like HTTP protocol
2121
- Adaptive requests methods for optimizing data length
2222
- Multipart (Send large data)
23+
- Streamming data
2324

2425
---
2526

2627
## Preamble Version 1
2728

2829
```
29-
<MSCB + LSCB>
30+
<MSCB>
31+
<LSCB>
3032
[ID]
31-
[PATH + IOT_ETX]
32-
[HEADER + IOT_ETX]
33-
[BODY_LENGTH + BODY]
33+
[PATH]
34+
[HEADER]
35+
[BODY]
3436
```
3537

3638
> `<...>` REQUIRED
3739
3840
> `[...]` OPTIONAL
3941
40-
> `[PATH + IOT_ETX] + [HEADER + IOT_ETX]` **MUST NOT BE MORE THAN 1016 Bytes**
42+
> `[PATH] + [HEADER]` **MUST NOT BE MORE THAN 1016 Bytes**
4143
>
4244
> + 1024 Bytes : IOT_PROTOCOL_BUFFER_SIZE
4345
> - 1 Byte : MSCB_SIZE
4446
> - 1 Byte : LSCB_SIZE
4547
> - 2 Bytes : ID_SIZE
4648
> - 4 Bytes : BODY_LENGTH_MAXIMUM_SIZE (Streaming)
4749
> ----------------
48-
> + 1016 Bytes : [PATH + IOT_ETX]_SIZE + [HEADER + IOT_ETX]_SIZE
50+
> + 1016 Bytes > [PATH]_SIZE + [HEADER]_SIZE
4951
>
5052
> |--------------------------------IOT_PROTOCOL_BUFFER_SIZE(1024)-----------------------------|
5153
>
@@ -67,7 +69,7 @@ IOT PROTOCOL uses middlewares and router's filtering features based on [express
6769

6870
### IOT_PROTOCOL_BUFFER_SIZE
6971

70-
**IOT_PROTOCOL_BUFFER_SIZE** is the maximum size to send or to receive per request. If `all data length > IOT_PROTOCOL_BUFFER_SIZE`, the data is broken in parts of *IOT_PROTOCOL_BUFFER_SIZE* length. Each part keeps the prefixed data (`MSCB + LSCB + ID + PATH + HEADER + BODY_LENGTH`) and attachs the remain body until its length is *IOT_PROTOCOL_BUFFER_SIZE* length or less.
72+
**IOT_PROTOCOL_BUFFER_SIZE** is the maximum size of request. If `all data length > IOT_PROTOCOL_BUFFER_SIZE`, the data is spplited in parts of *IOT_PROTOCOL_BUFFER_SIZE* length. Each part keeps the prefixed data (`MSCB + LSCB + ID + PATH + HEADER + BODY_LENGTH`) and attachs the remain body until its length is *IOT_PROTOCOL_BUFFER_SIZE* length or less.
7173

7274
* Type: `size_t` | `uint32_t`
7375
* Size: `4 bytes`
@@ -102,7 +104,9 @@ IOT PROTOCOL uses middlewares and router's filtering features based on [express
102104
---
103105
### [0] **MSCB**
104106

105-
The **Most Significant Control Byte**. **REQUIRED**
107+
The **Most Significant Control Byte**.
108+
109+
Preamble: `<MSCB>` **REQUIRED** | **SINGLE**
106110

107111
* Size: `1 byte`
108112
* Default: `0b00000100` = `4` = `0x4`
@@ -119,7 +123,10 @@ The **Most Significant Control Byte**. **REQUIRED**
119123
---
120124
### [1] **LSCB**
121125

122-
The **Least Significant Control Byte**. **REQUIRED**
126+
The **Least Significant Control Byte**.
127+
128+
Preamble: `<LSCB>` **REQUIRED** | **SINGLE**
129+
123130
* Size: `1 byte`
124131
* Default: `0b00000100` = `4` = `0x4`
125132

@@ -148,7 +155,9 @@ Methods Types
148155

149156
### [2] **ID**:
150157

151-
Unsigned random number with up to 2^16 that identifies the request. **SINGLE**
158+
Unsigned random number with up to 2^16 that identifies the request.
159+
160+
Preamble: `[<ID>]` **OPTIONAL** | **SINGLE**
152161

153162
* Type: `uint16_t` as Big Endian format
154163
* Size: `2 bytes`
@@ -163,7 +172,7 @@ Unsigned random number with up to 2^16 that identifies the request. **SINGLE**
163172
The path component contains data, usually organized in hierarchical
164173
form, that, serves to identify a resource [URI > 3.3 Path](https://www.rfc-editor.org/info/rfc3986).
165174

166-
Format: `PATH + IOT_ETX`. **SINGLE**
175+
Preamble: `[<PATH> + <IOT_ETX>]`. **OPTIONAL** | **SINGLE**
167176

168177
#### **PATH**
169178

@@ -172,23 +181,34 @@ Format: `PATH + IOT_ETX`. **SINGLE**
172181

173182
---
174183

175-
### [4] **HEADERs**:
184+
### [4] **HEADER**:
176185

177-
Headers are be Key Value Pair that serves to set an attribute value for the request. Case sensitive.
186+
Header is a Key Value Pair that serves to set an attribute value for the request. Case sensitive. Maximum of 255 headers.
178187

179-
Format: `HEADER + IOT_ETX`. **MULTIPLE**
188+
Preamble: `[<HEADER_SIZE> + <HEADERs>]`. **OPTIONAL** | **SINGLE**
180189

181-
#### **HEADER**
190+
### **HEADER_SIZE**
182191

183-
* Type: `string`
184-
* Format: `KEY + IOT_RS + VALUE`
192+
The amount of headers from 1 until 255 headers. **REQUIRED** | **SINGLE**
193+
194+
* Type: `byte` | `uint8_t`
195+
* Size: `1 byte`
196+
197+
#### **HEADERs**
198+
199+
The key-value pair of one header.
200+
201+
Preamble: `<KEY + IOT_RS + VALUE + IOT_ETX>` **REQUIRED** | **MULTIPLE** (Minimum 1)
202+
203+
* Type: `uint8_t[]`
185204
* *KEY*:
186205
* Type: `string`
187206
* *VALUE*:
188207
* Type: `string`
208+
189209
* Example:
190-
* Single header: `["foo", 0x1E, "bar", 0x3]`
191-
* Multiple headers: `["foo", 0x1E, "bar", 0x3, "lorem", 0x1E, "ipsum", 0x3]`
210+
* Single header (HEADER_SIZE = 1): `["foo", IOT_RS, "bar", IOT_ETX]`
211+
* Multiple headers (HEADER_SIZE = 2): `["foo", IOT_RS, "bar", IOT_ETX, "lorem", IOT_RS, "ipsum", IOT_ETX]`
192212

193213

194214
------------------
@@ -197,14 +217,14 @@ Format: `HEADER + IOT_ETX`. **MULTIPLE**
197217

198218
The final data to be sent for request receiver.
199219

200-
Format: `BODY_LENGTH + BODY`. **OPTIONAL** | **SINGLE**
220+
Preamble: `[<BODY_LENGTH> + <BODY>]`. **OPTIONAL** | **SINGLE**
201221

202222
#### **BODY_LENGTH**:
203223

204224
The body's length. **REQUIRED**
205225

206226
* Type: `uint8_t` | `uint16_t` | `uint32_t` as Big Endian format
207-
* Size: `1 / 2 / 4 bytes.` *Depends on the applied method*
227+
* Size: `1 / 2 / 4 bytes.` *Depends on the used method*
208228
* Example:
209229
* `uint8_t`
210230
* decimal: `17`

0 commit comments

Comments
 (0)