You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+45-3Lines changed: 45 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ The base UUID used in characteristics is ``ADAFxxxx-4669-6C65-5472-616E73666572`
87
87
88
88
The service has two characteristics:
89
89
90
-
* version (``0x0100``) - Simple unsigned 32-bit integer version number. Always 1.
90
+
* version (``0x0100``) - Simple unsigned 32-bit integer version number. May be 1 or 2.
91
91
* raw transfer (``0x0200``) - Bidirectional link with a custom protocol. The client does WRITE_NO_RESPONSE to the characteristic and then server replies via NOTIFY. (This is similar to the Nordic UART Service but on a single characteristic rather than two.) The commands over the transfer characteristic are idempotent and stateless. A disconnect during a command will reset the state.
92
92
93
93
Commands
@@ -150,6 +150,7 @@ The header is four fixed entries and a variable length path:
150
150
* Path length: 16-bit number encoding the encoded length of the path string.
151
151
* Offset: 32-bit number encoding the starting offset to write.
152
152
* Total size: 32-bit number encoding the total length of the file contents.
153
+
* Current time: 64-bit number encoding nanoseconds since January 1st, 1970. Used as the file modification time.
153
154
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
154
155
155
156
The server will repeatedly respond until the total length has been transferred with:
@@ -169,11 +170,12 @@ The client will repeatedly respond until the total length has been transferred w
169
170
170
171
The transaction is complete after the server has received all data and replied with a status with 0 free space and offset set to the content length.
171
172
173
+
**NOTE**: Current time was added in version 2. The rest of the packets remained the same.
172
174
173
175
``0x30`` - Delete a file or directory
174
176
+++++++++++++++++++++++++++++++++++++
175
177
176
-
Deletes the file or directory at the given full path. Directories must be empty to be deleted.
178
+
Deletes the file or directory at the given full path. Non-empty directories will have their contents deleted as well.
177
179
178
180
The header is two fixed entries and a variable length path:
179
181
@@ -184,7 +186,7 @@ The header is two fixed entries and a variable length path:
184
186
185
187
The server will reply with:
186
188
* Command: Single byte. Always ``0x31``.
187
-
* Status: Single byte. ``0x01`` if the file or directory was deleted or ``0x02`` if the path is a non-empty directory or non-existent.
189
+
* Status: Single byte. ``0x01`` if the file or directory was deleted or ``0x02`` if the path is non-existent.
188
190
189
191
``0x40`` - Make a directory
190
192
+++++++++++++++++++++++++++
@@ -226,10 +228,50 @@ The server will reply with n+1 entries for a directory with n files:
226
228
- Bits 1-7: Reserved
227
229
228
230
* File size: 32-bit number encoding the size of the file. Ignore for directories. Value may change.
231
+
* Modification time: 64-bit number of nanoseconds since January 1st, 1970. *However*, files modifiers may not have an accurate clock so do *not* assume it is correct. Instead, only use it to determine cacheability vs a local copy.
229
232
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.) These paths are relative so they won't contain ``/`` at all.
230
233
231
234
The transaction is complete when the final entry is sent from the server. It will have entry number == total entries and zeros for flags, file size and path length.
232
235
236
+
``0x60`` - Move a file or directory
237
+
+++++++++++++++++++++++++++++++++++
238
+
239
+
Moves a file or directory at a given path to a different path. Can be used to
240
+
rename as well. The two paths are sent separately so that they are not limited
241
+
by internal packet buffer sizes differently from other commands.
242
+
243
+
The header is two fixed entries and a variable length path:
244
+
245
+
* Command: Single byte. Always ``0x60``.
246
+
* 1 Byte reserved for padding.
247
+
* Old Path length: 16-bit number encoding the encoded length of the path string.
248
+
* Old Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
249
+
250
+
The server will reply with:
251
+
* Command: Single byte. Always ``0x61``.
252
+
* Status: Single byte. ``0x01`` on success or ``0x02`` if the old path is too long for internal buffers.
253
+
254
+
* Command: Single byte. Always ``0x62``.
255
+
* 1 Byte reserved for padding.
256
+
* New Path length: 16-bit number encoding the encoded length of the path string.
257
+
* New Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
258
+
259
+
The server will reply with:
260
+
* Command: Single byte. Always ``0x63``.
261
+
* Status: Single byte. ``0x01`` on success or ``0x02`` on error.
262
+
263
+
Versions
264
+
=========
265
+
266
+
Version 2
267
+
---------
268
+
269
+
* Adds modification time.
270
+
* Adds current time to file write command.
271
+
* Adds modification time to directory listing entries.
272
+
* Changes delete to delete non-empty directories automatically.
0 commit comments