Skip to content

Commit 18fa76a

Browse files
committed
v2 doc update
1 parent d4913a4 commit 18fa76a

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

README.rst

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The base UUID used in characteristics is ``ADAFxxxx-4669-6C65-5472-616E73666572`
8787

8888
The service has two characteristics:
8989

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.
9191
* 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.
9292

9393
Commands
@@ -150,6 +150,7 @@ The header is four fixed entries and a variable length path:
150150
* Path length: 16-bit number encoding the encoded length of the path string.
151151
* Offset: 32-bit number encoding the starting offset to write.
152152
* 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.
153154
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
154155

155156
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
169170

170171
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.
171172

173+
**NOTE**: Current time was added in version 2. The rest of the packets remained the same.
172174

173175
``0x30`` - Delete a file or directory
174176
+++++++++++++++++++++++++++++++++++++
175177

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.
177179

178180
The header is two fixed entries and a variable length path:
179181

@@ -184,7 +186,7 @@ The header is two fixed entries and a variable length path:
184186

185187
The server will reply with:
186188
* 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.
188190

189191
``0x40`` - Make a directory
190192
+++++++++++++++++++++++++++
@@ -226,10 +228,50 @@ The server will reply with n+1 entries for a directory with n files:
226228
- Bits 1-7: Reserved
227229

228230
* 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.
229232
* 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.
230233

231234
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.
232235

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.
273+
* Adds move command.
274+
233275
Contributing
234276
============
235277

0 commit comments

Comments
 (0)