Initial commit - Phase 3/4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
michael
2026-01-06 13:45:29 -08:00
parent 1da6730735
commit 4f35df1781
323 changed files with 98287 additions and 1195 deletions

View File

@@ -0,0 +1,112 @@
"""GATT Characteristic UUIDs for Dangerous Pi BLE interface.
This module defines the UUIDs for all GATT services and characteristics
used by the Dangerous Pi BLE interface.
UUID Namespace: Dangerous Pi uses custom 128-bit UUIDs.
Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12 hex chars)
Services are differentiated by the 5th group:
- PM3: 0000xxxx (0000-000f)
- WiFi: 0001xxxx (0010-001f)
- System: 0002xxxx (0020-002f)
- Update: 0003xxxx (0030-003f)
"""
from dataclasses import dataclass
def _uuid(suffix: str) -> str:
"""Generate a Dangerous Pi UUID with the given 4-char suffix.
Args:
suffix: 4-character hex suffix (e.g., "0001", "0010")
Returns:
Full 128-bit UUID string
"""
return f"d4c3b2a1-0000-1000-8000-00805f9b{suffix}"
@dataclass
class PM3CharacteristicUUIDs:
"""PM3 GATT Service and Characteristics.
Service for Proxmark3 operations (command execution, status).
"""
# Service UUID
SERVICE = _uuid("0000")
# Characteristics
COMMAND_WRITE = _uuid("0001") # Write: Execute PM3 command
COMMAND_RESULT = _uuid("0002") # Notify: Command result
STATUS = _uuid("0003") # Read: Get PM3 status
SESSION_CREATE = _uuid("0004") # Write: Create session
SESSION_RELEASE = _uuid("0005") # Write: Release session
SESSION_INFO = _uuid("0006") # Read: Get session info
@dataclass
class WiFiCharacteristicUUIDs:
"""WiFi GATT Service and Characteristics.
Service for WiFi network management (scan, connect, status).
"""
# Service UUID
SERVICE = _uuid("0010")
# Characteristics
STATUS = _uuid("0011") # Read: Get WiFi status
SCAN = _uuid("0012") # Write: Trigger scan, Notify: Results
CONNECT = _uuid("0013") # Write: Connect to network
DISCONNECT = _uuid("0014") # Write: Disconnect
MODE = _uuid("0015") # Read/Write: WiFi mode
SAVED_NETWORKS = _uuid("0016") # Read: Get saved networks
FORGET_NETWORK = _uuid("0017") # Write: Forget network
@dataclass
class SystemCharacteristicUUIDs:
"""System GATT Service and Characteristics.
Service for system operations (info, shutdown, restart).
"""
# Service UUID
SERVICE = _uuid("0020")
# Characteristics
INFO = _uuid("0021") # Read: Get system info
SHUTDOWN = _uuid("0022") # Write: Initiate shutdown
RESTART = _uuid("0023") # Write: Initiate restart
LOGS = _uuid("0024") # Read: Get service logs
@dataclass
class UpdateCharacteristicUUIDs:
"""Update GATT Service and Characteristics.
Service for software update management.
"""
# Service UUID
SERVICE = _uuid("0030")
# Characteristics
CHECK = _uuid("0031") # Write: Check for updates, Notify: Result
DOWNLOAD = _uuid("0032") # Write: Download update
INSTALL = _uuid("0033") # Write: Install update
PROGRESS = _uuid("0034") # Read/Notify: Update progress
RELEASE_NOTES = _uuid("0035") # Read: Get release notes
# Characteristic properties
class CharacteristicProperties:
"""Standard GATT characteristic properties."""
READ = "read"
WRITE = "write"
WRITE_WITHOUT_RESPONSE = "write-without-response"
NOTIFY = "notify"
INDICATE = "indicate"
# Characteristic descriptors
CHARACTERISTIC_USER_DESCRIPTION_UUID = "00002901-0000-1000-8000-00805f9b34fb"
CLIENT_CHARACTERISTIC_CONFIG_UUID = "00002902-0000-1000-8000-00805f9b34fb"