Skip to content

Commit d9c2f5b

Browse files
author
Whywilson
committed
Finish the BLE protocol under english.
1 parent 5daf112 commit d9c2f5b

File tree

1 file changed

+182
-2
lines changed

1 file changed

+182
-2
lines changed

docs/en/05+1-ble_protocol.md

Lines changed: 182 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ TODO Supplement the error code in detail. .
248248
| cmd | uint8 | 1 | fixed 0x12 |
249249
| status | uint8 | 1 | Status code, see status code description |
250250
| chunk | uint16 | 2 | 0 |
251-
| file id | uint8 | 1 | File ID, used for subsequent read and write requests |
251+
| file id | uint8 | 1 | file id, used for subsequent read and write requests |
252252

253253
## 0x13: Close file
254254

@@ -257,4 +257,184 @@ TODO Supplement the error code in detail. .
257257
| Field name | Type | Length (bytes) | Description |
258258
| ---- | ----- |---- | ---- |
259259
| cmd | uint8 | 1 | 0x13 |
260-
| sta
260+
| status | uint8 | 1 | 0 |
261+
| chunk | uint16 | 2 | 0 |
262+
| file id | uint8 | 1 | file id |
263+
264+
265+
2. Service response
266+
267+
| Field name | Type | Length (bytes) | Description |
268+
| ---- | ----- |---- | ---- |
269+
| cmd | uint8 | 1 | 0x13 |
270+
| status | uint8 | 1 | Status code, see status code description |
271+
| chunk | uint16 | 2 | 0 |
272+
| file id | uint8 | 1 | file id, used for subsequent read and write requests |
273+
274+
275+
## 0x14: Read file
276+
277+
1. The client sends a request
278+
279+
Only support sequential reading.
280+
281+
| Field name | Type | Length (bytes) | Description |
282+
| ---- | ----- |---- | ---- |
283+
| cmd | uint8 | 1 | 0x14 |
284+
| status | uint8 | 1 | 0 |
285+
| chunk | uint16 | 2 | 0 |
286+
| file id | uint8 | 1| file id |
287+
288+
289+
2. The server responds to the request
290+
291+
| Field name | Type | Length (bytes) | Description |
292+
| ---- | ----- |---- | ---- |
293+
| cmd | uint8 | 1 | 0x14 |
294+
| status | uint8 | 1 |Status code, see status code description |
295+
| chunk | uint16 | 2 | Enable chunk transfer |
296+
| data | byte | N | File data |
297+
298+
299+
## 0x15 Write to file
300+
301+
1. The client sends a request
302+
303+
| Field name | Type | Length (bytes) | Description |
304+
| ---- | ----- |---- | ---- |
305+
| cmd | uint8 | 1 | 0x15 |
306+
| status | uint8 | 1 | 0 |
307+
| chunk | uint16 | 2 | Enable chunk transfer |
308+
| file id | uint8 | 1 | file id |
309+
| data | byte | N | File data, max length = MTU - 4 |
310+
311+
312+
313+
2. The server responds to the request
314+
315+
| Field name | Type | Length (bytes) | Description |
316+
| ---- | ----- |---- | ---- |
317+
| cmd | uint8 | 1 | 0x15 |
318+
| status | uint8 | 1 |Status code, see status code description |
319+
| chunk | uint16 | 2 | Same as Request |
320+
321+
322+
## 0x16:Read folder
323+
324+
1. The client sends a request
325+
326+
| Field name | Type | Length (bytes) | Description |
327+
| ---- | ----- |---- | ---- |
328+
| cmd | uint8 | 1 | 0x16 |
329+
| status | uint8 | 1 | 0 |
330+
| chunk | uint16 | 2 | 0 |
331+
| path length | uint16 | 2 | Path length under bytes |
332+
| path | byte | N | Path string bytes |
333+
334+
335+
2. The server responds to the request
336+
337+
| Field name | Type | Length (bytes) | Description |
338+
| ---- | ----- |---- | ---- |
339+
| cmd | uint8 | 1 | 0x16 |
340+
| status | uint8 | 1 |Status code, see status code description |
341+
| chunk | uint16 | 2 | Enable chunk transfer |
342+
| file N name length| uint16 | 2 | File name bytes length|
343+
| file N name | byte | N| File name bytes |
344+
| file N size | uint32 | 4 |File size |
345+
| file N type | uint8 | 1 | File Type: 0 => File, 1 => Folder |
346+
| file N meta length | uint8 | 1 | File meta data length, 64 max|
347+
| file N meta | byte | N | File meta data |
348+
349+
## 0x17 Create folder
350+
351+
1. The client sends a request
352+
353+
| Field name | Type | Length (bytes) | Description |
354+
| ---- | ----- |---- | ---- |
355+
| cmd | uint8 | 1 | 0x17 |
356+
| status | uint8 | 1 | 0 |
357+
| chunk | uint16 | 2 | 0 |
358+
| path length | uint16 | 2 | Path length under bytes |
359+
| path | byte | N | Path string bytes |
360+
361+
362+
2. The server responds to the request
363+
364+
| Field name | Type | Length (bytes) | Description |
365+
| ---- | ----- |---- | ---- |
366+
| cmd | uint8 | 1 | 0x17 |
367+
| status | uint8 | 1 |Status code, see status code description |
368+
| chunk | uint16 | 2 | 0 |
369+
370+
371+
372+
## 0x18 Delete file or folder
373+
374+
1. The client sends a request
375+
376+
| Field name | Type | Length (bytes) | Description |
377+
| ---- | ----- |---- | ---- |
378+
| cmd | uint8 | 1 | 0x18 |
379+
| status | uint8 | 1 | 0 |
380+
| chunk | uint16 | 2 | 0 |
381+
| path length | uint16 | 2 | Path length under bytes |
382+
| path | byte | N | Path string bytes |
383+
384+
385+
2. The server responds to the request
386+
387+
| Field name | Type | Length (bytes) | Description |
388+
| ---- | ----- |---- | ---- |
389+
| cmd | uint8 | 1 | 0x18 |
390+
| status | uint8 | 1 |Status code, see status code description |
391+
| chunk | uint16 | 2 | 0 |
392+
393+
394+
## 0x19 Rename file or folder
395+
396+
1. The client sends a request
397+
398+
| Field name | Type | Length (bytes) | Description |
399+
| ---- | ----- |---- | ---- |
400+
| cmd | uint8 | 1 | 0x18 |
401+
| status | uint8 | 1 | 0 |
402+
| chunk | uint16 | 2 | Enable chunk transfer |
403+
| old path length | uint16 | 2 | Path length under bytes |
404+
| old path | byte | N | Path string bytes |
405+
| new path length | uint16 | 2 | Path length under bytes |
406+
| new path | byte | N | Path string bytes |
407+
408+
If data length is larger than MTU, use chunk transfer.
409+
410+
411+
2. The server responds to the request
412+
413+
| Field name | Type | Length (bytes) | Description |
414+
| ---- | ----- |---- | ---- |
415+
| cmd | uint8 | 1 | 0x18 |
416+
| status | uint8 | 1 |Status code, see status code description |
417+
| chunk | uint16 | 2 | 0 |
418+
419+
420+
## 0x1A Update file meta
421+
422+
1. The client sends a request
423+
424+
| Field name | Type | Length (bytes) | Description |
425+
| ---- | ----- |---- | ---- |
426+
| cmd | uint8 | 1 | 0x1a |
427+
| status | uint8 | 1 | 0 |
428+
| chunk | uint16 | 2 | 0 |
429+
| path length | uint16 | 2 | Path length under bytes |
430+
| path | byte | N | Path string bytes |
431+
| meta data | byte | N | File Meta Data |
432+
433+
2. The server responds to the request
434+
435+
| Field name | Type | Length (bytes) | Description |
436+
| ---- | ----- |---- | ---- |
437+
| cmd | uint8 | 1 | 0x1a |
438+
| status | uint8 | 1 |Status code, see status code description |
439+
| chunk | uint16 | 2 | 0 |
440+

0 commit comments

Comments
 (0)