| 58 | } |
| 59 | |
| 60 | void Command::Recv(StreamReader &reader) |
| 61 | { |
| 62 | reader.Read(length); |
| 63 | length = EndianSwap(length); |
| 64 | reader.Read(id); |
| 65 | id = EndianSwap(id); |
| 66 | |
| 67 | byte flags = 0; |
| 68 | reader.Read(flags); |
| 69 | if(flags == 0x80) |
| 70 | { |
| 71 | commandset = CommandSet::Unknown; |
| 72 | command = 0; |
| 73 | uint16_t errInt = 0; |
| 74 | reader.Read(errInt); |
| 75 | error = (Error)EndianSwap(errInt); |
| 76 | } |
| 77 | else |
| 78 | { |
| 79 | reader.Read(commandset); |
| 80 | reader.Read(command); |
| 81 | error = Error::None; |
| 82 | } |
| 83 | |
| 84 | data.clear(); |
| 85 | if(length >= 11) |
| 86 | { |
| 87 | data.resize(length - 11); |
| 88 | reader.Read(&data[0], data.size()); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | CommandData Command::GetData() |
| 93 | { |
no test coverage detected