Files
dwarf_protocol/04_base_messages.md
Jacquin Antoine be87e8a4ca Add complete DWARFLAB protocol documentation
- Architecture overview, BLE and WebSocket protocols
- All 19 modules with command IDs validated against smali source
- BLE packet format with CRC-16/MODBUS pseudocode
- Complete WsCmd index (~300 commands)
- Connection flow with pseudocode examples
- Methodology section explaining APK decompilation process
2026-06-13 00:21:19 +02:00

65 lines
2.0 KiB
Markdown

# Base Messages (BaseProto)
## WsPacket — WebSocket Envelope
Every WebSocket message uses this envelope.
| Field | # | Type | Description |
|-------|---|------|-------------|
| `majorVersion` | 1 | int32 | Protocol major version (constant = 2) |
| `minorVersion` | 2 | int32 | Protocol minor version (constant = 3) |
| `deviceId` | 3 | int32 | Target device ID (0=Unknown, 1=DWARF_2, 2=DWARF_3, 4=DWARF_mini, 5=DWARF_4, 6=DWARF_DRAGON) |
| `moduleId` | 4 | int32 | Module ID (0-18, see architecture) |
| `cmd` | 5 | int32 | Command ID (see WsCmd index) |
| `type` | 6 | int32 | Message type: 0=request, 1=response, 2=notification, 3=reply |
| `data` | 7 | bytes | Protobuf-encoded payload for the specific module/command |
| `clientId` | 8 | string | App client identifier |
## CommonParam — Generic Motor Parameters
Used by motor control and movement commands.
| Field | # | Type | Description |
|-------|---|------|-------------|
| `hasAuto` | 1 | bool | Auto mode available |
| `autoMode` | 2 | int32 | Auto mode (0=off, 1=on) |
| `id` | 3 | int32 | Parameter ID |
| `modeIndex` | 4 | int32 | Mode index |
| `index` | 5 | int32 | Current index |
| `continueValue` | 6 | double | Continuation value |
## ComResponse — Standard Response
| Field | # | Type | Description |
|-------|---|------|-------------|
| `code` | 1 | int32 | Status code (0=success, >0=error) |
## ComResWithDouble — Response with Numeric Value
| Field | # | Type | Description |
|-------|---|------|-------------|
| `value` | 1 | double | Response value |
| `code` | 2 | int32 | Status code |
## ComResWithString — Response with String
| Field | # | Type | Description |
|-------|---|------|-------------|
| `str` | 1 | string | Response string |
| `code` | 2 | int32 | Status code |
## Version Enums
### WsMajorVersion
| Value | Name |
|-------|------|
| 0 | WS_MAJOR_VERSION_UNKNOWN |
| 2 | WS_MAJOR_VERSION_NUMBER |
### WsMinorVersion
| Value | Name |
|-------|------|
| 0 | WS_MINOR_VERSION_UNKNOWN |
| 3 | WS_MINOR_VERSION_NUMBER |