| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | |
| 5 | #[derive(Debug, PartialEq)] |
| 6 | pub enum SyncCommand { |
| 7 | Data, |
| 8 | Dent, |
| 9 | Done, |
| 10 | Fail, |
| 11 | List, |
| 12 | Okay, |
| 13 | Quit, |
| 14 | Recv, |
| 15 | Send, |
| 16 | Stat, |
| 17 | } |
| 18 | |
| 19 | impl SyncCommand { |
| 20 | // Returns the byte serialisation of the protocol status. |
| 21 | pub fn code(&self) -> &'static [u8; 4] { |
| 22 | use self::SyncCommand::*; |
| 23 | match *self { |
| 24 | Data => b"DATA", |
| 25 | Dent => b"DENT", |
| 26 | Done => b"DONE", |
| 27 | Fail => b"FAIL", |
| 28 | List => b"LIST", |
| 29 | Okay => b"OKAY", |
| 30 | Quit => b"QUIT", |
| 31 | Recv => b"RECV", |
| 32 | Send => b"SEND", |
| 33 | Stat => b"STAT", |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | pub type DeviceSerial = String; |