A USP (User Services Platform / TR-369) compliant device simulator with multi-transport support (gRPC, WebSocket, HTTP, MQTT).
| Type | Path | Description |
|---|---|---|
| Shared Kernel | packages/usp_protocol_common |
Pure Dart definitions for Protobuf, DTOs, and Transport Interfaces. |
| Simulator | apps/usp_device2_simulator |
Headless USP Agent simulator compliant with TR-181, with built-in Gateway Proxy. |
| Infra | infrastructure/ |
Docker configurations for Mosquitto (MQTT Broker). |
The simulator exposes multiple transport endpoints for USP clients to connect.
[ External USP Client ]
(gRPC / WebSocket / HTTP / MQTT)
|
v
+-------------------------+ +------------------+
| USP Device Simulator | <------> | Mosquitto Broker |
| gRPC: 50051 | MQTT | (Docker: 1883) |
| WS: 8080 | +------------------+
| HTTP: 8081 |
+-------------------------+
For detailed architectural decisions, see ARCHITECTURE.md.
- Dart SDK: Latest Stable (>= 3.8.0)
- Docker: Required for running the infrastructure stack (Mosquitto).
- Protoc: Protocol Buffer Compiler (for regenerating code).
- Melos: Monorepo management tool.
dart pub global activate melosLinks all local packages and installs dependencies.
melos bootstrapEnsure all DTOs and gRPC stubs are up-to-date.
melos run proto:genThis command builds and starts the Mosquitto Broker in the background.
melos run infra:startThis starts the Dart Simulator locally, connecting it to the Docker Broker.
melos run sim:run- gRPC Gateway:
0.0.0.0:50051 - WebSocket:
0.0.0.0:8080 - HTTP MTP:
0.0.0.0:8081 - MQTT: Connected to
localhost:1883
Use melos run <script> to execute these commands.
| Command | Description |
|---|---|
infra:start |
Start Simulator and Mosquitto in background. |
infra:stop |
Stop and remove all infrastructure containers. |
infra:restart |
Restart all containers. |
infra:logs |
Tail logs for all containers. |
infra:logs:tail |
Follow logs stream. |
| Command | Description |
|---|---|
sim:run |
Run Simulator locally with default settings. |
| Command | Description |
|---|---|
verify:grpc |
Run gRPC Client script to verify Client -> Gateway -> Agent flow. |
verify:mqtt |
Run MQTT Client script to verify Pub/Sub lifecycle. |
verify:ws |
Run WebSocket script to verify basic connectivity. |
test:all |
Run unit/widget tests across all packages. |
| Command | Description |
|---|---|
proto:gen |
Regenerate Protobuf Dart code in common package using protoc. |
/ (Root)
├── melos.yaml # Monorepo script definitions
├── infrastructure/ # Docker & Network configs
│ ├── docker-compose.yaml # Orchestrates Simulator and Broker
│ └── mosquitto/config/ # MQTT Broker Config
├── packages/
│ └── usp_protocol_common/ # [Shared Kernel] DTOs, Proto files, Converters
└── apps/
└── usp_device2_simulator/# USP Agent & Gateway logic
├── bin/server.dart # Entry point
└── Dockerfile # Optimized Docker build
- Symptom: Simulator logs show
SocketException: Connection refusedrepeating. - Cause: The MQTT Broker container is not running, or
mosquitto.confis missing. - Fix:
- Ensure the
infrastructure/mosquitto/config/mosquitto.conffile exists. - Run
melos run infra:startto restart containers. - Check logs:
docker logs usp-broker.
- Ensure the
- Symptom: Tests fail with cryptic errors.
- Cause: Usually due to missing Mock Fallbacks or Stubbing in
mocktail. - Fix: Ensure your test's
setUpAllregisters necessary fallbacks (e.g.,registerFallbackValue(FakeStackTrace())).
- Symptom: IDE shows red errors on
import ...pb.dart. - Cause: Protobuf files are not generated or are outdated.
- Fix: Run
melos run proto:gento regenerate all contracts.