Create web directory with test fixtures

- Added new web/ directory for frontend development
- Created fixtures/ subdirectory with JSON test data
- Added samples for all major packet types (text, position, nodeinfo, etc.)
- Added README files with documentation
- Added placeholder package.json

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Daniel Pupius
2025-04-22 10:41:28 -07:00
parent 2d61d369b0
commit c6de28aacb
9 changed files with 360 additions and 0 deletions

58
web/fixtures/README.md Normal file
View File

@@ -0,0 +1,58 @@
# Fixture Data for Testing
This directory contains sample JSON data files that represent different types of Meshtastic packets. These fixtures can be used for testing the web application without requiring a live MQTT connection.
## Available Fixtures
- **text_message.json**: A simple text message sent over the Meshtastic network
- **position.json**: A position update with GPS coordinates
- **nodeinfo.json**: Information about a node in the Meshtastic network
- **telemetry.json**: Device and environmental telemetry data
- **map_report.json**: A report containing multiple nodes and their positions
- **waypoint.json**: A waypoint/point of interest
- **decode_error.json**: An example of a packet that couldn't be properly decoded
## Using the Fixtures
These JSON files match the format that would be received from the server's SSE endpoint, which delivers data in the format:
```
event: message
data: {... JSON payload ...}
```
The fixtures can be used in unit tests, for mocking the API during development, or as examples for documentation.
## Data Structure
Each fixture follows this general pattern:
```json
{
"info": {
"fullTopic": "msh/REGION_PATH/2/e/CHANNELNAME/USERID",
"regionPath": "...",
"version": "2",
"format": "e",
"channel": "...",
"userId": "..."
},
"data": {
"channelId": "...",
"gatewayId": "...",
"id": 1234567890,
"from": 1234567890,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "...",
"portNum": "...",
"...": "...", // Payload-specific fields
"requestId": 0,
"replyId": 0,
"wantResponse": false
}
}
```
The payload fields in `data` depend on the message type, as indicated by the `portNum` field.

View File

@@ -0,0 +1,26 @@
{
"info": {
"fullTopic": "msh/US/bayarea/2/e/LongFast/!ghij7890",
"regionPath": "US/bayarea",
"version": "2",
"format": "e",
"channel": "LongFast",
"userId": "!ghij7890"
},
"data": {
"channelId": "LongFast",
"gatewayId": "!ghij7890",
"id": 7890123456,
"from": 4102453487,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "DEFAULT",
"portNum": "UNKNOWN",
"decodeError": "Failed to decrypt payload: invalid packet format",
"binaryData": "SGVsbG8gV29ybGQh",
"requestId": 0,
"replyId": 0,
"wantResponse": false
}
}

View File

@@ -0,0 +1,79 @@
{
"info": {
"fullTopic": "msh/US/bayarea/2/e/LongFast/!efgh5678",
"regionPath": "US/bayarea",
"version": "2",
"format": "e",
"channel": "LongFast",
"userId": "!efgh5678"
},
"data": {
"channelId": "LongFast",
"gatewayId": "!efgh5678",
"id": 5678901234,
"from": 3893757127,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "DEFAULT",
"portNum": "MAP_REPORT_APP",
"mapReport": {
"nodes": [
{
"num": 3893757127,
"user": {
"id": "!efgh5678",
"longName": "San Jose Base",
"shortName": "SJB",
"hwModel": "TBEAM",
"role": "ROUTER"
},
"position": {
"latitudeI": 372811070,
"longitudeI": -1218522900,
"time": 1745300041
},
"snr": 9.5,
"lastHeard": 1745300041
},
{
"num": 3471856931,
"user": {
"id": "!cdef3456",
"longName": "Cupertino Ridge North",
"shortName": "CRN",
"hwModel": "RAK4631",
"role": "ROUTER"
},
"position": {
"latitudeI": 373066340,
"longitudeI": -1220381680,
"time": 1745300040
},
"snr": 7.2,
"lastHeard": 1745300040
},
{
"num": 2727688952,
"user": {
"id": "!bcde2345",
"longName": "Mountain View Relay",
"shortName": "MVR",
"hwModel": "T_ECHO",
"role": "ROUTER"
},
"position": {
"latitudeI": 373724560,
"longitudeI": -1220465670,
"time": 1745300039
},
"snr": 8.7,
"lastHeard": 1745300039
}
]
},
"requestId": 0,
"replyId": 0,
"wantResponse": false
}
}

View File

@@ -0,0 +1,39 @@
{
"info": {
"fullTopic": "msh/US/bayarea/2/e/LongFast/!cdef3456",
"regionPath": "US/bayarea",
"version": "2",
"format": "e",
"channel": "LongFast",
"userId": "!cdef3456"
},
"data": {
"channelId": "LongFast",
"gatewayId": "!cdef3456",
"id": 3456789012,
"from": 3471856931,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "DEFAULT",
"portNum": "NODEINFO_APP",
"nodeInfo": {
"id": "!cdef3456",
"longName": "Cupertino Ridge North",
"shortName": "CRN",
"macaddr": "01:23:45:67:89:AB",
"hwModel": "RAK4631",
"hasGps": true,
"role": "ROUTER",
"snr": 9,
"batteryLevel": 87,
"voltage": 3.95,
"channelUtilization": 8.5,
"airUtilTx": 1.2,
"lastHeard": 1745300040
},
"requestId": 0,
"replyId": 0,
"wantResponse": true
}
}

View File

@@ -0,0 +1,40 @@
{
"info": {
"fullTopic": "msh/US/bayarea/2/e/LongFast/!bcde2345",
"regionPath": "US/bayarea",
"version": "2",
"format": "e",
"channel": "LongFast",
"userId": "!bcde2345"
},
"data": {
"channelId": "LongFast",
"gatewayId": "!bcde2345",
"id": 2345678901,
"from": 2727688952,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "BACKGROUND",
"portNum": "POSITION_APP",
"position": {
"latitudeI": 373066340,
"longitudeI": -1220381680,
"altitude": 25,
"time": 1745300044,
"locationSource": "LOC_MANUAL",
"timestamp": 1745300044,
"satsInView": 7,
"fixQuality": 2,
"precisionBits": 16,
"hdop": 128,
"pdop": 172,
"groundSpeed": 0,
"groundTrack": 0,
"seqNumber": 1289
},
"requestId": 0,
"replyId": 0,
"wantResponse": false
}
}

View File

@@ -0,0 +1,42 @@
{
"info": {
"fullTopic": "msh/US/bayarea/2/e/LongFast/!defg4567",
"regionPath": "US/bayarea",
"version": "2",
"format": "e",
"channel": "LongFast",
"userId": "!defg4567"
},
"data": {
"channelId": "LongFast",
"gatewayId": "!defg4567",
"id": 4567890123,
"from": 3149439480,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "UNSET",
"portNum": "TELEMETRY_APP",
"telemetry": {
"time": 1745300043,
"deviceMetrics": {
"batteryLevel": 100,
"voltage": 4.19,
"channelUtilization": 13.37,
"airUtilTx": 2.58,
"uptimeSeconds": 771327
},
"environmentMetrics": {
"temperature": 22.5,
"relativeHumidity": 58.2,
"barometricPressure": 101325,
"gasResistance": 250000,
"voltage": 3.3,
"current": 0.01
}
},
"requestId": 0,
"replyId": 0,
"wantResponse": false
}
}

View File

@@ -0,0 +1,25 @@
{
"info": {
"fullTopic": "msh/US/bayarea/2/e/LongFast/!abcd1234",
"regionPath": "US/bayarea",
"version": "2",
"format": "e",
"channel": "LongFast",
"userId": "!abcd1234"
},
"data": {
"channelId": "LongFast",
"gatewayId": "!abcd1234",
"id": 1234567890,
"from": 3663120160,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "DEFAULT",
"portNum": "TEXT_MESSAGE_APP",
"textMessage": "Hello from the Meshtastic network! This is a test message.",
"requestId": 0,
"replyId": 0,
"wantResponse": false
}
}

View File

@@ -0,0 +1,33 @@
{
"info": {
"fullTopic": "msh/US/bayarea/2/e/LongFast/!fghi6789",
"regionPath": "US/bayarea",
"version": "2",
"format": "e",
"channel": "LongFast",
"userId": "!fghi6789"
},
"data": {
"channelId": "LongFast",
"gatewayId": "!fghi6789",
"id": 6789012345,
"from": 3663120160,
"to": 4294967295,
"hopLimit": 3,
"hopStart": 3,
"priority": "RELIABLE",
"portNum": "WAYPOINT_APP",
"waypoint": {
"id": 12345,
"latitudeI": 373724560,
"longitudeI": -1220465670,
"name": "Trailhead Parking",
"description": "Parking area for the Ridge Trail access point",
"icon": 5,
"expire": 0
},
"requestId": 0,
"replyId": 0,
"wantResponse": false
}
}

18
web/package.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "meshstream-web",
"version": "0.1.0",
"description": "Web application for visualizing Meshtastic network data",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "echo \"Error: no start script specified\" && exit 1"
},
"keywords": [
"meshtastic",
"mesh",
"network",
"visualization"
],
"author": "",
"license": "MIT"
}