From c6de28aacb950592dbff597b47d82df7188cb293 Mon Sep 17 00:00:00 2001 From: Daniel Pupius Date: Tue, 22 Apr 2025 10:41:28 -0700 Subject: [PATCH] Create web directory with test fixtures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- web/fixtures/README.md | 58 +++++++++++++++++++++++++ web/fixtures/decode_error.json | 26 +++++++++++ web/fixtures/map_report.json | 79 ++++++++++++++++++++++++++++++++++ web/fixtures/nodeinfo.json | 39 +++++++++++++++++ web/fixtures/position.json | 40 +++++++++++++++++ web/fixtures/telemetry.json | 42 ++++++++++++++++++ web/fixtures/text_message.json | 25 +++++++++++ web/fixtures/waypoint.json | 33 ++++++++++++++ web/package.json | 18 ++++++++ 9 files changed, 360 insertions(+) create mode 100644 web/fixtures/README.md create mode 100644 web/fixtures/decode_error.json create mode 100644 web/fixtures/map_report.json create mode 100644 web/fixtures/nodeinfo.json create mode 100644 web/fixtures/position.json create mode 100644 web/fixtures/telemetry.json create mode 100644 web/fixtures/text_message.json create mode 100644 web/fixtures/waypoint.json create mode 100644 web/package.json diff --git a/web/fixtures/README.md b/web/fixtures/README.md new file mode 100644 index 0000000..37a95e4 --- /dev/null +++ b/web/fixtures/README.md @@ -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. \ No newline at end of file diff --git a/web/fixtures/decode_error.json b/web/fixtures/decode_error.json new file mode 100644 index 0000000..ff62422 --- /dev/null +++ b/web/fixtures/decode_error.json @@ -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 + } +} \ No newline at end of file diff --git a/web/fixtures/map_report.json b/web/fixtures/map_report.json new file mode 100644 index 0000000..8b0b4ca --- /dev/null +++ b/web/fixtures/map_report.json @@ -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 + } +} \ No newline at end of file diff --git a/web/fixtures/nodeinfo.json b/web/fixtures/nodeinfo.json new file mode 100644 index 0000000..99e1807 --- /dev/null +++ b/web/fixtures/nodeinfo.json @@ -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 + } +} \ No newline at end of file diff --git a/web/fixtures/position.json b/web/fixtures/position.json new file mode 100644 index 0000000..05b313e --- /dev/null +++ b/web/fixtures/position.json @@ -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 + } +} \ No newline at end of file diff --git a/web/fixtures/telemetry.json b/web/fixtures/telemetry.json new file mode 100644 index 0000000..1cb8095 --- /dev/null +++ b/web/fixtures/telemetry.json @@ -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 + } +} \ No newline at end of file diff --git a/web/fixtures/text_message.json b/web/fixtures/text_message.json new file mode 100644 index 0000000..ee054cd --- /dev/null +++ b/web/fixtures/text_message.json @@ -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 + } +} \ No newline at end of file diff --git a/web/fixtures/waypoint.json b/web/fixtures/waypoint.json new file mode 100644 index 0000000..ece48ad --- /dev/null +++ b/web/fixtures/waypoint.json @@ -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 + } +} \ No newline at end of file diff --git a/web/package.json b/web/package.json new file mode 100644 index 0000000..6325419 --- /dev/null +++ b/web/package.json @@ -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" +} \ No newline at end of file