Compare commits
26 Commits
913406d1b9
...
improvemen
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a55bd056f | |||
| 702da27468 | |||
| 8e99669487 | |||
| 63b823a7a1 | |||
| 600ed7bbb3 | |||
| 82adde997e | |||
| 5ec119b6c4 | |||
| 629825b53d | |||
| 18df989fc6 | |||
| e694ffa66a | |||
| da99bfdeef | |||
| b2a9488efd | |||
| 6b7149905a | |||
| 8497053aed | |||
| bfdd6cba22 | |||
| 6554d270bc | |||
| bcaa1f2c20 | |||
| 0a7e456173 | |||
| d50fe75759 | |||
| d963520486 | |||
| e025140ab4 | |||
| e8095fce81 | |||
| af5690e524 | |||
| 33726de0cb | |||
| 7b3e6e4fd1 | |||
| 0456f8a7b3 |
@ -3,8 +3,6 @@ node_modules
|
|||||||
*/prisma
|
*/prisma
|
||||||
!common/prisma
|
!common/prisma
|
||||||
*/node_modules
|
*/node_modules
|
||||||
*/protos
|
|
||||||
!common/protos
|
|
||||||
*/Dockerfile
|
*/Dockerfile
|
||||||
*/.dockerignore
|
*/.dockerignore
|
||||||
webapp/frontend/node_modules
|
webapp/frontend/node_modules
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
name: Build Docker containers
|
name: Build Docker containers
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
Build:
|
||||||
@ -13,11 +16,11 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Build web app image
|
- name: Build web app image
|
||||||
run: docker build -f webapp/Dockerfile -t git.arinity.org/ctmesh/map:latest .
|
run: docker build --no-cache -f webapp/Dockerfile -t git.arinity.org/ctmesh/map:latest .
|
||||||
- name: Build mqtt listener image
|
- name: Build mqtt listener image
|
||||||
run: docker build -f mqtt/Dockerfile -t git.arinity.org/ctmesh/map-mqtt:latest .
|
run: docker build --no-cache -f mqtt/Dockerfile -t git.arinity.org/ctmesh/map-mqtt:latest .
|
||||||
- name: Build cli image
|
- name: Build cli image
|
||||||
run: docker build -f cli/Dockerfile -t git.arinity.org/ctmesh/map-cli:latest .
|
run: docker build --no-cache -f cli/Dockerfile -t git.arinity.org/ctmesh/map-cli:latest .
|
||||||
- name: Push images
|
- name: Push images
|
||||||
run: |
|
run: |
|
||||||
docker push git.arinity.org/ctmesh/map:latest
|
docker push git.arinity.org/ctmesh/map:latest
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,8 +1,6 @@
|
|||||||
.idea/
|
.idea/
|
||||||
node_modules
|
node_modules
|
||||||
*/prisma
|
*/prisma
|
||||||
*/proto
|
|
||||||
*/protos
|
|
||||||
*/dist
|
*/dist
|
||||||
# Keep environment variables out of version control
|
# Keep environment variables out of version control
|
||||||
.env
|
.env
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
*AdminMessage.payload_variant anonymous_oneof:true
|
|
||||||
|
|
||||||
*AdminMessage.set_canned_message_module_messages max_size:201
|
|
||||||
*AdminMessage.get_canned_message_module_messages_response max_size:201
|
|
||||||
*AdminMessage.delete_file_request max_size:201
|
|
||||||
|
|
||||||
*AdminMessage.set_ringtone_message max_size:231
|
|
||||||
*AdminMessage.get_ringtone_response max_size:231
|
|
||||||
|
|
||||||
*HamParameters.call_sign max_size:8
|
|
||||||
*HamParameters.short_name max_size:6
|
|
||||||
*NodeRemoteHardwarePinsResponse.node_remote_hardware_pins max_count:16
|
|
||||||
@ -1,364 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
import "meshtastic/channel.proto";
|
|
||||||
import "meshtastic/config.proto";
|
|
||||||
import "meshtastic/connection_status.proto";
|
|
||||||
import "meshtastic/deviceonly.proto";
|
|
||||||
import "meshtastic/mesh.proto";
|
|
||||||
import "meshtastic/module_config.proto";
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "AdminProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
|
|
||||||
* This message is used to do settings operations to both remote AND local nodes.
|
|
||||||
* (Prior to 1.2 these operations were done via special ToRadio operations)
|
|
||||||
*/
|
|
||||||
message AdminMessage {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
enum ConfigType {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
DEVICE_CONFIG = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
POSITION_CONFIG = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
POWER_CONFIG = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
NETWORK_CONFIG = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
DISPLAY_CONFIG = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
LORA_CONFIG = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
BLUETOOTH_CONFIG = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
enum ModuleConfigType {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
MQTT_CONFIG = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
SERIAL_CONFIG = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
EXTNOTIF_CONFIG = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
STOREFORWARD_CONFIG = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
RANGETEST_CONFIG = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
TELEMETRY_CONFIG = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
CANNEDMSG_CONFIG = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
AUDIO_CONFIG = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
REMOTEHARDWARE_CONFIG = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
NEIGHBORINFO_CONFIG = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
AMBIENTLIGHTING_CONFIG = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
DETECTIONSENSOR_CONFIG = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
PAXCOUNTER_CONFIG = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
oneof payload_variant {
|
|
||||||
/*
|
|
||||||
* Send the specified channel in the response to this message
|
|
||||||
* NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present)
|
|
||||||
*/
|
|
||||||
uint32 get_channel_request = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
Channel get_channel_response = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send the current owner data in the response to this message.
|
|
||||||
*/
|
|
||||||
bool get_owner_request = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
User get_owner_response = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ask for the following config data to be sent
|
|
||||||
*/
|
|
||||||
ConfigType get_config_request = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send the current Config in the response to this message.
|
|
||||||
*/
|
|
||||||
Config get_config_response = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ask for the following config data to be sent
|
|
||||||
*/
|
|
||||||
ModuleConfigType get_module_config_request = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send the current Config in the response to this message.
|
|
||||||
*/
|
|
||||||
ModuleConfig get_module_config_response = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the Canned Message Module messages in the response to this message.
|
|
||||||
*/
|
|
||||||
bool get_canned_message_module_messages_request = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the Canned Message Module messages in the response to this message.
|
|
||||||
*/
|
|
||||||
string get_canned_message_module_messages_response = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Request the node to send device metadata (firmware, protobuf version, etc)
|
|
||||||
*/
|
|
||||||
bool get_device_metadata_request = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Device metadata response
|
|
||||||
*/
|
|
||||||
DeviceMetadata get_device_metadata_response = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the Ringtone in the response to this message.
|
|
||||||
*/
|
|
||||||
bool get_ringtone_request = 14;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the Ringtone in the response to this message.
|
|
||||||
*/
|
|
||||||
string get_ringtone_response = 15;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Request the node to send it's connection status
|
|
||||||
*/
|
|
||||||
bool get_device_connection_status_request = 16;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Device connection status response
|
|
||||||
*/
|
|
||||||
DeviceConnectionStatus get_device_connection_status_response = 17;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Setup a node for licensed amateur (ham) radio operation
|
|
||||||
*/
|
|
||||||
HamParameters set_ham_mode = 18;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the mesh's nodes with their available gpio pins for RemoteHardware module use
|
|
||||||
*/
|
|
||||||
bool get_node_remote_hardware_pins_request = 19;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Respond with the mesh's nodes with their available gpio pins for RemoteHardware module use
|
|
||||||
*/
|
|
||||||
NodeRemoteHardwarePinsResponse get_node_remote_hardware_pins_response = 20;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enter (UF2) DFU mode
|
|
||||||
* Only implemented on NRF52 currently
|
|
||||||
*/
|
|
||||||
bool enter_dfu_mode_request = 21;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Delete the file by the specified path from the device
|
|
||||||
*/
|
|
||||||
string delete_file_request = 22;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the owner for this node
|
|
||||||
*/
|
|
||||||
User set_owner = 32;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set channels (using the new API).
|
|
||||||
* A special channel is the "primary channel".
|
|
||||||
* The other records are secondary channels.
|
|
||||||
* Note: only one channel can be marked as primary.
|
|
||||||
* If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically.
|
|
||||||
*/
|
|
||||||
Channel set_channel = 33;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the current Config
|
|
||||||
*/
|
|
||||||
Config set_config = 34;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the current Config
|
|
||||||
*/
|
|
||||||
ModuleConfig set_module_config = 35;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the Canned Message Module messages text.
|
|
||||||
*/
|
|
||||||
string set_canned_message_module_messages = 36;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the ringtone for ExternalNotification.
|
|
||||||
*/
|
|
||||||
string set_ringtone_message = 37;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove the node by the specified node-num from the NodeDB on the device
|
|
||||||
*/
|
|
||||||
uint32 remove_by_nodenum = 38;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Begins an edit transaction for config, module config, owner, and channel settings changes
|
|
||||||
* This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings)
|
|
||||||
*/
|
|
||||||
bool begin_edit_settings = 64;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Commits an open transaction for any edits made to config, module config, owner, and channel settings
|
|
||||||
*/
|
|
||||||
bool commit_edit_settings = 65;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot)
|
|
||||||
* Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth.
|
|
||||||
*/
|
|
||||||
int32 reboot_ota_seconds = 95;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This message is only supported for the simulator Portduino build.
|
|
||||||
* If received the simulator will exit successfully.
|
|
||||||
*/
|
|
||||||
bool exit_simulator = 96;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell the node to reboot in this many seconds (or <0 to cancel reboot)
|
|
||||||
*/
|
|
||||||
int32 reboot_seconds = 97;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell the node to shutdown in this many seconds (or <0 to cancel shutdown)
|
|
||||||
*/
|
|
||||||
int32 shutdown_seconds = 98;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell the node to factory reset, all device settings will be returned to factory defaults.
|
|
||||||
*/
|
|
||||||
int32 factory_reset = 99;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell the node to reset the nodedb.
|
|
||||||
*/
|
|
||||||
int32 nodedb_reset = 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parameters for setting up Meshtastic for ameteur radio usage
|
|
||||||
*/
|
|
||||||
message HamParameters {
|
|
||||||
/*
|
|
||||||
* Amateur radio call sign, eg. KD2ABC
|
|
||||||
*/
|
|
||||||
string call_sign = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Transmit power in dBm at the LoRA transceiver, not including any amplification
|
|
||||||
*/
|
|
||||||
int32 tx_power = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The selected frequency of LoRA operation
|
|
||||||
* Please respect your local laws, regulations, and band plans.
|
|
||||||
* Ensure your radio is capable of operating of the selected frequency before setting this.
|
|
||||||
*/
|
|
||||||
float frequency = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Optional short name of user
|
|
||||||
*/
|
|
||||||
string short_name = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Response envelope for node_remote_hardware_pins
|
|
||||||
*/
|
|
||||||
message NodeRemoteHardwarePinsResponse {
|
|
||||||
/*
|
|
||||||
* Nodes and their respective remote hardware GPIO pins
|
|
||||||
*/
|
|
||||||
repeated NodeRemoteHardwarePin node_remote_hardware_pins = 1;
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*ChannelSet.settings max_count:8
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
import "meshtastic/channel.proto";
|
|
||||||
import "meshtastic/config.proto";
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "AppOnlyProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the most compact possible representation for a set of channels.
|
|
||||||
* It includes only one PRIMARY channel (which must be first) and
|
|
||||||
* any SECONDARY channels.
|
|
||||||
* No DISABLED channels are included.
|
|
||||||
* This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL
|
|
||||||
*/
|
|
||||||
message ChannelSet {
|
|
||||||
/*
|
|
||||||
* Channel list with settings
|
|
||||||
*/
|
|
||||||
repeated ChannelSettings settings = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LoRa config
|
|
||||||
*/
|
|
||||||
Config.LoRaConfig lora_config = 2;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
*Contact.callsign max_size:120
|
|
||||||
*Contact.device_callsign max_size:120
|
|
||||||
*Status.battery int_size:8
|
|
||||||
*PLI.course int_size:16
|
|
||||||
*GeoChat.message max_size:200
|
|
||||||
*GeoChat.to max_size:120
|
|
||||||
@ -1,251 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "ATAKProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
/*
|
|
||||||
* Packets for the official ATAK Plugin
|
|
||||||
*/
|
|
||||||
message TAKPacket
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Are the payloads strings compressed for LoRA transport?
|
|
||||||
*/
|
|
||||||
bool is_compressed = 1;
|
|
||||||
/*
|
|
||||||
* The contact / callsign for ATAK user
|
|
||||||
*/
|
|
||||||
Contact contact = 2;
|
|
||||||
/*
|
|
||||||
* The group for ATAK user
|
|
||||||
*/
|
|
||||||
Group group = 3;
|
|
||||||
/*
|
|
||||||
* The status of the ATAK EUD
|
|
||||||
*/
|
|
||||||
Status status = 4;
|
|
||||||
/*
|
|
||||||
* The payload of the packet
|
|
||||||
*/
|
|
||||||
oneof payload_variant {
|
|
||||||
/*
|
|
||||||
* TAK position report
|
|
||||||
*/
|
|
||||||
PLI pli = 5;
|
|
||||||
/*
|
|
||||||
* ATAK GeoChat message
|
|
||||||
*/
|
|
||||||
GeoChat chat = 6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ATAK GeoChat message
|
|
||||||
*/
|
|
||||||
message GeoChat {
|
|
||||||
/*
|
|
||||||
* The text message
|
|
||||||
*/
|
|
||||||
string message = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Uid recipient of the message
|
|
||||||
*/
|
|
||||||
optional string to = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ATAK Group
|
|
||||||
* <__group role='Team Member' name='Cyan'/>
|
|
||||||
*/
|
|
||||||
message Group {
|
|
||||||
/*
|
|
||||||
* Role of the group member
|
|
||||||
*/
|
|
||||||
MemberRole role = 1;
|
|
||||||
/*
|
|
||||||
* Team (color)
|
|
||||||
* Default Cyan
|
|
||||||
*/
|
|
||||||
Team team = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Team {
|
|
||||||
/*
|
|
||||||
* Unspecifed
|
|
||||||
*/
|
|
||||||
Unspecifed_Color = 0;
|
|
||||||
/*
|
|
||||||
* White
|
|
||||||
*/
|
|
||||||
White = 1;
|
|
||||||
/*
|
|
||||||
* Yellow
|
|
||||||
*/
|
|
||||||
Yellow = 2;
|
|
||||||
/*
|
|
||||||
* Orange
|
|
||||||
*/
|
|
||||||
Orange = 3;
|
|
||||||
/*
|
|
||||||
* Magenta
|
|
||||||
*/
|
|
||||||
Magenta = 4;
|
|
||||||
/*
|
|
||||||
* Red
|
|
||||||
*/
|
|
||||||
Red = 5;
|
|
||||||
/*
|
|
||||||
* Maroon
|
|
||||||
*/
|
|
||||||
Maroon = 6;
|
|
||||||
/*
|
|
||||||
* Purple
|
|
||||||
*/
|
|
||||||
Purple = 7;
|
|
||||||
/*
|
|
||||||
* Dark Blue
|
|
||||||
*/
|
|
||||||
Dark_Blue = 8;
|
|
||||||
/*
|
|
||||||
* Blue
|
|
||||||
*/
|
|
||||||
Blue = 9;
|
|
||||||
/*
|
|
||||||
* Cyan
|
|
||||||
*/
|
|
||||||
Cyan = 10;
|
|
||||||
/*
|
|
||||||
* Teal
|
|
||||||
*/
|
|
||||||
Teal = 11;
|
|
||||||
/*
|
|
||||||
* Green
|
|
||||||
*/
|
|
||||||
Green = 12;
|
|
||||||
/*
|
|
||||||
* Dark Green
|
|
||||||
*/
|
|
||||||
Dark_Green = 13;
|
|
||||||
/*
|
|
||||||
* Brown
|
|
||||||
*/
|
|
||||||
Brown = 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Role of the group member
|
|
||||||
*/
|
|
||||||
enum MemberRole {
|
|
||||||
/*
|
|
||||||
* Unspecifed
|
|
||||||
*/
|
|
||||||
Unspecifed = 0;
|
|
||||||
/*
|
|
||||||
* Team Member
|
|
||||||
*/
|
|
||||||
TeamMember = 1;
|
|
||||||
/*
|
|
||||||
* Team Lead
|
|
||||||
*/
|
|
||||||
TeamLead = 2;
|
|
||||||
/*
|
|
||||||
* Headquarters
|
|
||||||
*/
|
|
||||||
HQ = 3;
|
|
||||||
/*
|
|
||||||
* Airsoft enthusiast
|
|
||||||
*/
|
|
||||||
Sniper = 4;
|
|
||||||
/*
|
|
||||||
* Medic
|
|
||||||
*/
|
|
||||||
Medic = 5;
|
|
||||||
/*
|
|
||||||
* ForwardObserver
|
|
||||||
*/
|
|
||||||
ForwardObserver = 6;
|
|
||||||
/*
|
|
||||||
* Radio Telephone Operator
|
|
||||||
*/
|
|
||||||
RTO = 7;
|
|
||||||
/*
|
|
||||||
* Doggo
|
|
||||||
*/
|
|
||||||
K9 = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ATAK EUD Status
|
|
||||||
* <status battery='100' />
|
|
||||||
*/
|
|
||||||
message Status {
|
|
||||||
/*
|
|
||||||
* Battery level
|
|
||||||
*/
|
|
||||||
uint32 battery = 1;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* ATAK Contact
|
|
||||||
* <contact endpoint='0.0.0.0:4242:tcp' phone='+12345678' callsign='FALKE'/>
|
|
||||||
*/
|
|
||||||
message Contact {
|
|
||||||
/*
|
|
||||||
* Callsign
|
|
||||||
*/
|
|
||||||
string callsign = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Device callsign
|
|
||||||
*/
|
|
||||||
string device_callsign = 2;
|
|
||||||
/*
|
|
||||||
* IP address of endpoint in integer form (0.0.0.0 default)
|
|
||||||
*/
|
|
||||||
// fixed32 enpoint_address = 3;
|
|
||||||
/*
|
|
||||||
* Port of endpoint (4242 default)
|
|
||||||
*/
|
|
||||||
// uint32 endpoint_port = 4;
|
|
||||||
/*
|
|
||||||
* Phone represented as integer
|
|
||||||
* Terrible practice, but we really need the wire savings
|
|
||||||
*/
|
|
||||||
// uint32 phone = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Position Location Information from ATAK
|
|
||||||
*/
|
|
||||||
message PLI {
|
|
||||||
/*
|
|
||||||
* The new preferred location encoding, multiply by 1e-7 to get degrees
|
|
||||||
* in floating point
|
|
||||||
*/
|
|
||||||
sfixed32 latitude_i = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new preferred location encoding, multiply by 1e-7 to get degrees
|
|
||||||
* in floating point
|
|
||||||
*/
|
|
||||||
sfixed32 longitude_i = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Altitude (ATAK prefers HAE)
|
|
||||||
*/
|
|
||||||
int32 altitude = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Speed
|
|
||||||
*/
|
|
||||||
uint32 speed = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Course in degrees
|
|
||||||
*/
|
|
||||||
uint32 course = 5;
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*CannedMessageModuleConfig.messages max_size:201
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "CannedMessageConfigProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Canned message module configuration.
|
|
||||||
*/
|
|
||||||
message CannedMessageModuleConfig {
|
|
||||||
/*
|
|
||||||
* Predefined messages for canned message module separated by '|' characters.
|
|
||||||
*/
|
|
||||||
string messages = 1;
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
*Channel.index int_size:8
|
|
||||||
|
|
||||||
# 256 bit or 128 bit psk key
|
|
||||||
*ChannelSettings.psk max_size:32
|
|
||||||
*ChannelSettings.name max_size:12
|
|
||||||
@ -1,150 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "ChannelProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This information can be encoded as a QRcode/url so that other users can configure
|
|
||||||
* their radio to join the same channel.
|
|
||||||
* A note about how channel names are shown to users: channelname-X
|
|
||||||
* poundsymbol is a prefix used to indicate this is a channel name (idea from @professr).
|
|
||||||
* Where X is a letter from A-Z (base 26) representing a hash of the PSK for this
|
|
||||||
* channel - so that if the user changes anything about the channel (which does
|
|
||||||
* force a new PSK) this letter will also change. Thus preventing user confusion if
|
|
||||||
* two friends try to type in a channel name of "BobsChan" and then can't talk
|
|
||||||
* because their PSKs will be different.
|
|
||||||
* The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26"
|
|
||||||
* This also allows the option of someday if people have the PSK off (zero), the
|
|
||||||
* users COULD type in a channel name and be able to talk.
|
|
||||||
* FIXME: Add description of multi-channel support and how primary vs secondary channels are used.
|
|
||||||
* FIXME: explain how apps use channels for security.
|
|
||||||
* explain how remote settings and remote gpio are managed as an example
|
|
||||||
*/
|
|
||||||
message ChannelSettings {
|
|
||||||
/*
|
|
||||||
* Deprecated in favor of LoraConfig.channel_num
|
|
||||||
*/
|
|
||||||
uint32 channel_num = 1 [deprecated = true];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A simple pre-shared key for now for crypto.
|
|
||||||
* Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256).
|
|
||||||
* A special shorthand is used for 1 byte long psks.
|
|
||||||
* These psks should be treated as only minimally secure,
|
|
||||||
* because they are listed in this source code.
|
|
||||||
* Those bytes are mapped using the following scheme:
|
|
||||||
* `0` = No crypto
|
|
||||||
* `1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0x01}
|
|
||||||
* `2` through 10 = The default channel key, except with 1 through 9 added to the last byte.
|
|
||||||
* Shown to user as simple1 through 10
|
|
||||||
*/
|
|
||||||
bytes psk = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A SHORT name that will be packed into the URL.
|
|
||||||
* Less than 12 bytes.
|
|
||||||
* Something for end users to call the channel
|
|
||||||
* If this is the empty string it is assumed that this channel
|
|
||||||
* is the special (minimally secure) "Default"channel.
|
|
||||||
* In user interfaces it should be rendered as a local language translation of "X".
|
|
||||||
* For channel_num hashing empty string will be treated as "X".
|
|
||||||
* Where "X" is selected based on the English words listed above for ModemPreset
|
|
||||||
*/
|
|
||||||
string name = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Used to construct a globally unique channel ID.
|
|
||||||
* The full globally unique ID will be: "name.id" where ID is shown as base36.
|
|
||||||
* Assuming that the number of meshtastic users is below 20K (true for a long time)
|
|
||||||
* the chance of this 64 bit random number colliding with anyone else is super low.
|
|
||||||
* And the penalty for collision is low as well, it just means that anyone trying to decrypt channel messages might need to
|
|
||||||
* try multiple candidate channels.
|
|
||||||
* Any time a non wire compatible change is made to a channel, this field should be regenerated.
|
|
||||||
* There are a small number of 'special' globally known (and fairly) insecure standard channels.
|
|
||||||
* Those channels do not have a numeric id included in the settings, but instead it is pulled from
|
|
||||||
* a table of well known IDs.
|
|
||||||
* (see Well Known Channels FIXME)
|
|
||||||
*/
|
|
||||||
fixed32 id = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe
|
|
||||||
*/
|
|
||||||
bool uplink_enabled = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, messages seen on the internet will be forwarded to the local mesh.
|
|
||||||
*/
|
|
||||||
bool downlink_enabled = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Per-channel module settings.
|
|
||||||
*/
|
|
||||||
ModuleSettings module_settings = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This message is specifically for modules to store per-channel configuration data.
|
|
||||||
*/
|
|
||||||
message ModuleSettings {
|
|
||||||
/*
|
|
||||||
* Bits of precision for the location sent in position packets.
|
|
||||||
*/
|
|
||||||
uint32 position_precision = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A pair of a channel number, mode and the (sharable) settings for that channel
|
|
||||||
*/
|
|
||||||
message Channel {
|
|
||||||
/*
|
|
||||||
* How this channel is being used (or not).
|
|
||||||
* Note: this field is an enum to give us options for the future.
|
|
||||||
* In particular, someday we might make a 'SCANNING' option.
|
|
||||||
* SCANNING channels could have different frequencies and the radio would
|
|
||||||
* occasionally check that freq to see if anything is being transmitted.
|
|
||||||
* For devices that have multiple physical radios attached, we could keep multiple PRIMARY/SCANNING channels active at once to allow
|
|
||||||
* cross band routing as needed.
|
|
||||||
* If a device has only a single radio (the common case) only one channel can be PRIMARY at a time
|
|
||||||
* (but any number of SECONDARY channels can't be sent received on that common frequency)
|
|
||||||
*/
|
|
||||||
enum Role {
|
|
||||||
/*
|
|
||||||
* This channel is not in use right now
|
|
||||||
*/
|
|
||||||
DISABLED = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This channel is used to set the frequency for the radio - all other enabled channels must be SECONDARY
|
|
||||||
*/
|
|
||||||
PRIMARY = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Secondary channels are only used for encryption/decryption/authentication purposes.
|
|
||||||
* Their radio settings (freq etc) are ignored, only psk is used.
|
|
||||||
*/
|
|
||||||
SECONDARY = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1)
|
|
||||||
* (Someday - not currently implemented) An index of -1 could be used to mean "set by name",
|
|
||||||
* in which case the target node will find and set the channel by settings.name.
|
|
||||||
*/
|
|
||||||
int32 index = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new settings, or NULL to disable that channel
|
|
||||||
*/
|
|
||||||
ChannelSettings settings = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
Role role = 3;
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
*DeviceProfile.long_name max_size:40
|
|
||||||
*DeviceProfile.short_name max_size:5
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
import "meshtastic/localonly.proto";
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "ClientOnlyProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This abstraction is used to contain any configuration for provisioning a node on any client.
|
|
||||||
* It is useful for importing and exporting configurations.
|
|
||||||
*/
|
|
||||||
message DeviceProfile {
|
|
||||||
/*
|
|
||||||
* Long name for the node
|
|
||||||
*/
|
|
||||||
optional string long_name = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Short name of the node
|
|
||||||
*/
|
|
||||||
optional string short_name = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The url of the channels from our node
|
|
||||||
*/
|
|
||||||
optional string channel_url = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The Config of the node
|
|
||||||
*/
|
|
||||||
optional LocalConfig config = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The ModuleConfig of the node
|
|
||||||
*/
|
|
||||||
optional LocalModuleConfig module_config = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A heartbeat message is sent by a node to indicate that it is still alive.
|
|
||||||
* This is currently only needed to keep serial connections alive.
|
|
||||||
*/
|
|
||||||
message Heartbeat {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
*NetworkConfig.wifi_ssid max_size:33
|
|
||||||
*NetworkConfig.wifi_psk max_size:65
|
|
||||||
*NetworkConfig.ntp_server max_size:33
|
|
||||||
*NetworkConfig.rsyslog_server max_size:33
|
|
||||||
|
|
||||||
# Max of three ignored nodes for our testing
|
|
||||||
*LoRaConfig.ignore_incoming max_count:3
|
|
||||||
|
|
||||||
*LoRaConfig.tx_power int_size:8
|
|
||||||
*LoRaConfig.bandwidth int_size:16
|
|
||||||
*LoRaConfig.coding_rate int_size:8
|
|
||||||
*LoRaConfig.channel_num int_size:16
|
|
||||||
|
|
||||||
*PowerConfig.device_battery_ina_address int_size:8
|
|
||||||
@ -1,986 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "ConfigProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
message Config {
|
|
||||||
/*
|
|
||||||
* Configuration
|
|
||||||
*/
|
|
||||||
message DeviceConfig {
|
|
||||||
/*
|
|
||||||
* Defines the device's role on the Mesh network
|
|
||||||
*/
|
|
||||||
enum Role {
|
|
||||||
/*
|
|
||||||
* Description: App connected or stand alone messaging device.
|
|
||||||
* Technical Details: Default Role
|
|
||||||
*/
|
|
||||||
CLIENT = 0;
|
|
||||||
/*
|
|
||||||
* Description: Device that does not forward packets from other devices.
|
|
||||||
*/
|
|
||||||
CLIENT_MUTE = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Infrastructure node for extending network coverage by relaying messages. Visible in Nodes list.
|
|
||||||
* Technical Details: Mesh packets will prefer to be routed over this node. This node will not be used by client apps.
|
|
||||||
* The wifi radio and the oled screen will be put to sleep.
|
|
||||||
* This mode may still potentially have higher power usage due to it's preference in message rebroadcasting on the mesh.
|
|
||||||
*/
|
|
||||||
ROUTER = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Combination of both ROUTER and CLIENT. Not for mobile devices.
|
|
||||||
*/
|
|
||||||
ROUTER_CLIENT = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Infrastructure node for extending network coverage by relaying messages with minimal overhead. Not visible in Nodes list.
|
|
||||||
* Technical Details: Mesh packets will simply be rebroadcasted over this node. Nodes configured with this role will not originate NodeInfo, Position, Telemetry
|
|
||||||
* or any other packet type. They will simply rebroadcast any mesh packets on the same frequency, channel num, spread factor, and coding rate.
|
|
||||||
*/
|
|
||||||
REPEATER = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Broadcasts GPS position packets as priority.
|
|
||||||
* Technical Details: Position Mesh packets will be prioritized higher and sent more frequently by default.
|
|
||||||
* When used in conjunction with power.is_power_saving = true, nodes will wake up,
|
|
||||||
* send position, and then sleep for position.position_broadcast_secs seconds.
|
|
||||||
*/
|
|
||||||
TRACKER = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Broadcasts telemetry packets as priority.
|
|
||||||
* Technical Details: Telemetry Mesh packets will be prioritized higher and sent more frequently by default.
|
|
||||||
* When used in conjunction with power.is_power_saving = true, nodes will wake up,
|
|
||||||
* send environment telemetry, and then sleep for telemetry.environment_update_interval seconds.
|
|
||||||
*/
|
|
||||||
SENSOR = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Optimized for ATAK system communication and reduces routine broadcasts.
|
|
||||||
* Technical Details: Used for nodes dedicated for connection to an ATAK EUD.
|
|
||||||
* Turns off many of the routine broadcasts to favor CoT packet stream
|
|
||||||
* from the Meshtastic ATAK plugin -> IMeshService -> Node
|
|
||||||
*/
|
|
||||||
TAK = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Device that only broadcasts as needed for stealth or power savings.
|
|
||||||
* Technical Details: Used for nodes that "only speak when spoken to"
|
|
||||||
* Turns all of the routine broadcasts but allows for ad-hoc communication
|
|
||||||
* Still rebroadcasts, but with local only rebroadcast mode (known meshes only)
|
|
||||||
* Can be used for clandestine operation or to dramatically reduce airtime / power consumption
|
|
||||||
*/
|
|
||||||
CLIENT_HIDDEN = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Broadcasts location as message to default channel regularly for to assist with device recovery.
|
|
||||||
* Technical Details: Used to automatically send a text message to the mesh
|
|
||||||
* with the current position of the device on a frequent interval:
|
|
||||||
* "I'm lost! Position: lat / long"
|
|
||||||
*/
|
|
||||||
LOST_AND_FOUND = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Enables automatic TAK PLI broadcasts and reduces routine broadcasts.
|
|
||||||
* Technical Details: Turns off many of the routine broadcasts to favor ATAK CoT packet stream
|
|
||||||
* and automatic TAK PLI (position location information) broadcasts.
|
|
||||||
* Uses position module configuration to determine TAK PLI broadcast interval.
|
|
||||||
*/
|
|
||||||
TAK_TRACKER = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Description: Will always rebroadcast packets, but will do so after all other modes.
|
|
||||||
* Technical Details: Used for router nodes that are intended to provide additional coverage
|
|
||||||
* in areas not already covered by other routers, or to bridge around problematic terrain,
|
|
||||||
* but should not be given priority over other routers in order to avoid unnecessaraily
|
|
||||||
* consuming hops.
|
|
||||||
*/
|
|
||||||
ROUTER_LATE = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Defines the device's behavior for how messages are rebroadcast
|
|
||||||
*/
|
|
||||||
enum RebroadcastMode {
|
|
||||||
/*
|
|
||||||
* Default behavior.
|
|
||||||
* Rebroadcast any observed message, if it was on our private channel or from another mesh with the same lora params.
|
|
||||||
*/
|
|
||||||
ALL = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Same as behavior as ALL but skips packet decoding and simply rebroadcasts them.
|
|
||||||
* Only available in Repeater role. Setting this on any other roles will result in ALL behavior.
|
|
||||||
*/
|
|
||||||
ALL_SKIP_DECODING = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ignores observed messages from foreign meshes that are open or those which it cannot decrypt.
|
|
||||||
* Only rebroadcasts message on the nodes local primary / secondary channels.
|
|
||||||
*/
|
|
||||||
LOCAL_ONLY = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ignores observed messages from foreign meshes like LOCAL_ONLY,
|
|
||||||
* but takes it step further by also ignoring messages from nodenums not in the node's known list (NodeDB)
|
|
||||||
*/
|
|
||||||
KNOWN_ONLY = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the role of node
|
|
||||||
*/
|
|
||||||
Role role = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disabling this will disable the SerialConsole by not initilizing the StreamAPI
|
|
||||||
*/
|
|
||||||
bool serial_enabled = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* By default we turn off logging as soon as an API client connects (to keep shared serial link quiet).
|
|
||||||
* Set this to true to leave the debug log outputting even when API is active.
|
|
||||||
*/
|
|
||||||
bool debug_log_enabled = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For boards without a hard wired button, this is the pin number that will be used
|
|
||||||
* Boards that have more than one button can swap the function with this one. defaults to BUTTON_PIN if defined.
|
|
||||||
*/
|
|
||||||
uint32 button_gpio = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For boards without a PWM buzzer, this is the pin number that will be used
|
|
||||||
* Defaults to PIN_BUZZER if defined.
|
|
||||||
*/
|
|
||||||
uint32 buzzer_gpio = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the role of node
|
|
||||||
*/
|
|
||||||
RebroadcastMode rebroadcast_mode = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send our nodeinfo this often
|
|
||||||
* Defaults to 900 Seconds (15 minutes)
|
|
||||||
*/
|
|
||||||
uint32 node_info_broadcast_secs = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Treat double tap interrupt on supported accelerometers as a button press if set to true
|
|
||||||
*/
|
|
||||||
bool double_tap_as_button_press = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, device is considered to be "managed" by a mesh administrator
|
|
||||||
* Clients should then limit available configuration and administrative options inside the user interface
|
|
||||||
*/
|
|
||||||
bool is_managed = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disables the triple-press of user button to enable or disable GPS
|
|
||||||
*/
|
|
||||||
bool disable_triple_click = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Position Config
|
|
||||||
*/
|
|
||||||
message PositionConfig {
|
|
||||||
/*
|
|
||||||
* Bit field of boolean configuration options, indicating which optional
|
|
||||||
* fields to include when assembling POSITION messages.
|
|
||||||
* Longitude, latitude, altitude, speed, heading, and DOP
|
|
||||||
* are always included (also time if GPS-synced)
|
|
||||||
* NOTE: the more fields are included, the larger the message will be -
|
|
||||||
* leading to longer airtime and a higher risk of packet loss
|
|
||||||
*/
|
|
||||||
enum PositionFlags {
|
|
||||||
/*
|
|
||||||
* Required for compilation
|
|
||||||
*/
|
|
||||||
UNSET = 0x0000;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include an altitude value (if available)
|
|
||||||
*/
|
|
||||||
ALTITUDE = 0x0001;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Altitude value is MSL
|
|
||||||
*/
|
|
||||||
ALTITUDE_MSL = 0x0002;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include geoidal separation
|
|
||||||
*/
|
|
||||||
GEOIDAL_SEPARATION = 0x0004;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include the DOP value ; PDOP used by default, see below
|
|
||||||
*/
|
|
||||||
DOP = 0x0008;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If POS_DOP set, send separate HDOP / VDOP values instead of PDOP
|
|
||||||
*/
|
|
||||||
HVDOP = 0x0010;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include number of "satellites in view"
|
|
||||||
*/
|
|
||||||
SATINVIEW = 0x0020;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include a sequence number incremented per packet
|
|
||||||
*/
|
|
||||||
SEQ_NO = 0x0040;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include positional timestamp (from GPS solution)
|
|
||||||
*/
|
|
||||||
TIMESTAMP = 0x0080;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include positional heading
|
|
||||||
* Intended for use with vehicle not walking speeds
|
|
||||||
* walking speeds are likely to be error prone like the compass
|
|
||||||
*/
|
|
||||||
HEADING = 0x0100;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Include positional speed
|
|
||||||
* Intended for use with vehicle not walking speeds
|
|
||||||
* walking speeds are likely to be error prone like the compass
|
|
||||||
*/
|
|
||||||
SPEED = 0x0200;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum GpsMode {
|
|
||||||
/*
|
|
||||||
* GPS is present but disabled
|
|
||||||
*/
|
|
||||||
DISABLED = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPS is present and enabled
|
|
||||||
*/
|
|
||||||
ENABLED = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPS is not present on the device
|
|
||||||
*/
|
|
||||||
NOT_PRESENT = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We should send our position this often (but only if it has changed significantly)
|
|
||||||
* Defaults to 15 minutes
|
|
||||||
*/
|
|
||||||
uint32 position_broadcast_secs = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Adaptive position braoadcast, which is now the default.
|
|
||||||
*/
|
|
||||||
bool position_broadcast_smart_enabled = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If set, this node is at a fixed position.
|
|
||||||
* We will generate GPS position updates at the regular interval, but use whatever the last lat/lon/alt we have for the node.
|
|
||||||
* The lat/lon/alt can be set by an internal GPS or with the help of the app.
|
|
||||||
*/
|
|
||||||
bool fixed_position = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Is GPS enabled for this node?
|
|
||||||
*/
|
|
||||||
bool gps_enabled = 4[deprecated = true];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* How often should we try to get GPS position (in seconds)
|
|
||||||
* or zero for the default of once every 30 seconds
|
|
||||||
* or a very large value (maxint) to update only once at boot.
|
|
||||||
*/
|
|
||||||
uint32 gps_update_interval = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Deprecated in favor of using smart / regular broadcast intervals as implicit attempt time
|
|
||||||
*/
|
|
||||||
uint32 gps_attempt_time = 6 [deprecated = true];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bit field of boolean configuration options for POSITION messages
|
|
||||||
* (bitwise OR of PositionFlags)
|
|
||||||
*/
|
|
||||||
uint32 position_flags = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (Re)define GPS_RX_PIN for your board.
|
|
||||||
*/
|
|
||||||
uint32 rx_gpio = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (Re)define GPS_TX_PIN for your board.
|
|
||||||
*/
|
|
||||||
uint32 tx_gpio = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The minimum distance in meters traveled (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled
|
|
||||||
*/
|
|
||||||
uint32 broadcast_smart_minimum_distance = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The minimum number of seconds (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled
|
|
||||||
*/
|
|
||||||
uint32 broadcast_smart_minimum_interval_secs = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (Re)define PIN_GPS_EN for your board.
|
|
||||||
*/
|
|
||||||
uint32 gps_en_gpio = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set where GPS is enabled, disabled, or not present
|
|
||||||
*/
|
|
||||||
GpsMode gps_mode = 13;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Power Config\
|
|
||||||
* See [Power Config](/docs/settings/config/power) for additional power config details.
|
|
||||||
*/
|
|
||||||
message PowerConfig {
|
|
||||||
/*
|
|
||||||
* If set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in
|
|
||||||
* we should try to minimize power consumption as much as possible.
|
|
||||||
* YOU DO NOT NEED TO SET THIS IF YOU'VE set is_router (it is implied in that case).
|
|
||||||
* Advanced Option
|
|
||||||
*/
|
|
||||||
bool is_power_saving = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If non-zero, the device will fully power off this many seconds after external power is removed.
|
|
||||||
*/
|
|
||||||
uint32 on_battery_shutdown_after_secs = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ratio of voltage divider for battery pin eg. 3.20 (R1=100k, R2=220k)
|
|
||||||
* Overrides the ADC_MULTIPLIER defined in variant for battery voltage calculation.
|
|
||||||
* Should be set to floating point value between 2 and 4
|
|
||||||
* Fixes issues on Heltec v2
|
|
||||||
*/
|
|
||||||
float adc_multiplier_override = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wait Bluetooth Seconds
|
|
||||||
* The number of seconds for to wait before turning off BLE in No Bluetooth states
|
|
||||||
* 0 for default of 1 minute
|
|
||||||
*/
|
|
||||||
uint32 wait_bluetooth_secs = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Super Deep Sleep Seconds
|
|
||||||
* While in Light Sleep if mesh_sds_timeout_secs is exceeded we will lower into super deep sleep
|
|
||||||
* for this value (default 1 year) or a button press
|
|
||||||
* 0 for default of one year
|
|
||||||
*/
|
|
||||||
uint32 sds_secs = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Light Sleep Seconds
|
|
||||||
* In light sleep the CPU is suspended, LoRa radio is on, BLE is off an GPS is on
|
|
||||||
* ESP32 Only
|
|
||||||
* 0 for default of 300
|
|
||||||
*/
|
|
||||||
uint32 ls_secs = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Minimum Wake Seconds
|
|
||||||
* While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value
|
|
||||||
* 0 for default of 10 seconds
|
|
||||||
*/
|
|
||||||
uint32 min_wake_secs = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* I2C address of INA_2XX to use for reading device battery voltage
|
|
||||||
*/
|
|
||||||
uint32 device_battery_ina_address = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Network Config
|
|
||||||
*/
|
|
||||||
message NetworkConfig {
|
|
||||||
enum AddressMode {
|
|
||||||
/*
|
|
||||||
* obtain ip address via DHCP
|
|
||||||
*/
|
|
||||||
DHCP = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* use static ip address
|
|
||||||
*/
|
|
||||||
STATIC = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message IpV4Config {
|
|
||||||
/*
|
|
||||||
* Static IP address
|
|
||||||
*/
|
|
||||||
fixed32 ip = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Static gateway address
|
|
||||||
*/
|
|
||||||
fixed32 gateway = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Static subnet mask
|
|
||||||
*/
|
|
||||||
fixed32 subnet = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Static DNS server address
|
|
||||||
*/
|
|
||||||
fixed32 dns = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable WiFi (disables Bluetooth)
|
|
||||||
*/
|
|
||||||
bool wifi_enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If set, this node will try to join the specified wifi network and
|
|
||||||
* acquire an address via DHCP
|
|
||||||
*/
|
|
||||||
string wifi_ssid = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If set, will be use to authenticate to the named wifi
|
|
||||||
*/
|
|
||||||
string wifi_psk = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NTP server to use if WiFi is conneced, defaults to `0.pool.ntp.org`
|
|
||||||
*/
|
|
||||||
string ntp_server = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable Ethernet
|
|
||||||
*/
|
|
||||||
bool eth_enabled = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* acquire an address via DHCP or assign static
|
|
||||||
*/
|
|
||||||
AddressMode address_mode = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* struct to keep static address
|
|
||||||
*/
|
|
||||||
IpV4Config ipv4_config = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* rsyslog Server and Port
|
|
||||||
*/
|
|
||||||
string rsyslog_server = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Display Config
|
|
||||||
*/
|
|
||||||
message DisplayConfig {
|
|
||||||
/*
|
|
||||||
* How the GPS coordinates are displayed on the OLED screen.
|
|
||||||
*/
|
|
||||||
enum GpsCoordinateFormat {
|
|
||||||
/*
|
|
||||||
* GPS coordinates are displayed in the normal decimal degrees format:
|
|
||||||
* DD.DDDDDD DDD.DDDDDD
|
|
||||||
*/
|
|
||||||
DEC = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPS coordinates are displayed in the degrees minutes seconds format:
|
|
||||||
* DD°MM'SS"C DDD°MM'SS"C, where C is the compass point representing the locations quadrant
|
|
||||||
*/
|
|
||||||
DMS = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Universal Transverse Mercator format:
|
|
||||||
* ZZB EEEEEE NNNNNNN, where Z is zone, B is band, E is easting, N is northing
|
|
||||||
*/
|
|
||||||
UTM = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Military Grid Reference System format:
|
|
||||||
* ZZB CD EEEEE NNNNN, where Z is zone, B is band, C is the east 100k square, D is the north 100k square,
|
|
||||||
* E is easting, N is northing
|
|
||||||
*/
|
|
||||||
MGRS = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Open Location Code (aka Plus Codes).
|
|
||||||
*/
|
|
||||||
OLC = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ordnance Survey Grid Reference (the National Grid System of the UK).
|
|
||||||
* Format: AB EEEEE NNNNN, where A is the east 100k square, B is the north 100k square,
|
|
||||||
* E is the easting, N is the northing
|
|
||||||
*/
|
|
||||||
OSGR = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unit display preference
|
|
||||||
*/
|
|
||||||
enum DisplayUnits {
|
|
||||||
/*
|
|
||||||
* Metric (Default)
|
|
||||||
*/
|
|
||||||
METRIC = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Imperial
|
|
||||||
*/
|
|
||||||
IMPERIAL = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Override OLED outo detect with this if it fails.
|
|
||||||
*/
|
|
||||||
enum OledType {
|
|
||||||
/*
|
|
||||||
* Default / Auto
|
|
||||||
*/
|
|
||||||
OLED_AUTO = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default / Auto
|
|
||||||
*/
|
|
||||||
OLED_SSD1306 = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default / Auto
|
|
||||||
*/
|
|
||||||
OLED_SH1106 = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Can not be auto detected but set by proto. Used for 128x128 screens
|
|
||||||
*/
|
|
||||||
OLED_SH1107 = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of seconds the screen stays on after pressing the user button or receiving a message
|
|
||||||
* 0 for default of one minute MAXUINT for always on
|
|
||||||
*/
|
|
||||||
uint32 screen_on_secs = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* How the GPS coordinates are formatted on the OLED screen.
|
|
||||||
*/
|
|
||||||
GpsCoordinateFormat gps_format = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds.
|
|
||||||
* Potentially useful for devices without user buttons.
|
|
||||||
*/
|
|
||||||
uint32 auto_screen_carousel_secs = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If this is set, the displayed compass will always point north. if unset, the old behaviour
|
|
||||||
* (top of display is heading direction) is used.
|
|
||||||
*/
|
|
||||||
bool compass_north_top = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Flip screen vertically, for cases that mount the screen upside down
|
|
||||||
*/
|
|
||||||
bool flip_screen = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Perferred display units
|
|
||||||
*/
|
|
||||||
DisplayUnits units = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Override auto-detect in screen
|
|
||||||
*/
|
|
||||||
OledType oled = 7;
|
|
||||||
|
|
||||||
enum DisplayMode {
|
|
||||||
/*
|
|
||||||
* Default. The old style for the 128x64 OLED screen
|
|
||||||
*/
|
|
||||||
DEFAULT = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Rearrange display elements to cater for bicolor OLED displays
|
|
||||||
*/
|
|
||||||
TWOCOLOR = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Same as TwoColor, but with inverted top bar. Not so good for Epaper displays
|
|
||||||
*/
|
|
||||||
INVERTED = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TFT Full Color Displays (not implemented yet)
|
|
||||||
*/
|
|
||||||
COLOR = 3;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Display Mode
|
|
||||||
*/
|
|
||||||
DisplayMode displaymode = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print first line in pseudo-bold? FALSE is original style, TRUE is bold
|
|
||||||
*/
|
|
||||||
bool heading_bold = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Should we wake the screen up on accelerometer detected motion or tap
|
|
||||||
*/
|
|
||||||
bool wake_on_tap_or_motion = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Lora Config
|
|
||||||
*/
|
|
||||||
message LoRaConfig {
|
|
||||||
enum RegionCode {
|
|
||||||
/*
|
|
||||||
* Region is not set
|
|
||||||
*/
|
|
||||||
UNSET = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* United States
|
|
||||||
*/
|
|
||||||
US = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* European Union 433mhz
|
|
||||||
*/
|
|
||||||
EU_433 = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* European Union 868mhz
|
|
||||||
*/
|
|
||||||
EU_868 = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* China
|
|
||||||
*/
|
|
||||||
CN = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Japan
|
|
||||||
*/
|
|
||||||
JP = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Australia / New Zealand
|
|
||||||
*/
|
|
||||||
ANZ = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Korea
|
|
||||||
*/
|
|
||||||
KR = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Taiwan
|
|
||||||
*/
|
|
||||||
TW = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Russia
|
|
||||||
*/
|
|
||||||
RU = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* India
|
|
||||||
*/
|
|
||||||
IN = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* New Zealand 865mhz
|
|
||||||
*/
|
|
||||||
NZ_865 = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Thailand
|
|
||||||
*/
|
|
||||||
TH = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WLAN Band
|
|
||||||
*/
|
|
||||||
LORA_24 = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ukraine 433mhz
|
|
||||||
*/
|
|
||||||
UA_433 = 14;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ukraine 868mhz
|
|
||||||
*/
|
|
||||||
UA_868 = 15;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Malaysia 433mhz
|
|
||||||
*/
|
|
||||||
MY_433 = 16;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Malaysia 919mhz
|
|
||||||
*/
|
|
||||||
MY_919 = 17;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Singapore 923mhz
|
|
||||||
*/
|
|
||||||
SG_923 = 18;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Philippines 433mhz
|
|
||||||
*/
|
|
||||||
PH_433 = 19;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Philippines 868mhz
|
|
||||||
*/
|
|
||||||
PH_868 = 20;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Philippines 915mhz
|
|
||||||
*/
|
|
||||||
PH_915 = 21;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Standard predefined channel settings
|
|
||||||
* Note: these mappings must match ModemPreset Choice in the device code.
|
|
||||||
*/
|
|
||||||
enum ModemPreset {
|
|
||||||
/*
|
|
||||||
* Long Range - Fast
|
|
||||||
*/
|
|
||||||
LONG_FAST = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Long Range - Slow
|
|
||||||
*/
|
|
||||||
LONG_SLOW = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Very Long Range - Slow
|
|
||||||
*/
|
|
||||||
VERY_LONG_SLOW = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Medium Range - Slow
|
|
||||||
*/
|
|
||||||
MEDIUM_SLOW = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Medium Range - Fast
|
|
||||||
*/
|
|
||||||
MEDIUM_FAST = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Short Range - Slow
|
|
||||||
*/
|
|
||||||
SHORT_SLOW = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Short Range - Fast
|
|
||||||
*/
|
|
||||||
SHORT_FAST = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Long Range - Moderately Fast
|
|
||||||
*/
|
|
||||||
LONG_MODERATE = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Short Range - Turbo
|
|
||||||
* This is the fastest preset and the only one with 500kHz bandwidth.
|
|
||||||
* It is not legal to use in all regions due to this wider bandwidth.
|
|
||||||
*/
|
|
||||||
SHORT_TURBO = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When enabled, the `modem_preset` fields will be adhered to, else the `bandwidth`/`spread_factor`/`coding_rate`
|
|
||||||
* will be taked from their respective manually defined fields
|
|
||||||
*/
|
|
||||||
bool use_preset = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH.
|
|
||||||
* As a heuristic: If bandwidth is specified, do not use modem_config.
|
|
||||||
* Because protobufs take ZERO space when the value is zero this works out nicely.
|
|
||||||
* This value is replaced by bandwidth/spread_factor/coding_rate.
|
|
||||||
* If you'd like to experiment with other options add them to MeshRadio.cpp in the device code.
|
|
||||||
*/
|
|
||||||
ModemPreset modem_preset = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bandwidth in MHz
|
|
||||||
* Certain bandwidth numbers are 'special' and will be converted to the
|
|
||||||
* appropriate floating point value: 31 -> 31.25MHz
|
|
||||||
*/
|
|
||||||
uint32 bandwidth = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A number from 7 to 12.
|
|
||||||
* Indicates number of chirps per symbol as 1<<spread_factor.
|
|
||||||
*/
|
|
||||||
uint32 spread_factor = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The denominator of the coding rate.
|
|
||||||
* ie for 4/5, the value is 5. 4/8 the value is 8.
|
|
||||||
*/
|
|
||||||
uint32 coding_rate = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This parameter is for advanced users with advanced test equipment, we do not recommend most users use it.
|
|
||||||
* A frequency offset that is added to to the calculated band center frequency.
|
|
||||||
* Used to correct for crystal calibration errors.
|
|
||||||
*/
|
|
||||||
float frequency_offset = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The region code for the radio (US, CN, EU433, etc...)
|
|
||||||
*/
|
|
||||||
RegionCode region = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maximum number of hops. This can't be greater than 7.
|
|
||||||
* Default of 3
|
|
||||||
* Attempting to set a value > 7 results in the default
|
|
||||||
*/
|
|
||||||
uint32 hop_limit = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disable TX from the LoRa radio. Useful for hot-swapping antennas and other tests.
|
|
||||||
* Defaults to false
|
|
||||||
*/
|
|
||||||
bool tx_enabled = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If zero, then use default max legal continuous power (ie. something that won't
|
|
||||||
* burn out the radio hardware)
|
|
||||||
* In most cases you should use zero here.
|
|
||||||
* Units are in dBm.
|
|
||||||
*/
|
|
||||||
int32 tx_power = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This controls the actual hardware frequency the radio transmits on.
|
|
||||||
* Most users should never need to be exposed to this field/concept.
|
|
||||||
* A channel number between 1 and NUM_CHANNELS (whatever the max is in the current region).
|
|
||||||
* If ZERO then the rule is "use the old channel name hash based
|
|
||||||
* algorithm to derive the channel number")
|
|
||||||
* If using the hash algorithm the channel number will be: hash(channel_name) %
|
|
||||||
* NUM_CHANNELS (Where num channels depends on the regulatory region).
|
|
||||||
*/
|
|
||||||
uint32 channel_num = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, duty cycle limits will be exceeded and thus you're possibly not following
|
|
||||||
* the local regulations if you're not a HAM.
|
|
||||||
* Has no effect if the duty cycle of the used region is 100%.
|
|
||||||
*/
|
|
||||||
bool override_duty_cycle = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, sets RX boosted gain mode on SX126X based radios
|
|
||||||
*/
|
|
||||||
bool sx126x_rx_boosted_gain = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This parameter is for advanced users and licensed HAM radio operators.
|
|
||||||
* Ignore Channel Calculation and use this frequency instead. The frequency_offset
|
|
||||||
* will still be applied. This will allow you to use out-of-band frequencies.
|
|
||||||
* Please respect your local laws and regulations. If you are a HAM, make sure you
|
|
||||||
* enable HAM mode and turn off encryption.
|
|
||||||
*/
|
|
||||||
float override_frequency = 14;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For testing it is useful sometimes to force a node to never listen to
|
|
||||||
* particular other nodes (simulating radio out of range). All nodenums listed
|
|
||||||
* in ignore_incoming will have packets they send dropped on receive (by router.cpp)
|
|
||||||
*/
|
|
||||||
repeated uint32 ignore_incoming = 103;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, the device will not process any packets received via LoRa that passed via MQTT anywhere on the path towards it.
|
|
||||||
*/
|
|
||||||
bool ignore_mqtt = 104;
|
|
||||||
}
|
|
||||||
|
|
||||||
message BluetoothConfig {
|
|
||||||
enum PairingMode {
|
|
||||||
/*
|
|
||||||
* Device generates a random PIN that will be shown on the screen of the device for pairing
|
|
||||||
*/
|
|
||||||
RANDOM_PIN = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Device requires a specified fixed PIN for pairing
|
|
||||||
*/
|
|
||||||
FIXED_PIN = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Device requires no PIN for pairing
|
|
||||||
*/
|
|
||||||
NO_PIN = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable Bluetooth on the device
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Determines the pairing strategy for the device
|
|
||||||
*/
|
|
||||||
PairingMode mode = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Specified PIN for PairingMode.FixedPin
|
|
||||||
*/
|
|
||||||
uint32 fixed_pin = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Payload Variant
|
|
||||||
*/
|
|
||||||
oneof payload_variant {
|
|
||||||
DeviceConfig device = 1;
|
|
||||||
PositionConfig position = 2;
|
|
||||||
PowerConfig power = 3;
|
|
||||||
NetworkConfig network = 4;
|
|
||||||
DisplayConfig display = 5;
|
|
||||||
LoRaConfig lora = 6;
|
|
||||||
BluetoothConfig bluetooth = 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*WifiConnectionStatus.ssid max_size:33
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "ConnStatusProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
message DeviceConnectionStatus {
|
|
||||||
/*
|
|
||||||
* WiFi Status
|
|
||||||
*/
|
|
||||||
optional WifiConnectionStatus wifi = 1;
|
|
||||||
/*
|
|
||||||
* WiFi Status
|
|
||||||
*/
|
|
||||||
optional EthernetConnectionStatus ethernet = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bluetooth Status
|
|
||||||
*/
|
|
||||||
optional BluetoothConnectionStatus bluetooth = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Serial Status
|
|
||||||
*/
|
|
||||||
optional SerialConnectionStatus serial = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi connection status
|
|
||||||
*/
|
|
||||||
message WifiConnectionStatus {
|
|
||||||
/*
|
|
||||||
* Connection status
|
|
||||||
*/
|
|
||||||
NetworkConnectionStatus status = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi access point SSID
|
|
||||||
*/
|
|
||||||
string ssid = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RSSI of wireless connection
|
|
||||||
*/
|
|
||||||
int32 rssi = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ethernet connection status
|
|
||||||
*/
|
|
||||||
message EthernetConnectionStatus {
|
|
||||||
/*
|
|
||||||
* Connection status
|
|
||||||
*/
|
|
||||||
NetworkConnectionStatus status = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ethernet or WiFi connection status
|
|
||||||
*/
|
|
||||||
message NetworkConnectionStatus {
|
|
||||||
/*
|
|
||||||
* IP address of device
|
|
||||||
*/
|
|
||||||
fixed32 ip_address = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether the device has an active connection or not
|
|
||||||
*/
|
|
||||||
bool is_connected = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether the device has an active connection to an MQTT broker or not
|
|
||||||
*/
|
|
||||||
bool is_mqtt_connected = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether the device is actively remote syslogging or not
|
|
||||||
*/
|
|
||||||
bool is_syslog_connected = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bluetooth connection status
|
|
||||||
*/
|
|
||||||
message BluetoothConnectionStatus {
|
|
||||||
/*
|
|
||||||
* The pairing PIN for bluetooth
|
|
||||||
*/
|
|
||||||
uint32 pin = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RSSI of bluetooth connection
|
|
||||||
*/
|
|
||||||
int32 rssi = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether the device has an active connection or not
|
|
||||||
*/
|
|
||||||
bool is_connected = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Serial connection status
|
|
||||||
*/
|
|
||||||
message SerialConnectionStatus {
|
|
||||||
/*
|
|
||||||
* Serial baud rate
|
|
||||||
*/
|
|
||||||
uint32 baud = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether the device has an active connection or not
|
|
||||||
*/
|
|
||||||
bool is_connected = 2;
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
# options for nanopb
|
|
||||||
# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options
|
|
||||||
|
|
||||||
# FIXME pick a higher number someday? or do dynamic alloc in nanopb?
|
|
||||||
*DeviceState.node_db_lite max_count:100
|
|
||||||
|
|
||||||
# FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM
|
|
||||||
*DeviceState.receive_queue max_count:1
|
|
||||||
|
|
||||||
*ChannelFile.channels max_count:8
|
|
||||||
|
|
||||||
*OEMStore.oem_text max_size:40
|
|
||||||
*OEMStore.oem_icon_bits max_size:2048
|
|
||||||
*OEMStore.oem_aes_key max_size:32
|
|
||||||
|
|
||||||
*DeviceState.node_remote_hardware_pins max_count:12
|
|
||||||
|
|
||||||
*NodeInfoLite.channel int_size:8
|
|
||||||
*NodeInfoLite.hops_away int_size:8
|
|
||||||
@ -1,262 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
import "meshtastic/channel.proto";
|
|
||||||
import "meshtastic/localonly.proto";
|
|
||||||
import "meshtastic/mesh.proto";
|
|
||||||
import "meshtastic/telemetry.proto";
|
|
||||||
import "meshtastic/module_config.proto";
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "DeviceOnly";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This message is never sent over the wire, but it is used for serializing DB
|
|
||||||
* state to flash in the device code
|
|
||||||
* FIXME, since we write this each time we enter deep sleep (and have infinite
|
|
||||||
* flash) it would be better to use some sort of append only data structure for
|
|
||||||
* the receive queue and use the preferences store for the other stuff
|
|
||||||
*/
|
|
||||||
message DeviceState {
|
|
||||||
/*
|
|
||||||
* Read only settings/info about this node
|
|
||||||
*/
|
|
||||||
MyNodeInfo my_node = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* My owner info
|
|
||||||
*/
|
|
||||||
User owner = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Received packets saved for delivery to the phone
|
|
||||||
*/
|
|
||||||
repeated MeshPacket receive_queue = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A version integer used to invalidate old save files when we make
|
|
||||||
* incompatible changes This integer is set at build time and is private to
|
|
||||||
* NodeDB.cpp in the device code.
|
|
||||||
*/
|
|
||||||
uint32 version = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We keep the last received text message (only) stored in the device flash,
|
|
||||||
* so we can show it on the screen.
|
|
||||||
* Might be null
|
|
||||||
*/
|
|
||||||
MeshPacket rx_text_message = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Used only during development.
|
|
||||||
* Indicates developer is testing and changes should never be saved to flash.
|
|
||||||
*/
|
|
||||||
bool no_save = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset.
|
|
||||||
*/
|
|
||||||
bool did_gps_reset = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We keep the last received waypoint stored in the device flash,
|
|
||||||
* so we can show it on the screen.
|
|
||||||
* Might be null
|
|
||||||
*/
|
|
||||||
MeshPacket rx_waypoint = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The mesh's nodes with their available gpio pins for RemoteHardware module
|
|
||||||
*/
|
|
||||||
repeated NodeRemoteHardwarePin node_remote_hardware_pins = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* New lite version of NodeDB to decrease memory footprint
|
|
||||||
*/
|
|
||||||
repeated NodeInfoLite node_db_lite = 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
message NodeInfoLite {
|
|
||||||
/*
|
|
||||||
* The node number
|
|
||||||
*/
|
|
||||||
uint32 num = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The user info for this node
|
|
||||||
*/
|
|
||||||
User user = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This position data. Note: before 1.2.14 we would also store the last time we've heard from this node in position.time, that is no longer true.
|
|
||||||
* Position.time now indicates the last time we received a POSITION from that node.
|
|
||||||
*/
|
|
||||||
PositionLite position = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns the Signal-to-noise ratio (SNR) of the last received message,
|
|
||||||
* as measured by the receiver. Return SNR of the last received message in dB
|
|
||||||
*/
|
|
||||||
float snr = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set to indicate the last time we received a packet from this node
|
|
||||||
*/
|
|
||||||
fixed32 last_heard = 5;
|
|
||||||
/*
|
|
||||||
* The latest device metrics for the node.
|
|
||||||
*/
|
|
||||||
DeviceMetrics device_metrics = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* local channel index we heard that node on. Only populated if its not the default channel.
|
|
||||||
*/
|
|
||||||
uint32 channel = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True if we witnessed the node over MQTT instead of LoRA transport
|
|
||||||
*/
|
|
||||||
bool via_mqtt = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of hops away from us this node is (0 if adjacent)
|
|
||||||
*/
|
|
||||||
uint32 hops_away = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Position with static location information only for NodeDBLite
|
|
||||||
*/
|
|
||||||
message PositionLite {
|
|
||||||
/*
|
|
||||||
* The new preferred location encoding, multiply by 1e-7 to get degrees
|
|
||||||
* in floating point
|
|
||||||
*/
|
|
||||||
sfixed32 latitude_i = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
sfixed32 longitude_i = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In meters above MSL (but see issue #359)
|
|
||||||
*/
|
|
||||||
int32 altitude = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is usually not sent over the mesh (to save space), but it is sent
|
|
||||||
* from the phone so that the local device can set its RTC If it is sent over
|
|
||||||
* the mesh (because there are devices on the mesh without GPS), it will only
|
|
||||||
* be sent by devices which has a hardware GPS clock.
|
|
||||||
* seconds since 1970
|
|
||||||
*/
|
|
||||||
fixed32 time = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
Position.LocSource location_source = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The on-disk saved channels
|
|
||||||
*/
|
|
||||||
message ChannelFile {
|
|
||||||
/*
|
|
||||||
* The channels our node knows about
|
|
||||||
*/
|
|
||||||
repeated Channel channels = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A version integer used to invalidate old save files when we make
|
|
||||||
* incompatible changes This integer is set at build time and is private to
|
|
||||||
* NodeDB.cpp in the device code.
|
|
||||||
*/
|
|
||||||
uint32 version = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
enum ScreenFonts {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
FONT_SMALL = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
FONT_MEDIUM = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
FONT_LARGE = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This can be used for customizing the firmware distribution. If populated,
|
|
||||||
* show a secondary bootup screen with custom logo and text for 2.5 seconds.
|
|
||||||
*/
|
|
||||||
message OEMStore {
|
|
||||||
/*
|
|
||||||
* The Logo width in Px
|
|
||||||
*/
|
|
||||||
uint32 oem_icon_width = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The Logo height in Px
|
|
||||||
*/
|
|
||||||
uint32 oem_icon_height = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The Logo in XBM bytechar format
|
|
||||||
*/
|
|
||||||
bytes oem_icon_bits = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Use this font for the OEM text.
|
|
||||||
*/
|
|
||||||
ScreenFonts oem_font = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Use this font for the OEM text.
|
|
||||||
*/
|
|
||||||
string oem_text = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The default device encryption key, 16 or 32 byte
|
|
||||||
*/
|
|
||||||
bytes oem_aes_key = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A Preset LocalConfig to apply during factory reset
|
|
||||||
*/
|
|
||||||
LocalConfig oem_local_config = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A Preset LocalModuleConfig to apply during factory reset
|
|
||||||
*/
|
|
||||||
LocalModuleConfig oem_local_module_config = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RemoteHardwarePins associated with a node
|
|
||||||
*/
|
|
||||||
message NodeRemoteHardwarePin {
|
|
||||||
/*
|
|
||||||
* The node_num exposing the available gpio pin
|
|
||||||
*/
|
|
||||||
uint32 node_num = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The the available gpio pin for usage with RemoteHardware module
|
|
||||||
*/
|
|
||||||
RemoteHardwarePin pin = 2;
|
|
||||||
}
|
|
||||||
@ -1,135 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
import "meshtastic/config.proto";
|
|
||||||
import "meshtastic/module_config.proto";
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "LocalOnlyProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Protobuf structures common to apponly.proto and deviceonly.proto
|
|
||||||
* This is never sent over the wire, only for local use
|
|
||||||
*/
|
|
||||||
|
|
||||||
message LocalConfig {
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Device
|
|
||||||
*/
|
|
||||||
Config.DeviceConfig device = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the GPS Position
|
|
||||||
*/
|
|
||||||
Config.PositionConfig position = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Power settings
|
|
||||||
*/
|
|
||||||
Config.PowerConfig power = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Wifi Settings
|
|
||||||
*/
|
|
||||||
Config.NetworkConfig network = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Display
|
|
||||||
*/
|
|
||||||
Config.DisplayConfig display = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Lora Radio
|
|
||||||
*/
|
|
||||||
Config.LoRaConfig lora = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Bluetooth settings
|
|
||||||
*/
|
|
||||||
Config.BluetoothConfig bluetooth = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A version integer used to invalidate old save files when we make
|
|
||||||
* incompatible changes This integer is set at build time and is private to
|
|
||||||
* NodeDB.cpp in the device code.
|
|
||||||
*/
|
|
||||||
uint32 version = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LocalModuleConfig {
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the MQTT module
|
|
||||||
*/
|
|
||||||
ModuleConfig.MQTTConfig mqtt = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Serial module
|
|
||||||
*/
|
|
||||||
ModuleConfig.SerialConfig serial = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the ExternalNotification module
|
|
||||||
*/
|
|
||||||
ModuleConfig.ExternalNotificationConfig external_notification = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Store & Forward module
|
|
||||||
*/
|
|
||||||
ModuleConfig.StoreForwardConfig store_forward = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the RangeTest module
|
|
||||||
*/
|
|
||||||
ModuleConfig.RangeTestConfig range_test = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Telemetry module
|
|
||||||
*/
|
|
||||||
ModuleConfig.TelemetryConfig telemetry = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Canned Message module
|
|
||||||
*/
|
|
||||||
ModuleConfig.CannedMessageConfig canned_message = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Audio module
|
|
||||||
*/
|
|
||||||
ModuleConfig.AudioConfig audio = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Remote Hardware module
|
|
||||||
*/
|
|
||||||
ModuleConfig.RemoteHardwareConfig remote_hardware = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Neighbor Info module
|
|
||||||
*/
|
|
||||||
ModuleConfig.NeighborInfoConfig neighbor_info = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Ambient Lighting module
|
|
||||||
*/
|
|
||||||
ModuleConfig.AmbientLightingConfig ambient_lighting = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The part of the config that is specific to the Detection Sensor module
|
|
||||||
*/
|
|
||||||
ModuleConfig.DetectionSensorConfig detection_sensor = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Paxcounter Config
|
|
||||||
*/
|
|
||||||
ModuleConfig.PaxcounterConfig paxcounter = 14;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A version integer used to invalidate old save files when we make
|
|
||||||
* incompatible changes This integer is set at build time and is private to
|
|
||||||
* NodeDB.cpp in the device code.
|
|
||||||
*/
|
|
||||||
uint32 version = 8;
|
|
||||||
}
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
# options for nanopb
|
|
||||||
# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options
|
|
||||||
|
|
||||||
*macaddr max_size:6 fixed_length:true # macaddrs
|
|
||||||
*id max_size:16 # node id strings
|
|
||||||
|
|
||||||
*User.long_name max_size:40
|
|
||||||
*User.short_name max_size:5
|
|
||||||
|
|
||||||
*RouteDiscovery.route max_count:8
|
|
||||||
|
|
||||||
# note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
|
|
||||||
# outside of this envelope
|
|
||||||
*Data.payload max_size:237
|
|
||||||
|
|
||||||
*NodeInfo.channel int_size:8
|
|
||||||
*NodeInfo.hops_away int_size:8
|
|
||||||
|
|
||||||
# Big enough for 1.2.28.568032c-d
|
|
||||||
*MyNodeInfo.firmware_version max_size:18
|
|
||||||
|
|
||||||
*MyNodeInfo.air_period_tx max_count:8
|
|
||||||
*MyNodeInfo.air_period_rx max_count:8
|
|
||||||
|
|
||||||
# Note: the actual limit (because of header bytes) on the size of encrypted payloads is 251 bytes, but I use 256
|
|
||||||
# here because we might need to fill with zeros for padding to encryption block size (16 bytes per block)
|
|
||||||
*MeshPacket.encrypted max_size:256
|
|
||||||
*MeshPacket.payload_variant anonymous_oneof:true
|
|
||||||
*MeshPacket.hop_limit int_size:8
|
|
||||||
*MeshPacket.hop_start int_size:8
|
|
||||||
*MeshPacket.channel int_size:8
|
|
||||||
|
|
||||||
*QueueStatus.res int_size:8
|
|
||||||
*QueueStatus.free int_size:8
|
|
||||||
*QueueStatus.maxlen int_size:8
|
|
||||||
|
|
||||||
*ToRadio.payload_variant anonymous_oneof:true
|
|
||||||
|
|
||||||
*FromRadio.payload_variant anonymous_oneof:true
|
|
||||||
|
|
||||||
*Routing.variant anonymous_oneof:true
|
|
||||||
|
|
||||||
*LogRecord.message max_size:64
|
|
||||||
*LogRecord.source max_size:8
|
|
||||||
|
|
||||||
# MyMessage.name max_size:40
|
|
||||||
# or fixed_length or fixed_count, or max_count
|
|
||||||
|
|
||||||
#This value may want to be a few bytes smaller to compensate for the parent fields.
|
|
||||||
*Compressed.data max_size:237
|
|
||||||
|
|
||||||
*Waypoint.name max_size:30
|
|
||||||
*Waypoint.description max_size:100
|
|
||||||
|
|
||||||
*NeighborInfo.neighbors max_count:10
|
|
||||||
|
|
||||||
*DeviceMetadata.firmware_version max_size:18
|
|
||||||
|
|
||||||
*MqttClientProxyMessage.topic max_size:60
|
|
||||||
*MqttClientProxyMessage.data max_size:435
|
|
||||||
*MqttClientProxyMessage.text max_size:435
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,28 +0,0 @@
|
|||||||
*CannedMessageConfig.allow_input_source max_size:16
|
|
||||||
|
|
||||||
*MQTTConfig.address max_size:64
|
|
||||||
*MQTTConfig.username max_size:64
|
|
||||||
*MQTTConfig.password max_size:64
|
|
||||||
*MQTTConfig.root max_size:16
|
|
||||||
|
|
||||||
*AudioConfig.ptt_pin int_size:8
|
|
||||||
*AudioConfig.i2s_ws int_size:8
|
|
||||||
*AudioConfig.i2s_sd int_size:8
|
|
||||||
*AudioConfig.i2s_din int_size:8
|
|
||||||
*AudioConfig.i2s_sck int_size:8
|
|
||||||
|
|
||||||
*ExternalNotificationConfig.output_vibra int_size:8
|
|
||||||
*ExternalNotificationConfig.output_buzzer int_size:8
|
|
||||||
*ExternalNotificationConfig.nag_timeout int_size:16
|
|
||||||
|
|
||||||
*RemoteHardwareConfig.available_pins max_count:4
|
|
||||||
*RemoteHardwarePin.name max_size:15
|
|
||||||
*RemoteHardwarePin.gpio_pin int_size:8
|
|
||||||
|
|
||||||
*AmbientLightingConfig.current int_size:8
|
|
||||||
*AmbientLightingConfig.red int_size:8
|
|
||||||
*AmbientLightingConfig.green int_size:8
|
|
||||||
*AmbientLightingConfig.blue int_size:8
|
|
||||||
|
|
||||||
*DetectionSensorConfig.monitor_pin int_size:8
|
|
||||||
*DetectionSensorConfig.name max_size:20
|
|
||||||
@ -1,801 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "ModuleConfigProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Module Config
|
|
||||||
*/
|
|
||||||
message ModuleConfig {
|
|
||||||
/*
|
|
||||||
* MQTT Client Config
|
|
||||||
*/
|
|
||||||
message MQTTConfig {
|
|
||||||
/*
|
|
||||||
* If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as
|
|
||||||
* is_uplink_enabled or is_downlink_enabled.
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The server to use for our MQTT global message gateway feature.
|
|
||||||
* If not set, the default server will be used
|
|
||||||
*/
|
|
||||||
string address = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MQTT username to use (most useful for a custom MQTT server).
|
|
||||||
* If using a custom server, this will be honoured even if empty.
|
|
||||||
* If using the default server, this will only be honoured if set, otherwise the device will use the default username
|
|
||||||
*/
|
|
||||||
string username = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MQTT password to use (most useful for a custom MQTT server).
|
|
||||||
* If using a custom server, this will be honoured even if empty.
|
|
||||||
* If using the default server, this will only be honoured if set, otherwise the device will use the default password
|
|
||||||
*/
|
|
||||||
string password = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether to send encrypted or decrypted packets to MQTT.
|
|
||||||
* This parameter is only honoured if you also set server
|
|
||||||
* (the default official mqtt.meshtastic.org server can handle encrypted packets)
|
|
||||||
* Decrypted packets may be useful for external systems that want to consume meshtastic packets
|
|
||||||
*/
|
|
||||||
bool encryption_enabled = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether to send / consume json packets on MQTT
|
|
||||||
*/
|
|
||||||
bool json_enabled = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, we attempt to establish a secure connection using TLS
|
|
||||||
*/
|
|
||||||
bool tls_enabled = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The root topic to use for MQTT messages. Default is "msh".
|
|
||||||
* This is useful if you want to use a single MQTT server for multiple meshtastic networks and separate them via ACLs
|
|
||||||
*/
|
|
||||||
string root = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, we can use the connected phone / client to proxy messages to MQTT instead of a direct connection
|
|
||||||
*/
|
|
||||||
bool proxy_to_client_enabled = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If true, we will periodically report unencrypted information about our node to a map via MQTT
|
|
||||||
*/
|
|
||||||
bool map_reporting_enabled = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Settings for reporting information about our node to a map via MQTT
|
|
||||||
*/
|
|
||||||
MapReportSettings map_report_settings = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Settings for reporting unencrypted information about our node to a map via MQTT
|
|
||||||
*/
|
|
||||||
message MapReportSettings {
|
|
||||||
/*
|
|
||||||
* How often we should report our info to the map (in seconds)
|
|
||||||
*/
|
|
||||||
uint32 publish_interval_secs = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bits of precision for the location sent (default of 32 is full precision).
|
|
||||||
*/
|
|
||||||
uint32 position_precision = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RemoteHardwareModule Config
|
|
||||||
*/
|
|
||||||
message RemoteHardwareConfig {
|
|
||||||
/*
|
|
||||||
* Whether the Module is enabled
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether the Module allows consumers to read / write to pins not defined in available_pins
|
|
||||||
*/
|
|
||||||
bool allow_undefined_pin_access = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exposes the available pins to the mesh for reading and writing
|
|
||||||
*/
|
|
||||||
repeated RemoteHardwarePin available_pins = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NeighborInfoModule Config
|
|
||||||
*/
|
|
||||||
message NeighborInfoConfig {
|
|
||||||
/*
|
|
||||||
* Whether the Module is enabled
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* Neighbor Info to the mesh
|
|
||||||
*/
|
|
||||||
uint32 update_interval = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Detection Sensor Module Config
|
|
||||||
*/
|
|
||||||
message DetectionSensorConfig {
|
|
||||||
/*
|
|
||||||
* Whether the Module is enabled
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we can send a message to the mesh when a state change is detected
|
|
||||||
*/
|
|
||||||
uint32 minimum_broadcast_secs = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should send a message to the mesh with the current state regardless of changes
|
|
||||||
* When set to 0, only state changes will be broadcasted
|
|
||||||
* Works as a sort of status heartbeat for peace of mind
|
|
||||||
*/
|
|
||||||
uint32 state_broadcast_secs = 3;
|
|
||||||
/*
|
|
||||||
* Send ASCII bell with alert message
|
|
||||||
* Useful for triggering ext. notification on bell
|
|
||||||
*/
|
|
||||||
bool send_bell = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Friendly name used to format message sent to mesh
|
|
||||||
* Example: A name "Motion" would result in a message "Motion detected"
|
|
||||||
* Maximum length of 20 characters
|
|
||||||
*/
|
|
||||||
string name = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO pin to monitor for state changes
|
|
||||||
*/
|
|
||||||
uint32 monitor_pin = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether or not the GPIO pin state detection is triggered on HIGH (1)
|
|
||||||
* Otherwise LOW (0)
|
|
||||||
*/
|
|
||||||
bool detection_triggered_high = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether or not use INPUT_PULLUP mode for GPIO pin
|
|
||||||
* Only applicable if the board uses pull-up resistors on the pin
|
|
||||||
*/
|
|
||||||
bool use_pullup = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Audio Config for codec2 voice
|
|
||||||
*/
|
|
||||||
message AudioConfig {
|
|
||||||
/*
|
|
||||||
* Baudrate for codec2 voice
|
|
||||||
*/
|
|
||||||
enum Audio_Baud {
|
|
||||||
CODEC2_DEFAULT = 0;
|
|
||||||
CODEC2_3200 = 1;
|
|
||||||
CODEC2_2400 = 2;
|
|
||||||
CODEC2_1600 = 3;
|
|
||||||
CODEC2_1400 = 4;
|
|
||||||
CODEC2_1300 = 5;
|
|
||||||
CODEC2_1200 = 6;
|
|
||||||
CODEC2_700 = 7;
|
|
||||||
CODEC2_700B = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether Audio is enabled
|
|
||||||
*/
|
|
||||||
bool codec2_enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PTT Pin
|
|
||||||
*/
|
|
||||||
uint32 ptt_pin = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The audio sample rate to use for codec2
|
|
||||||
*/
|
|
||||||
Audio_Baud bitrate = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* I2S Word Select
|
|
||||||
*/
|
|
||||||
uint32 i2s_ws = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* I2S Data IN
|
|
||||||
*/
|
|
||||||
uint32 i2s_sd = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* I2S Data OUT
|
|
||||||
*/
|
|
||||||
uint32 i2s_din = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* I2S Clock
|
|
||||||
*/
|
|
||||||
uint32 i2s_sck = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Config for the Paxcounter Module
|
|
||||||
*/
|
|
||||||
message PaxcounterConfig {
|
|
||||||
/*
|
|
||||||
* Enable the Paxcounter Module
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* metrics to the mesh
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint32 paxcounter_update_interval = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Serial Config
|
|
||||||
*/
|
|
||||||
message SerialConfig {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
enum Serial_Baud {
|
|
||||||
BAUD_DEFAULT = 0;
|
|
||||||
BAUD_110 = 1;
|
|
||||||
BAUD_300 = 2;
|
|
||||||
BAUD_600 = 3;
|
|
||||||
BAUD_1200 = 4;
|
|
||||||
BAUD_2400 = 5;
|
|
||||||
BAUD_4800 = 6;
|
|
||||||
BAUD_9600 = 7;
|
|
||||||
BAUD_19200 = 8;
|
|
||||||
BAUD_38400 = 9;
|
|
||||||
BAUD_57600 = 10;
|
|
||||||
BAUD_115200 = 11;
|
|
||||||
BAUD_230400 = 12;
|
|
||||||
BAUD_460800 = 13;
|
|
||||||
BAUD_576000 = 14;
|
|
||||||
BAUD_921600 = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
enum Serial_Mode {
|
|
||||||
DEFAULT = 0;
|
|
||||||
SIMPLE = 1;
|
|
||||||
PROTO = 2;
|
|
||||||
TEXTMSG = 3;
|
|
||||||
NMEA = 4;
|
|
||||||
// NMEA messages specifically tailored for CalTopo
|
|
||||||
CALTOPO = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Preferences for the SerialModule
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
bool echo = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RX pin (should match Arduino gpio pin number)
|
|
||||||
*/
|
|
||||||
uint32 rxd = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TX pin (should match Arduino gpio pin number)
|
|
||||||
*/
|
|
||||||
uint32 txd = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Serial baud rate
|
|
||||||
*/
|
|
||||||
Serial_Baud baud = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
uint32 timeout = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Mode for serial module operation
|
|
||||||
*/
|
|
||||||
Serial_Mode mode = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Overrides the platform's defacto Serial port instance to use with Serial module config settings
|
|
||||||
* This is currently only usable in output modes like NMEA / CalTopo and may behave strangely or not work at all in other modes
|
|
||||||
* Existing logging over the Serial Console will still be present
|
|
||||||
*/
|
|
||||||
bool override_console_serial_port = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* External Notifications Config
|
|
||||||
*/
|
|
||||||
message ExternalNotificationConfig {
|
|
||||||
/*
|
|
||||||
* Enable the ExternalNotificationModule
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When using in On/Off mode, keep the output on for this many
|
|
||||||
* milliseconds. Default 1000ms (1 second).
|
|
||||||
*/
|
|
||||||
uint32 output_ms = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define the output pin GPIO setting Defaults to
|
|
||||||
* EXT_NOTIFY_OUT if set for the board.
|
|
||||||
* In standalone devices this pin should drive the LED to match the UI.
|
|
||||||
*/
|
|
||||||
uint32 output = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Optional: Define a secondary output pin for a vibra motor
|
|
||||||
* This is used in standalone devices to match the UI.
|
|
||||||
*/
|
|
||||||
uint32 output_vibra = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Optional: Define a tertiary output pin for an active buzzer
|
|
||||||
* This is used in standalone devices to to match the UI.
|
|
||||||
*/
|
|
||||||
uint32 output_buzzer = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IF this is true, the 'output' Pin will be pulled active high, false
|
|
||||||
* means active low.
|
|
||||||
*/
|
|
||||||
bool active = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True: Alert when a text message arrives (output)
|
|
||||||
*/
|
|
||||||
bool alert_message = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True: Alert when a text message arrives (output_vibra)
|
|
||||||
*/
|
|
||||||
bool alert_message_vibra = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True: Alert when a text message arrives (output_buzzer)
|
|
||||||
*/
|
|
||||||
bool alert_message_buzzer = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True: Alert when the bell character is received (output)
|
|
||||||
*/
|
|
||||||
bool alert_bell = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True: Alert when the bell character is received (output_vibra)
|
|
||||||
*/
|
|
||||||
bool alert_bell_vibra = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True: Alert when the bell character is received (output_buzzer)
|
|
||||||
*/
|
|
||||||
bool alert_bell_buzzer = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* use a PWM output instead of a simple on/off output. This will ignore
|
|
||||||
* the 'output', 'output_ms' and 'active' settings and use the
|
|
||||||
* device.buzzer_gpio instead.
|
|
||||||
*/
|
|
||||||
bool use_pwm = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The notification will toggle with 'output_ms' for this time of seconds.
|
|
||||||
* Default is 0 which means don't repeat at all. 60 would mean blink
|
|
||||||
* and/or beep for 60 seconds
|
|
||||||
*/
|
|
||||||
uint32 nag_timeout = 14;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When true, enables devices with native I2S audio output to use the RTTTL over speaker like a buzzer
|
|
||||||
* T-Watch S3 and T-Deck for example have this capability
|
|
||||||
*/
|
|
||||||
bool use_i2s_as_buzzer = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Store and Forward Module Config
|
|
||||||
*/
|
|
||||||
message StoreForwardConfig {
|
|
||||||
/*
|
|
||||||
* Enable the Store and Forward Module
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
bool heartbeat = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
uint32 records = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
uint32 history_return_max = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
uint32 history_return_window = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Preferences for the RangeTestModule
|
|
||||||
*/
|
|
||||||
message RangeTestConfig {
|
|
||||||
/*
|
|
||||||
* Enable the Range Test Module
|
|
||||||
*/
|
|
||||||
bool enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send out range test messages from this node
|
|
||||||
*/
|
|
||||||
uint32 sender = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bool value indicating that this node should save a RangeTest.csv file.
|
|
||||||
* ESP32 Only
|
|
||||||
*/
|
|
||||||
bool save = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Configuration for both device and environment metrics
|
|
||||||
*/
|
|
||||||
message TelemetryConfig {
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* device metrics to the mesh
|
|
||||||
*/
|
|
||||||
uint32 device_update_interval = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* environment measurements to the mesh
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint32 environment_update_interval = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Preferences for the Telemetry Module (Environment)
|
|
||||||
* Enable/Disable the telemetry measurement module measurement collection
|
|
||||||
*/
|
|
||||||
bool environment_measurement_enabled = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable/Disable the telemetry measurement module on-device display
|
|
||||||
*/
|
|
||||||
bool environment_screen_enabled = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We'll always read the sensor in Celsius, but sometimes we might want to
|
|
||||||
* display the results in Fahrenheit as a "user preference".
|
|
||||||
*/
|
|
||||||
bool environment_display_fahrenheit = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable/Disable the air quality metrics
|
|
||||||
*/
|
|
||||||
bool air_quality_enabled = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* air quality metrics to the mesh
|
|
||||||
*/
|
|
||||||
uint32 air_quality_interval = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* air quality metrics to the mesh
|
|
||||||
*/
|
|
||||||
bool power_measurement_enabled = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* air quality metrics to the mesh
|
|
||||||
*/
|
|
||||||
uint32 power_update_interval = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interval in seconds of how often we should try to send our
|
|
||||||
* air quality metrics to the mesh
|
|
||||||
*/
|
|
||||||
bool power_screen_enabled = 10;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
message CannedMessageConfig {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
enum InputEventChar {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
NONE = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
UP = 17;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
DOWN = 18;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
LEFT = 19;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
RIGHT = 20;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* '\n'
|
|
||||||
*/
|
|
||||||
SELECT = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
BACK = 27;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
CANCEL = 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable the rotary encoder #1. This is a 'dumb' encoder sending pulses on both A and B pins while rotating.
|
|
||||||
*/
|
|
||||||
bool rotary1_enabled = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO pin for rotary encoder A port.
|
|
||||||
*/
|
|
||||||
uint32 inputbroker_pin_a = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO pin for rotary encoder B port.
|
|
||||||
*/
|
|
||||||
uint32 inputbroker_pin_b = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO pin for rotary encoder Press port.
|
|
||||||
*/
|
|
||||||
uint32 inputbroker_pin_press = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Generate input event on CW of this kind.
|
|
||||||
*/
|
|
||||||
InputEventChar inputbroker_event_cw = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Generate input event on CCW of this kind.
|
|
||||||
*/
|
|
||||||
InputEventChar inputbroker_event_ccw = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Generate input event on Press of this kind.
|
|
||||||
*/
|
|
||||||
InputEventChar inputbroker_event_press = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable the Up/Down/Select input device. Can be RAK rotary encoder or 3 buttons. Uses the a/b/press definitions from inputbroker.
|
|
||||||
*/
|
|
||||||
bool updown1_enabled = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable/disable CannedMessageModule.
|
|
||||||
*/
|
|
||||||
bool enabled = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Input event origin accepted by the canned message module.
|
|
||||||
* Can be e.g. "rotEnc1", "upDownEnc1" or keyword "_any"
|
|
||||||
*/
|
|
||||||
string allow_input_source = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CannedMessageModule also sends a bell character with the messages.
|
|
||||||
* ExternalNotificationModule can benefit from this feature.
|
|
||||||
*/
|
|
||||||
bool send_bell = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Ambient Lighting Module - Settings for control of onboard LEDs to allow users to adjust the brightness levels and respective color levels.
|
|
||||||
Initially created for the RAK14001 RGB LED module.
|
|
||||||
*/
|
|
||||||
message AmbientLightingConfig {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets LED to on or off.
|
|
||||||
*/
|
|
||||||
bool led_state = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the current for the LED output. Default is 10.
|
|
||||||
*/
|
|
||||||
uint32 current = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the red LED level. Values are 0-255.
|
|
||||||
*/
|
|
||||||
uint32 red = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the green LED level. Values are 0-255.
|
|
||||||
*/
|
|
||||||
uint32 green = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the blue LED level. Values are 0-255.
|
|
||||||
*/
|
|
||||||
uint32 blue = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
oneof payload_variant {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
MQTTConfig mqtt = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
SerialConfig serial = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
ExternalNotificationConfig external_notification = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
StoreForwardConfig store_forward = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
RangeTestConfig range_test = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
TelemetryConfig telemetry = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
CannedMessageConfig canned_message = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
AudioConfig audio = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
RemoteHardwareConfig remote_hardware = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
NeighborInfoConfig neighbor_info = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
AmbientLightingConfig ambient_lighting = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
DetectionSensorConfig detection_sensor = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
PaxcounterConfig paxcounter = 13;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A GPIO pin definition for remote hardware module
|
|
||||||
*/
|
|
||||||
message RemoteHardwarePin {
|
|
||||||
/*
|
|
||||||
* GPIO Pin number (must match Arduino)
|
|
||||||
*/
|
|
||||||
uint32 gpio_pin = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Name for the GPIO pin (i.e. Front gate, mailbox, etc)
|
|
||||||
*/
|
|
||||||
string name = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Type of GPIO access available to consumers on the mesh
|
|
||||||
*/
|
|
||||||
RemoteHardwarePinType type = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum RemoteHardwarePinType {
|
|
||||||
/*
|
|
||||||
* Unset/unused
|
|
||||||
*/
|
|
||||||
UNKNOWN = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO pin can be read (if it is high / low)
|
|
||||||
*/
|
|
||||||
DIGITAL_READ = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO pin can be written to (high / low)
|
|
||||||
*/
|
|
||||||
DIGITAL_WRITE = 2;
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
*ServiceEnvelope.packet type:FT_POINTER
|
|
||||||
*ServiceEnvelope.channel_id type:FT_POINTER
|
|
||||||
*ServiceEnvelope.gateway_id type:FT_POINTER
|
|
||||||
|
|
||||||
*MapReport.long_name max_size:40
|
|
||||||
*MapReport.short_name max_size:5
|
|
||||||
*MapReport.firmware_version max_size:18
|
|
||||||
*MapReport.num_online_local_nodes int_size:16
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
import "meshtastic/mesh.proto";
|
|
||||||
import "meshtastic/config.proto";
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "MQTTProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This message wraps a MeshPacket with extra metadata about the sender and how it arrived.
|
|
||||||
*/
|
|
||||||
message ServiceEnvelope {
|
|
||||||
/*
|
|
||||||
* The (probably encrypted) packet
|
|
||||||
*/
|
|
||||||
MeshPacket packet = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The global channel ID it was sent on
|
|
||||||
*/
|
|
||||||
string channel_id = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The sending gateway node ID. Can we use this to authenticate/prevent fake
|
|
||||||
* nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as
|
|
||||||
* the globally trusted nodenum
|
|
||||||
*/
|
|
||||||
string gateway_id = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Information about a node intended to be reported unencrypted to a map using MQTT.
|
|
||||||
*/
|
|
||||||
message MapReport {
|
|
||||||
/*
|
|
||||||
* A full name for this user, i.e. "Kevin Hester"
|
|
||||||
*/
|
|
||||||
string long_name = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A VERY short name, ideally two characters.
|
|
||||||
* Suitable for a tiny OLED screen
|
|
||||||
*/
|
|
||||||
string short_name = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Role of the node that applies specific settings for a particular use-case
|
|
||||||
*/
|
|
||||||
Config.DeviceConfig.Role role = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Hardware model of the node, i.e. T-Beam, Heltec V3, etc...
|
|
||||||
*/
|
|
||||||
HardwareModel hw_model = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Device firmware version string
|
|
||||||
*/
|
|
||||||
string firmware_version = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The region code for the radio (US, CN, EU433, etc...)
|
|
||||||
*/
|
|
||||||
Config.LoRaConfig.RegionCode region = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Modem preset used by the radio (LongFast, MediumSlow, etc...)
|
|
||||||
*/
|
|
||||||
Config.LoRaConfig.ModemPreset modem_preset = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether the node has a channel with default PSK and name (LongFast, MediumSlow, etc...)
|
|
||||||
* and it uses the default frequency slot given the region and modem preset.
|
|
||||||
*/
|
|
||||||
bool has_default_channel = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Latitude: multiply by 1e-7 to get degrees in floating point
|
|
||||||
*/
|
|
||||||
sfixed32 latitude_i = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Longitude: multiply by 1e-7 to get degrees in floating point
|
|
||||||
*/
|
|
||||||
sfixed32 longitude_i = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Altitude in meters above MSL
|
|
||||||
*/
|
|
||||||
int32 altitude = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Indicates the bits of precision for latitude and longitude set by the sending node
|
|
||||||
*/
|
|
||||||
uint32 position_precision = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of online nodes (heard in the last 2 hours) this node has in its list that were received locally (not via MQTT)
|
|
||||||
*/
|
|
||||||
uint32 num_online_local_nodes = 13;
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "PaxcountProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
message Paxcount {
|
|
||||||
/*
|
|
||||||
* seen Wifi devices
|
|
||||||
*/
|
|
||||||
uint32 wifi = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Seen BLE devices
|
|
||||||
*/
|
|
||||||
uint32 ble = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Uptime in seconds
|
|
||||||
*/
|
|
||||||
uint32 uptime = 3;
|
|
||||||
}
|
|
||||||
@ -1,216 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "Portnums";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For any new 'apps' that run on the device or via sister apps on phones/PCs they should pick and use a
|
|
||||||
* unique 'portnum' for their application.
|
|
||||||
* If you are making a new app using meshtastic, please send in a pull request to add your 'portnum' to this
|
|
||||||
* master table.
|
|
||||||
* PortNums should be assigned in the following range:
|
|
||||||
* 0-63 Core Meshtastic use, do not use for third party apps
|
|
||||||
* 64-127 Registered 3rd party apps, send in a pull request that adds a new entry to portnums.proto to register your application
|
|
||||||
* 256-511 Use one of these portnums for your private applications that you don't want to register publically
|
|
||||||
* All other values are reserved.
|
|
||||||
* Note: This was formerly a Type enum named 'typ' with the same id #
|
|
||||||
* We have change to this 'portnum' based scheme for specifying app handlers for particular payloads.
|
|
||||||
* This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT values identically.
|
|
||||||
*/
|
|
||||||
enum PortNum {
|
|
||||||
/*
|
|
||||||
* Deprecated: do not use in new code (formerly called OPAQUE)
|
|
||||||
* A message sent from a device outside of the mesh, in a form the mesh does not understand
|
|
||||||
* NOTE: This must be 0, because it is documented in IMeshService.aidl to be so
|
|
||||||
* ENCODING: binary undefined
|
|
||||||
*/
|
|
||||||
UNKNOWN_APP = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A simple UTF-8 text message, which even the little micros in the mesh
|
|
||||||
* can understand and show on their screen eventually in some circumstances
|
|
||||||
* even signal might send messages in this form (see below)
|
|
||||||
* ENCODING: UTF-8 Plaintext (?)
|
|
||||||
*/
|
|
||||||
TEXT_MESSAGE_APP = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reserved for built-in GPIO/example app.
|
|
||||||
* See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
REMOTE_HARDWARE_APP = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The built-in position messaging app.
|
|
||||||
* Payload is a Position message.
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
POSITION_APP = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The built-in user info app.
|
|
||||||
* Payload is a User message.
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
NODEINFO_APP = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Protocol control packets for mesh protocol use.
|
|
||||||
* Payload is a Routing message.
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
ROUTING_APP = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Admin control packets.
|
|
||||||
* Payload is a AdminMessage message.
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
ADMIN_APP = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Compressed TEXT_MESSAGE payloads.
|
|
||||||
* ENCODING: UTF-8 Plaintext (?) with Unishox2 Compression
|
|
||||||
* NOTE: The Device Firmware converts a TEXT_MESSAGE_APP to TEXT_MESSAGE_COMPRESSED_APP if the compressed
|
|
||||||
* payload is shorter. There's no need for app developers to do this themselves. Also the firmware will decompress
|
|
||||||
* any incoming TEXT_MESSAGE_COMPRESSED_APP payload and convert to TEXT_MESSAGE_APP.
|
|
||||||
*/
|
|
||||||
TEXT_MESSAGE_COMPRESSED_APP = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Waypoint payloads.
|
|
||||||
* Payload is a Waypoint message.
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
WAYPOINT_APP = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Audio Payloads.
|
|
||||||
* Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now
|
|
||||||
* ENCODING: codec2 audio frames
|
|
||||||
* NOTE: audio frames contain a 3 byte header (0xc0 0xde 0xc2) and a one byte marker for the decompressed bitrate.
|
|
||||||
* This marker comes from the 'moduleConfig.audio.bitrate' enum minus one.
|
|
||||||
*/
|
|
||||||
AUDIO_APP = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Same as Text Message but originating from Detection Sensor Module.
|
|
||||||
* NOTE: This portnum traffic is not sent to the public MQTT starting at firmware version 2.2.9
|
|
||||||
*/
|
|
||||||
DETECTION_SENSOR_APP = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Provides a 'ping' service that replies to any packet it receives.
|
|
||||||
* Also serves as a small example module.
|
|
||||||
* ENCODING: ASCII Plaintext
|
|
||||||
*/
|
|
||||||
REPLY_APP = 32;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Used for the python IP tunnel feature
|
|
||||||
* ENCODING: IP Packet. Handled by the python API, firmware ignores this one and pases on.
|
|
||||||
*/
|
|
||||||
IP_TUNNEL_APP = 33;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Paxcounter lib included in the firmware
|
|
||||||
* ENCODING: protobuf
|
|
||||||
*/
|
|
||||||
PAXCOUNTER_APP = 34;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Provides a hardware serial interface to send and receive from the Meshtastic network.
|
|
||||||
* Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic
|
|
||||||
* network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network.
|
|
||||||
* Maximum packet size of 240 bytes.
|
|
||||||
* Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp.
|
|
||||||
* ENCODING: binary undefined
|
|
||||||
*/
|
|
||||||
SERIAL_APP = 64;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* STORE_FORWARD_APP (Work in Progress)
|
|
||||||
* Maintained by Jm Casler (MC Hamster) : jm@casler.org
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
STORE_FORWARD_APP = 65;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Optional port for messages for the range test module.
|
|
||||||
* ENCODING: ASCII Plaintext
|
|
||||||
* NOTE: This portnum traffic is not sent to the public MQTT starting at firmware version 2.2.9
|
|
||||||
*/
|
|
||||||
RANGE_TEST_APP = 66;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Provides a format to send and receive telemetry data from the Meshtastic network.
|
|
||||||
* Maintained by Charles Crossan (crossan007) : crossan007@gmail.com
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
TELEMETRY_APP = 67;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Experimental tools for estimating node position without a GPS
|
|
||||||
* Maintained by Github user a-f-G-U-C (a Meshtastic contributor)
|
|
||||||
* Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS
|
|
||||||
* ENCODING: arrays of int64 fields
|
|
||||||
*/
|
|
||||||
ZPS_APP = 68;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Used to let multiple instances of Linux native applications communicate
|
|
||||||
* as if they did using their LoRa chip.
|
|
||||||
* Maintained by GitHub user GUVWAF.
|
|
||||||
* Project files at https://github.com/GUVWAF/Meshtasticator
|
|
||||||
* ENCODING: Protobuf (?)
|
|
||||||
*/
|
|
||||||
SIMULATOR_APP = 69;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Provides a traceroute functionality to show the route a packet towards
|
|
||||||
* a certain destination would take on the mesh.
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
TRACEROUTE_APP = 70;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Aggregates edge info for the network by sending out a list of each node's neighbors
|
|
||||||
* ENCODING: Protobuf
|
|
||||||
*/
|
|
||||||
NEIGHBORINFO_APP = 71;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ATAK Plugin
|
|
||||||
* Portnum for payloads from the official Meshtastic ATAK plugin
|
|
||||||
*/
|
|
||||||
ATAK_PLUGIN = 72;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Provides unencrypted information about a node for consumption by a map via MQTT
|
|
||||||
*/
|
|
||||||
MAP_REPORT_APP = 73;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Private applications should use portnums >= 256.
|
|
||||||
* To simplify initial development and testing you can use "PRIVATE_APP"
|
|
||||||
* in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh))
|
|
||||||
*/
|
|
||||||
PRIVATE_APP = 256;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder
|
|
||||||
* ENCODING: libcotshrink
|
|
||||||
*/
|
|
||||||
ATAK_FORWARDER = 257;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Currently we limit port nums to no higher than this value
|
|
||||||
*/
|
|
||||||
MAX = 511;
|
|
||||||
}
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "RemoteHardware";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* An example app to show off the module system. This message is used for
|
|
||||||
* REMOTE_HARDWARE_APP PortNums.
|
|
||||||
* Also provides easy remote access to any GPIO.
|
|
||||||
* In the future other remote hardware operations can be added based on user interest
|
|
||||||
* (i.e. serial output, spi/i2c input/output).
|
|
||||||
* FIXME - currently this feature is turned on by default which is dangerous
|
|
||||||
* because no security yet (beyond the channel mechanism).
|
|
||||||
* It should be off by default and then protected based on some TBD mechanism
|
|
||||||
* (a special channel once multichannel support is included?)
|
|
||||||
*/
|
|
||||||
message HardwareMessage {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
enum Type {
|
|
||||||
/*
|
|
||||||
* Unset/unused
|
|
||||||
*/
|
|
||||||
UNSET = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set gpio gpios based on gpio_mask/gpio_value
|
|
||||||
*/
|
|
||||||
WRITE_GPIOS = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We are now interested in watching the gpio_mask gpios.
|
|
||||||
* If the selected gpios change, please broadcast GPIOS_CHANGED.
|
|
||||||
* Will implicitly change the gpios requested to be INPUT gpios.
|
|
||||||
*/
|
|
||||||
WATCH_GPIOS = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The gpios listed in gpio_mask have changed, the new values are listed in gpio_value
|
|
||||||
*/
|
|
||||||
GPIOS_CHANGED = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated
|
|
||||||
*/
|
|
||||||
READ_GPIOS = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A reply to READ_GPIOS. gpio_mask and gpio_value will be populated
|
|
||||||
*/
|
|
||||||
READ_GPIOS_REPLY = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* What type of HardwareMessage is this?
|
|
||||||
*/
|
|
||||||
Type type = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* What gpios are we changing. Not used for all MessageTypes, see MessageType for details
|
|
||||||
*/
|
|
||||||
uint64 gpio_mask = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For gpios that were listed in gpio_mask as valid, what are the signal levels for those gpios.
|
|
||||||
* Not used for all MessageTypes, see MessageType for details
|
|
||||||
*/
|
|
||||||
uint64 gpio_value = 3;
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*RTTTLConfig.ringtone max_size:230
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "RTTTLConfigProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Canned message module configuration.
|
|
||||||
*/
|
|
||||||
message RTTTLConfig {
|
|
||||||
/*
|
|
||||||
* Ringtone for PWM Buzzer in RTTTL Format.
|
|
||||||
*/
|
|
||||||
string ringtone = 1;
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*StoreAndForward.text max_size:237
|
|
||||||
@ -1,218 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "StoreAndForwardProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
message StoreAndForward {
|
|
||||||
/*
|
|
||||||
* 001 - 063 = From Router
|
|
||||||
* 064 - 127 = From Client
|
|
||||||
*/
|
|
||||||
enum RequestResponse {
|
|
||||||
/*
|
|
||||||
* Unset/unused
|
|
||||||
*/
|
|
||||||
UNSET = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router is an in error state.
|
|
||||||
*/
|
|
||||||
ROUTER_ERROR = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router heartbeat
|
|
||||||
*/
|
|
||||||
ROUTER_HEARTBEAT = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router has requested the client respond. This can work as a
|
|
||||||
* "are you there" message.
|
|
||||||
*/
|
|
||||||
ROUTER_PING = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The response to a "Ping"
|
|
||||||
*/
|
|
||||||
ROUTER_PONG = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router is currently busy. Please try again later.
|
|
||||||
*/
|
|
||||||
ROUTER_BUSY = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router is responding to a request for history.
|
|
||||||
*/
|
|
||||||
ROUTER_HISTORY = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router is responding to a request for stats.
|
|
||||||
*/
|
|
||||||
ROUTER_STATS = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router sends a text message from its history that was a direct message.
|
|
||||||
*/
|
|
||||||
ROUTER_TEXT_DIRECT = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router sends a text message from its history that was a broadcast.
|
|
||||||
*/
|
|
||||||
ROUTER_TEXT_BROADCAST = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Client is an in error state.
|
|
||||||
*/
|
|
||||||
CLIENT_ERROR = 64;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Client has requested a replay from the router.
|
|
||||||
*/
|
|
||||||
CLIENT_HISTORY = 65;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Client has requested stats from the router.
|
|
||||||
*/
|
|
||||||
CLIENT_STATS = 66;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Client has requested the router respond. This can work as a
|
|
||||||
* "are you there" message.
|
|
||||||
*/
|
|
||||||
CLIENT_PING = 67;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The response to a "Ping"
|
|
||||||
*/
|
|
||||||
CLIENT_PONG = 68;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Client has requested that the router abort processing the client's request
|
|
||||||
*/
|
|
||||||
CLIENT_ABORT = 106;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
message Statistics {
|
|
||||||
/*
|
|
||||||
* Number of messages we have ever seen
|
|
||||||
*/
|
|
||||||
uint32 messages_total = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of messages we have currently saved our history.
|
|
||||||
*/
|
|
||||||
uint32 messages_saved = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maximum number of messages we will save
|
|
||||||
*/
|
|
||||||
uint32 messages_max = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Router uptime in seconds
|
|
||||||
*/
|
|
||||||
uint32 up_time = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of times any client sent a request to the S&F.
|
|
||||||
*/
|
|
||||||
uint32 requests = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of times the history was requested.
|
|
||||||
*/
|
|
||||||
uint32 requests_history = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Is the heartbeat enabled on the server?
|
|
||||||
*/
|
|
||||||
bool heartbeat = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maximum number of messages the server will return.
|
|
||||||
*/
|
|
||||||
uint32 return_max = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maximum history window in minutes the server will return messages from.
|
|
||||||
*/
|
|
||||||
uint32 return_window = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
message History {
|
|
||||||
/*
|
|
||||||
* Number of that will be sent to the client
|
|
||||||
*/
|
|
||||||
uint32 history_messages = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The window of messages that was used to filter the history client requested
|
|
||||||
*/
|
|
||||||
uint32 window = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Index in the packet history of the last message sent in a previous request to the server.
|
|
||||||
* Will be sent to the client before sending the history and can be set in a subsequent request to avoid getting packets the server already sent to the client.
|
|
||||||
*/
|
|
||||||
uint32 last_request = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
message Heartbeat {
|
|
||||||
/*
|
|
||||||
* Period in seconds that the heartbeat is sent out that will be sent to the client
|
|
||||||
*/
|
|
||||||
uint32 period = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If set, this is not the primary Store & Forward router on the mesh
|
|
||||||
*/
|
|
||||||
uint32 secondary = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
RequestResponse rr = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
oneof variant {
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
Statistics stats = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
History history = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: REPLACE
|
|
||||||
*/
|
|
||||||
Heartbeat heartbeat = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Text from history message.
|
|
||||||
*/
|
|
||||||
bytes text = 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# options for nanopb
|
|
||||||
# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options
|
|
||||||
|
|
||||||
*EnvironmentMetrics.iaq int_size:16
|
|
||||||
@ -1,560 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "TelemetryProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Key native device metrics such as battery level
|
|
||||||
*/
|
|
||||||
message DeviceMetrics {
|
|
||||||
/*
|
|
||||||
* 0-100 (>100 means powered)
|
|
||||||
*/
|
|
||||||
optional uint32 battery_level = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Voltage measured
|
|
||||||
*/
|
|
||||||
optional float voltage = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise).
|
|
||||||
*/
|
|
||||||
optional float channel_utilization = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Percent of airtime for transmission used within the last hour.
|
|
||||||
*/
|
|
||||||
optional float air_util_tx = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* How long the device has been running since the last reboot (in seconds)
|
|
||||||
*/
|
|
||||||
optional uint32 uptime_seconds = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Weather station or other environmental metrics
|
|
||||||
*/
|
|
||||||
message EnvironmentMetrics {
|
|
||||||
/*
|
|
||||||
* Temperature measured
|
|
||||||
*/
|
|
||||||
optional float temperature = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Relative humidity percent measured
|
|
||||||
*/
|
|
||||||
optional float relative_humidity = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Barometric pressure in hPA measured
|
|
||||||
*/
|
|
||||||
optional float barometric_pressure = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Gas resistance in MOhm measured
|
|
||||||
*/
|
|
||||||
optional float gas_resistance = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Voltage measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x)
|
|
||||||
*/
|
|
||||||
optional float voltage = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Current measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x)
|
|
||||||
*/
|
|
||||||
optional float current = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* relative scale IAQ value as measured by Bosch BME680 . value 0-500.
|
|
||||||
* Belongs to Air Quality but is not particle but VOC measurement. Other VOC values can also be put in here.
|
|
||||||
*/
|
|
||||||
optional uint32 iaq = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm.
|
|
||||||
*/
|
|
||||||
optional float distance = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor.
|
|
||||||
*/
|
|
||||||
optional float lux = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor.
|
|
||||||
*/
|
|
||||||
optional float white_lux = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Infrared lux
|
|
||||||
*/
|
|
||||||
optional float ir_lux = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ultraviolet lux
|
|
||||||
*/
|
|
||||||
optional float uv_lux = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wind direction in degrees
|
|
||||||
* 0 degrees = North, 90 = East, etc...
|
|
||||||
*/
|
|
||||||
optional uint32 wind_direction = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wind speed in m/s
|
|
||||||
*/
|
|
||||||
optional float wind_speed = 14;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Weight in KG
|
|
||||||
*/
|
|
||||||
optional float weight = 15;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wind gust in m/s
|
|
||||||
*/
|
|
||||||
optional float wind_gust = 16;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wind lull in m/s
|
|
||||||
*/
|
|
||||||
optional float wind_lull = 17;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Radiation in µR/h
|
|
||||||
*/
|
|
||||||
optional float radiation = 18;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Power Metrics (voltage / current / etc)
|
|
||||||
*/
|
|
||||||
message PowerMetrics {
|
|
||||||
/*
|
|
||||||
* Voltage (Ch1)
|
|
||||||
*/
|
|
||||||
optional float ch1_voltage = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Current (Ch1)
|
|
||||||
*/
|
|
||||||
optional float ch1_current = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Voltage (Ch2)
|
|
||||||
*/
|
|
||||||
optional float ch2_voltage = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Current (Ch2)
|
|
||||||
*/
|
|
||||||
optional float ch2_current = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Voltage (Ch3)
|
|
||||||
*/
|
|
||||||
optional float ch3_voltage = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Current (Ch3)
|
|
||||||
*/
|
|
||||||
optional float ch3_current = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Air quality metrics
|
|
||||||
*/
|
|
||||||
message AirQualityMetrics {
|
|
||||||
/*
|
|
||||||
* Concentration Units Standard PM1.0
|
|
||||||
*/
|
|
||||||
optional uint32 pm10_standard = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Concentration Units Standard PM2.5
|
|
||||||
*/
|
|
||||||
optional uint32 pm25_standard = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Concentration Units Standard PM10.0
|
|
||||||
*/
|
|
||||||
optional uint32 pm100_standard = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Concentration Units Environmental PM1.0
|
|
||||||
*/
|
|
||||||
optional uint32 pm10_environmental = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Concentration Units Environmental PM2.5
|
|
||||||
*/
|
|
||||||
optional uint32 pm25_environmental = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Concentration Units Environmental PM10.0
|
|
||||||
*/
|
|
||||||
optional uint32 pm100_environmental = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 0.3um Particle Count
|
|
||||||
*/
|
|
||||||
optional uint32 particles_03um = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 0.5um Particle Count
|
|
||||||
*/
|
|
||||||
optional uint32 particles_05um = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 1.0um Particle Count
|
|
||||||
*/
|
|
||||||
optional uint32 particles_10um = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 2.5um Particle Count
|
|
||||||
*/
|
|
||||||
optional uint32 particles_25um = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 5.0um Particle Count
|
|
||||||
*/
|
|
||||||
optional uint32 particles_50um = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 10.0um Particle Count
|
|
||||||
*/
|
|
||||||
optional uint32 particles_100um = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 10.0um Particle Count
|
|
||||||
*/
|
|
||||||
optional uint32 co2 = 13;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Local device mesh statistics
|
|
||||||
*/
|
|
||||||
message LocalStats {
|
|
||||||
/*
|
|
||||||
* How long the device has been running since the last reboot (in seconds)
|
|
||||||
*/
|
|
||||||
uint32 uptime_seconds = 1;
|
|
||||||
/*
|
|
||||||
* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise).
|
|
||||||
*/
|
|
||||||
float channel_utilization = 2;
|
|
||||||
/*
|
|
||||||
* Percent of airtime for transmission used within the last hour.
|
|
||||||
*/
|
|
||||||
float air_util_tx = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of packets sent
|
|
||||||
*/
|
|
||||||
uint32 num_packets_tx = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of packets received (both good and bad)
|
|
||||||
*/
|
|
||||||
uint32 num_packets_rx = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of packets received that are malformed or violate the protocol
|
|
||||||
*/
|
|
||||||
uint32 num_packets_rx_bad = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of nodes online (in the past 2 hours)
|
|
||||||
*/
|
|
||||||
uint32 num_online_nodes = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of nodes total
|
|
||||||
*/
|
|
||||||
uint32 num_total_nodes = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of received packets that were duplicates (due to multiple nodes relaying).
|
|
||||||
* If this number is high, there are nodes in the mesh relaying packets when it's unnecessary, for example due to the ROUTER/REPEATER role.
|
|
||||||
*/
|
|
||||||
uint32 num_rx_dupe = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of packets we transmitted that were a relay for others (not originating from ourselves).
|
|
||||||
*/
|
|
||||||
uint32 num_tx_relay = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Number of times we canceled a packet to be relayed, because someone else did it before us.
|
|
||||||
* This will always be zero for ROUTERs/REPEATERs. If this number is high, some other node(s) is/are relaying faster than you.
|
|
||||||
*/
|
|
||||||
uint32 num_tx_relay_canceled = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Health telemetry metrics
|
|
||||||
*/
|
|
||||||
message HealthMetrics {
|
|
||||||
/*
|
|
||||||
* Heart rate (beats per minute)
|
|
||||||
*/
|
|
||||||
optional uint32 heart_bpm = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SpO2 (blood oxygen saturation) level
|
|
||||||
*/
|
|
||||||
optional uint32 spO2 = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Body temperature in degrees Celsius
|
|
||||||
*/
|
|
||||||
optional float temperature = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Types of Measurements the telemetry module is equipped to handle
|
|
||||||
*/
|
|
||||||
message Telemetry {
|
|
||||||
/*
|
|
||||||
* Seconds since 1970 - or 0 for unknown/unset
|
|
||||||
*/
|
|
||||||
fixed32 time = 1;
|
|
||||||
|
|
||||||
oneof variant {
|
|
||||||
/*
|
|
||||||
* Key native device metrics such as battery level
|
|
||||||
*/
|
|
||||||
DeviceMetrics device_metrics = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Weather station or other environmental metrics
|
|
||||||
*/
|
|
||||||
EnvironmentMetrics environment_metrics = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Air quality metrics
|
|
||||||
*/
|
|
||||||
AirQualityMetrics air_quality_metrics = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Power Metrics
|
|
||||||
*/
|
|
||||||
PowerMetrics power_metrics = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Local device mesh statistics
|
|
||||||
*/
|
|
||||||
LocalStats local_stats = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Health telemetry metrics
|
|
||||||
*/
|
|
||||||
HealthMetrics health_metrics = 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Supported I2C Sensors for telemetry in Meshtastic
|
|
||||||
*/
|
|
||||||
enum TelemetrySensorType {
|
|
||||||
/*
|
|
||||||
* No external telemetry sensor explicitly set
|
|
||||||
*/
|
|
||||||
SENSOR_UNSET = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* High accuracy temperature, pressure, humidity
|
|
||||||
*/
|
|
||||||
BME280 = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* High accuracy temperature, pressure, humidity, and air resistance
|
|
||||||
*/
|
|
||||||
BME680 = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Very high accuracy temperature
|
|
||||||
*/
|
|
||||||
MCP9808 = 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Moderate accuracy current and voltage
|
|
||||||
*/
|
|
||||||
INA260 = 4;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Moderate accuracy current and voltage
|
|
||||||
*/
|
|
||||||
INA219 = 5;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* High accuracy temperature and pressure
|
|
||||||
*/
|
|
||||||
BMP280 = 6;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* High accuracy temperature and humidity
|
|
||||||
*/
|
|
||||||
SHTC3 = 7;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* High accuracy pressure
|
|
||||||
*/
|
|
||||||
LPS22 = 8;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 3-Axis magnetic sensor
|
|
||||||
*/
|
|
||||||
QMC6310 = 9;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 6-Axis inertial measurement sensor
|
|
||||||
*/
|
|
||||||
QMI8658 = 10;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 3-Axis magnetic sensor
|
|
||||||
*/
|
|
||||||
QMC5883L = 11;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* High accuracy temperature and humidity
|
|
||||||
*/
|
|
||||||
SHT31 = 12;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PM2.5 air quality sensor
|
|
||||||
*/
|
|
||||||
PMSA003I = 13;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* INA3221 3 Channel Voltage / Current Sensor
|
|
||||||
*/
|
|
||||||
INA3221 = 14;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BMP085/BMP180 High accuracy temperature and pressure (older Version of BMP280)
|
|
||||||
*/
|
|
||||||
BMP085 = 15;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RCWL-9620 Doppler Radar Distance Sensor, used for water level detection
|
|
||||||
*/
|
|
||||||
RCWL9620 = 16;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sensirion High accuracy temperature and humidity
|
|
||||||
*/
|
|
||||||
SHT4X = 17;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor.
|
|
||||||
*/
|
|
||||||
VEML7700 = 18;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MLX90632 non-contact IR temperature sensor.
|
|
||||||
*/
|
|
||||||
MLX90632 = 19;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TI OPT3001 Ambient Light Sensor
|
|
||||||
*/
|
|
||||||
OPT3001 = 20;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Lite On LTR-390UV-01 UV Light Sensor
|
|
||||||
*/
|
|
||||||
LTR390UV = 21;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* AMS TSL25911FN RGB Light Sensor
|
|
||||||
*/
|
|
||||||
TSL25911FN = 22;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* AHT10 Integrated temperature and humidity sensor
|
|
||||||
*/
|
|
||||||
AHT10 = 23;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DFRobot Lark Weather station (temperature, humidity, pressure, wind speed and direction)
|
|
||||||
*/
|
|
||||||
DFROBOT_LARK = 24;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NAU7802 Scale Chip or compatible
|
|
||||||
*/
|
|
||||||
NAU7802 = 25;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BMP3XX High accuracy temperature and pressure
|
|
||||||
*/
|
|
||||||
BMP3XX = 26;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ICM-20948 9-Axis digital motion processor
|
|
||||||
*/
|
|
||||||
ICM20948 = 27;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MAX17048 1S lipo battery sensor (voltage, state of charge, time to go)
|
|
||||||
*/
|
|
||||||
MAX17048 = 28;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Custom I2C sensor implementation based on https://github.com/meshtastic/i2c-sensor
|
|
||||||
*/
|
|
||||||
CUSTOM_SENSOR = 29;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MAX30102 Pulse Oximeter and Heart-Rate Sensor
|
|
||||||
*/
|
|
||||||
MAX30102 = 30;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MLX90614 non-contact IR temperature sensor
|
|
||||||
*/
|
|
||||||
MLX90614 = 31;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SCD40/SCD41 CO2, humidity, temperature sensor
|
|
||||||
*/
|
|
||||||
SCD4X = 32;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ClimateGuard RadSens, radiation, Geiger-Muller Tube
|
|
||||||
*/
|
|
||||||
RADSENS = 33;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* High accuracy current and voltage
|
|
||||||
*/
|
|
||||||
INA226 = 34;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NAU7802 Telemetry configuration, for saving to flash
|
|
||||||
*/
|
|
||||||
message Nau7802Config {
|
|
||||||
/*
|
|
||||||
* The offset setting for the NAU7802
|
|
||||||
*/
|
|
||||||
int32 zeroOffset = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The calibration factor for the NAU7802
|
|
||||||
*/
|
|
||||||
float calibrationFactor = 2;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
# options for nanopb
|
|
||||||
# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options
|
|
||||||
|
|
||||||
*XModem.buffer max_size:128
|
|
||||||
*XModem.seq int_size:16
|
|
||||||
*XModem.crc16 int_size:16
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meshtastic;
|
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
|
||||||
option go_package = "github.com/meshtastic/go/generated";
|
|
||||||
option java_outer_classname = "XmodemProtos";
|
|
||||||
option java_package = "com.geeksville.mesh";
|
|
||||||
option swift_prefix = "";
|
|
||||||
|
|
||||||
message XModem {
|
|
||||||
enum Control {
|
|
||||||
NUL = 0;
|
|
||||||
SOH = 1;
|
|
||||||
STX = 2;
|
|
||||||
EOT = 4;
|
|
||||||
ACK = 6;
|
|
||||||
NAK = 21;
|
|
||||||
CAN = 24;
|
|
||||||
CTRLZ = 26;
|
|
||||||
}
|
|
||||||
|
|
||||||
Control control = 1;
|
|
||||||
uint32 seq = 2;
|
|
||||||
uint32 crc16 = 3;
|
|
||||||
bytes buffer = 4;
|
|
||||||
}
|
|
||||||
@ -6,7 +6,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
database:
|
database:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
command: "--mqtt-topic=msh/US/#"
|
command: "--mqtt-broker-url= --mqtt-topic=msh/US/# --collect-service-envelopes --collect-neighbor-info --collect-waypoints"
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: "mysql://root:password@database:3306/meshtastic-map?connection_limit=100"
|
DATABASE_URL: "mysql://root:password@database:3306/meshtastic-map?connection_limit=100"
|
||||||
|
|
||||||
|
|||||||
1
lora/.npmrc
Normal file
1
lora/.npmrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
@jsr:registry=https://npm.jsr.io
|
||||||
60
lora/LoraStream.js
Normal file
60
lora/LoraStream.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import { Transform } from 'stream';
|
||||||
|
|
||||||
|
export default class LoraStream extends Transform {
|
||||||
|
constructor(options) {
|
||||||
|
super(options);
|
||||||
|
this.byteBuffer = new Uint8Array([]);
|
||||||
|
this.textDecoder = new TextDecoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
_transform(chunk, encoding, callback) {
|
||||||
|
this.byteBuffer = new Uint8Array([
|
||||||
|
...this.byteBuffer,
|
||||||
|
...chunk,
|
||||||
|
]);
|
||||||
|
let processingExhausted = false;
|
||||||
|
while (this.byteBuffer.length !== 0 && !processingExhausted) {
|
||||||
|
const framingIndex = this.byteBuffer.findIndex((byte) => byte === 0x94);
|
||||||
|
const framingByte2 = this.byteBuffer[framingIndex + 1];
|
||||||
|
if (framingByte2 === 0xc3) {
|
||||||
|
if (this.byteBuffer.subarray(0, framingIndex).length) {
|
||||||
|
this.byteBuffer = this.byteBuffer.subarray(framingIndex);
|
||||||
|
}
|
||||||
|
const msb = this.byteBuffer[2];
|
||||||
|
const lsb = this.byteBuffer[3];
|
||||||
|
if (msb !== undefined && lsb !== undefined && this.byteBuffer.length >= 4 + (msb << 8) + lsb) {
|
||||||
|
const packet = this.byteBuffer.subarray(4, 4 + (msb << 8) + lsb);
|
||||||
|
|
||||||
|
const malformedDetectorIndex = packet.findIndex(
|
||||||
|
(byte) => byte === 0x94,
|
||||||
|
);
|
||||||
|
if (malformedDetectorIndex !== -1 && packet[malformedDetectorIndex + 1] === 0xc3) {
|
||||||
|
// malformed
|
||||||
|
this.byteBuffer = this.byteBuffer.subarray(malformedDetectorIndex);
|
||||||
|
} else {
|
||||||
|
this.byteBuffer = this.byteBuffer.subarray(3 + (msb << 8) + lsb + 1);
|
||||||
|
this.push(packet);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/** Only partioal message in buffer, wait for the rest */
|
||||||
|
processingExhausted = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/** Message not complete, only 1 byte in buffer */
|
||||||
|
processingExhausted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
_flush(callback) {
|
||||||
|
try {
|
||||||
|
if (this._buffer) {
|
||||||
|
this.push(this._buffer.trim());
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
} catch (err) {
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
62
lora/MeshtasticStream.js
Normal file
62
lora/MeshtasticStream.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import { Transform } from 'stream';
|
||||||
|
import { Mesh, Channel, Config, ModuleConfig } from '@meshtastic/protobufs';
|
||||||
|
import { fromBinary, create } from '@bufbuild/protobuf';
|
||||||
|
|
||||||
|
export default class MeshtasticStream extends Transform {
|
||||||
|
constructor(options) {
|
||||||
|
super({ readableObjectMode: true, ...options });
|
||||||
|
}
|
||||||
|
_transform(chunk, encoding, callback) {
|
||||||
|
const dataPacket = fromBinary(Mesh.FromRadioSchema, chunk);
|
||||||
|
let schema = null;
|
||||||
|
switch(dataPacket.payloadVariant.case) {
|
||||||
|
case 'packet':
|
||||||
|
schema = Mesh.MeshPacketSchema;
|
||||||
|
break;
|
||||||
|
case 'nodeInfo':
|
||||||
|
schema = Mesh.NodeInfoSchema;
|
||||||
|
break;
|
||||||
|
case 'myInfo':
|
||||||
|
schema = Mesh.MyNodeInfoSchema;
|
||||||
|
break;
|
||||||
|
case 'deviceuiConfig':
|
||||||
|
// can't find, come back to this
|
||||||
|
break;
|
||||||
|
case 'config':
|
||||||
|
schema = Config.ConfigSchema
|
||||||
|
break;
|
||||||
|
case 'moduleConfig':
|
||||||
|
schema = ModuleConfig.ModuleConfigSchema
|
||||||
|
break;
|
||||||
|
case 'fileInfo':
|
||||||
|
schema = Mesh.FileInfoSchema
|
||||||
|
break;
|
||||||
|
case 'channel':
|
||||||
|
schema = Channel.ChannelSchema
|
||||||
|
break;
|
||||||
|
case 'metadata':
|
||||||
|
schema = Mesh.DeviceMetadataSchema
|
||||||
|
break;
|
||||||
|
case 'logRecord':
|
||||||
|
schema = Mesh.LogRecordSchema
|
||||||
|
break;
|
||||||
|
case 'configCompleteId':
|
||||||
|
// done sending init data
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (schema !== null) {
|
||||||
|
this.push(create(schema, dataPacket.payloadVariant.value));
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
_flush(callback) {
|
||||||
|
try {
|
||||||
|
if (this._buffer) {
|
||||||
|
this.push(this._buffer.trim());
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
} catch (err) {
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
107
lora/index.js
Normal file
107
lora/index.js
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import { Mesh, Mqtt, Portnums, Telemetry, Config, Channel } from '@meshtastic/protobufs';
|
||||||
|
import { fromBinary, toBinary, create } from '@bufbuild/protobuf';
|
||||||
|
import { LoraStream } from './LoraStream';
|
||||||
|
import { MeshtasticStream } from './MeshtasticStream';
|
||||||
|
import net from 'net';
|
||||||
|
|
||||||
|
const client = new net.Socket();
|
||||||
|
const IP = '192.168.10.117';
|
||||||
|
const PORT = 4403;
|
||||||
|
|
||||||
|
function sendHello() {
|
||||||
|
const data = create(Mesh.ToRadioSchema, {
|
||||||
|
payloadVariant: {
|
||||||
|
case: 'wantConfigId',
|
||||||
|
value: 1,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sendToDevice(toBinary(Mesh.ToRadioSchema, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendToDevice(data) {
|
||||||
|
const bufferLength = data.length;
|
||||||
|
const header = new Uint8Array([
|
||||||
|
0x94,
|
||||||
|
0xC3,
|
||||||
|
(bufferLength >> 8) & 0xFF,
|
||||||
|
bufferLength & 0xFF,
|
||||||
|
]);
|
||||||
|
data = new Uint8Array([...header, ...data]);
|
||||||
|
client.write(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.connect(PORT, IP, function() {
|
||||||
|
console.log('Connected');
|
||||||
|
sendHello();
|
||||||
|
});
|
||||||
|
|
||||||
|
const meshtasticStream = new MeshtasticStream();
|
||||||
|
client.pipe(new LoraStream()).pipe(meshtasticStream);
|
||||||
|
meshtasticStream.on('data', (data) => {
|
||||||
|
parseMeshtastic(data['$typeName'], data);
|
||||||
|
})
|
||||||
|
|
||||||
|
function parseMeshtastic(typeName, data) {
|
||||||
|
switch(typeName) {
|
||||||
|
case Mesh.MeshPacketSchema.typeName:
|
||||||
|
onMeshPacket(data);
|
||||||
|
break;
|
||||||
|
case Mesh.NodeInfoSchema.typeName:
|
||||||
|
console.log('node info');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMeshPacket(envelope) {
|
||||||
|
const payloadVariant = envelope.payloadVariant.case;
|
||||||
|
|
||||||
|
if (payloadVariant === 'encrypted') {
|
||||||
|
// attempt decryption
|
||||||
|
}
|
||||||
|
|
||||||
|
const dataPacket = envelope.payloadVariant.value;
|
||||||
|
const portNum = dataPacket.portnum;
|
||||||
|
|
||||||
|
if (!portNum) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let schema = null;
|
||||||
|
switch (portNum) {
|
||||||
|
case Portnums.PortNum.POSITION_APP:
|
||||||
|
schema = Mesh.PositionSchema;
|
||||||
|
break;
|
||||||
|
case Portnums.PortNum.TELEMETRY_APP:
|
||||||
|
schema = Telemetry.TelemetrySchema;
|
||||||
|
break;
|
||||||
|
case Portnums.PortNum.TEXT_MESSAGE_APP:
|
||||||
|
// no schema?
|
||||||
|
break;
|
||||||
|
case Portnums.PortNum.WAYPOINT_APP:
|
||||||
|
schema = Mesh.WaypointSchema;
|
||||||
|
break;
|
||||||
|
case Portnums.PortNum.TRACEROUTE_APP:
|
||||||
|
schema = Mesh.RouteDiscoverySchema;
|
||||||
|
break;
|
||||||
|
case Portnums.PortNum.NODEINFO_APP:
|
||||||
|
schema = Mesh.NodeInfoSchema;
|
||||||
|
break;
|
||||||
|
case Portnums.PortNum.NEIGHBORINFO_APP:
|
||||||
|
schema = Mesh.NeighborInfoSchema;
|
||||||
|
break;
|
||||||
|
case Portnums.PortNum.MAP_REPORT_APP:
|
||||||
|
schema = Mqtt.MapReportSchema;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let decodedData = dataPacket.payload;
|
||||||
|
if (schema !== null) {
|
||||||
|
try {
|
||||||
|
decodedData = fromBinary(schema, decodedData);
|
||||||
|
console.log(decodedData);
|
||||||
|
} catch(e) {
|
||||||
|
// ignore errors, likely incomplete data
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
341
lora/package-lock.json
generated
Normal file
341
lora/package-lock.json
generated
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
{
|
||||||
|
"name": "lora",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "lora",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@bufbuild/protobuf": "^2.2.5",
|
||||||
|
"@meshtastic/protobufs": "npm:@jsr/meshtastic__protobufs@^2.6.2",
|
||||||
|
"@prisma/client": "^5.11.0",
|
||||||
|
"command-line-args": "^5.2.1",
|
||||||
|
"command-line-usage": "^7.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"prisma": "^5.10.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@bufbuild/protobuf": {
|
||||||
|
"version": "2.2.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.2.5.tgz",
|
||||||
|
"integrity": "sha512-/g5EzJifw5GF8aren8wZ/G5oMuPoGeS6MQD3ca8ddcvdXR5UELUfdTZITCGNhNXynY/AYl3Z4plmxdj/tRl/hQ==",
|
||||||
|
"license": "(Apache-2.0 AND BSD-3-Clause)"
|
||||||
|
},
|
||||||
|
"node_modules/@meshtastic/protobufs": {
|
||||||
|
"name": "@jsr/meshtastic__protobufs",
|
||||||
|
"version": "2.6.2",
|
||||||
|
"resolved": "https://npm.jsr.io/~/11/@jsr/meshtastic__protobufs/2.6.2.tgz",
|
||||||
|
"integrity": "sha512-bIENtFnUEru28GrAeSdiBS9skp0hN/3HZunMbF/IjvUrXOlx2fptKVj3b+pzjOWnLBZxllrByV/W+XDmrxqJ6g==",
|
||||||
|
"dependencies": {
|
||||||
|
"@bufbuild/protobuf": "^2.2.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@prisma/client": {
|
||||||
|
"version": "5.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.22.0.tgz",
|
||||||
|
"integrity": "sha512-M0SVXfyHnQREBKxCgyo7sffrKttwE6R8PMq330MIUF0pTwjUhLbW84pFDlf06B27XyCR++VtjugEnIHdr07SVA==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.13"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"prisma": "*"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"prisma": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@prisma/debug": {
|
||||||
|
"version": "5.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.22.0.tgz",
|
||||||
|
"integrity": "sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==",
|
||||||
|
"devOptional": true,
|
||||||
|
"license": "Apache-2.0"
|
||||||
|
},
|
||||||
|
"node_modules/@prisma/engines": {
|
||||||
|
"version": "5.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.22.0.tgz",
|
||||||
|
"integrity": "sha512-UNjfslWhAt06kVL3CjkuYpHAWSO6L4kDCVPegV6itt7nD1kSJavd3vhgAEhjglLJJKEdJ7oIqDJ+yHk6qO8gPA==",
|
||||||
|
"devOptional": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@prisma/debug": "5.22.0",
|
||||||
|
"@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2",
|
||||||
|
"@prisma/fetch-engine": "5.22.0",
|
||||||
|
"@prisma/get-platform": "5.22.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@prisma/engines-version": {
|
||||||
|
"version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2.tgz",
|
||||||
|
"integrity": "sha512-2PTmxFR2yHW/eB3uqWtcgRcgAbG1rwG9ZriSvQw+nnb7c4uCr3RAcGMb6/zfE88SKlC1Nj2ziUvc96Z379mHgQ==",
|
||||||
|
"devOptional": true,
|
||||||
|
"license": "Apache-2.0"
|
||||||
|
},
|
||||||
|
"node_modules/@prisma/fetch-engine": {
|
||||||
|
"version": "5.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.22.0.tgz",
|
||||||
|
"integrity": "sha512-bkrD/Mc2fSvkQBV5EpoFcZ87AvOgDxbG99488a5cexp5Ccny+UM6MAe/UFkUC0wLYD9+9befNOqGiIJhhq+HbA==",
|
||||||
|
"devOptional": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@prisma/debug": "5.22.0",
|
||||||
|
"@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2",
|
||||||
|
"@prisma/get-platform": "5.22.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@prisma/get-platform": {
|
||||||
|
"version": "5.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.22.0.tgz",
|
||||||
|
"integrity": "sha512-pHhpQdr1UPFpt+zFfnPazhulaZYCUqeIcPpJViYoq9R+D/yw4fjE+CtnsnKzPYm0ddUbeXUzjGVGIRVgPDCk4Q==",
|
||||||
|
"devOptional": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@prisma/debug": "5.22.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/array-back": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/chalk": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/chalk-template": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"chalk": "^4.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/chalk-template?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-convert": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/command-line-args": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"array-back": "^3.1.0",
|
||||||
|
"find-replace": "^3.0.0",
|
||||||
|
"lodash.camelcase": "^4.3.0",
|
||||||
|
"typical": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/command-line-usage": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-PqMLy5+YGwhMh1wS04mVG44oqDsgyLRSKJBdOo1bnYhMKBW65gZF1dRp2OZRhiTjgUHljy99qkO7bsctLaw35Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"array-back": "^6.2.2",
|
||||||
|
"chalk-template": "^0.4.0",
|
||||||
|
"table-layout": "^4.1.0",
|
||||||
|
"typical": "^7.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.20.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/command-line-usage/node_modules/array-back": {
|
||||||
|
"version": "6.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/array-back/-/array-back-6.2.2.tgz",
|
||||||
|
"integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/command-line-usage/node_modules/typical": {
|
||||||
|
"version": "7.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/typical/-/typical-7.3.0.tgz",
|
||||||
|
"integrity": "sha512-ya4mg/30vm+DOWfBg4YK3j2WD6TWtRkCbasOJr40CseYENzCUby/7rIvXA99JGsQHeNxLbnXdyLLxKSv3tauFw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/find-replace": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"array-back": "^3.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fsevents": {
|
||||||
|
"version": "2.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||||
|
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/has-flag": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lodash.camelcase": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/prisma": {
|
||||||
|
"version": "5.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.22.0.tgz",
|
||||||
|
"integrity": "sha512-vtpjW3XuYCSnMsNVBjLMNkTj6OZbudcPPTPYHqX0CJfpcdWciI1dM8uHETwmDxxiqEwCIE6WvXucWUetJgfu/A==",
|
||||||
|
"devOptional": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@prisma/engines": "5.22.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"prisma": "build/index.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.13"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "2.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/supports-color": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"has-flag": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/table-layout": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/table-layout/-/table-layout-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-iK5/YhZxq5GO5z8wb0bY1317uDF3Zjpha0QFFLA8/trAoiLbQD0HUbMesEaxyzUgDxi2QlcbM8IvqOlEjgoXBA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"array-back": "^6.2.2",
|
||||||
|
"wordwrapjs": "^5.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/table-layout/node_modules/array-back": {
|
||||||
|
"version": "6.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/array-back/-/array-back-6.2.2.tgz",
|
||||||
|
"integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typical": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/wordwrapjs": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.17"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
lora/package.json
Normal file
19
lora/package.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "lora",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"description": "",
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"@bufbuild/protobuf": "^2.2.5",
|
||||||
|
"@meshtastic/protobufs": "npm:@jsr/meshtastic__protobufs@^2.6.2",
|
||||||
|
"@prisma/client": "^5.11.0",
|
||||||
|
"command-line-args": "^5.2.1",
|
||||||
|
"command-line-usage": "^7.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"prisma": "^5.10.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
1260
mqtt/index.js
1260
mqtt/index.js
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "",
|
"description": "",
|
||||||
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bufbuild/protobuf": "^2.2.5",
|
"@bufbuild/protobuf": "^2.2.5",
|
||||||
"@meshtastic/protobufs": "npm:@jsr/meshtastic__protobufs@^2.6.2",
|
"@meshtastic/protobufs": "npm:@jsr/meshtastic__protobufs@^2.6.2",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
class NodeIdUtil {
|
export default class NodeIdUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the provided hex id to a numeric id, for example: !FFFFFFFF to 4294967295
|
* Converts the provided hex id to a numeric id, for example: !FFFFFFFF to 4294967295
|
||||||
@ -18,6 +18,4 @@ class NodeIdUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = NodeIdUtil;
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
class PositionUtil {
|
export default class PositionUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obfuscates the provided latitude or longitude down to the provided precision in bits.
|
* Obfuscates the provided latitude or longitude down to the provided precision in bits.
|
||||||
@ -61,6 +61,4 @@ class PositionUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PositionUtil;
|
|
||||||
1
webapp/.npmrc
Normal file
1
webapp/.npmrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
@jsr:registry=https://npm.jsr.io
|
||||||
3689
webapp/frontend/package-lock.json
generated
3689
webapp/frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,22 +10,22 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/vite": "^4.1.4",
|
"@tailwindcss/vite": "^4.1.4",
|
||||||
"@vueuse/core": "^13.1.0",
|
"@turf/turf": "^7.2.0",
|
||||||
"axios": "^1.8.4",
|
"axios": "^1.8.4",
|
||||||
"chart.js": "^4.4.8",
|
"chart.js": "^4.4.8",
|
||||||
"chartjs-adapter-moment": "^1.0.1",
|
"chartjs-adapter-moment": "^1.0.1",
|
||||||
"install": "^0.13.0",
|
"lodash": "^4.17.21",
|
||||||
"leaflet": "^1.9.4",
|
"maplibre-gl": "^5.3.1",
|
||||||
"leaflet-groupedlayercontrol": "^0.6.1",
|
|
||||||
"leaflet.markercluster": "^1.5.3",
|
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
|
"pinia": "^3.0.2",
|
||||||
|
"pinia-plugin-persistedstate": "^4.2.0",
|
||||||
|
"rbush": "^4.0.1",
|
||||||
"tailwindcss": "^4.1.4",
|
"tailwindcss": "^4.1.4",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-router": "^4.5.0"
|
"vue-router": "^4.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
|
||||||
"vite": "^6.2.4",
|
"vite": "^6.2.4",
|
||||||
"vite-plugin-vue-devtools": "^7.7.2"
|
"vite-plugin-vue-devtools": "^7.7.2"
|
||||||
}
|
}
|
||||||
|
|||||||
386
webapp/frontend/public/text-message-embed.html
Normal file
386
webapp/frontend/public/text-message-embed.html
Normal file
@ -0,0 +1,386 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>Meshtastic Messages</title>
|
||||||
|
|
||||||
|
<!-- tailwind css -->
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
|
||||||
|
<!-- moment -->
|
||||||
|
<script src="https://app.unpkg.com/moment@2.29.1/files/dist/moment.js"></script>
|
||||||
|
|
||||||
|
<!-- vuejs -->
|
||||||
|
<script src="https://app.unpkg.com/vue@3.4.26/files/dist/vue.global.js"></script>
|
||||||
|
|
||||||
|
<!-- axios -->
|
||||||
|
<script src="https://app.unpkg.com/axios@1.6.8/files/dist/axios.min.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
/* used to prevent ui flicker before vuejs loads */
|
||||||
|
[v-cloak] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="h-full">
|
||||||
|
<div id="app" v-cloak>
|
||||||
|
<div class="h-full flex flex-col overflow-hidden">
|
||||||
|
|
||||||
|
<!-- empty state -->
|
||||||
|
<div v-if="messages.length === 0" class="flex h-full">
|
||||||
|
<div class="flex flex-col mx-auto my-auto p-4 text-gray-500 text-center">
|
||||||
|
<div class="mb-2 mx-auto">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-10">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div class="font-semibold">No Messages</div>
|
||||||
|
<div>There's no messages yet...</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- note: must use flex-col-reverse to prevent ui scrolling when adding older messages to ui -->
|
||||||
|
<div v-show="messages.length > 0" id="messages" class="h-full flex flex-col-reverse p-3 overflow-y-auto">
|
||||||
|
|
||||||
|
<!-- messages -->
|
||||||
|
<div :key="message.id" v-for="message of reversedMessages" class="max-w-xl items-start my-1.5">
|
||||||
|
|
||||||
|
<div class="flex">
|
||||||
|
|
||||||
|
<div class="mr-2 mt-2">
|
||||||
|
<a target="_blank" :href="`/?node_id=${message.from}`">
|
||||||
|
<div class="flex rounded-full h-12 w-12 text-white shadow" :class="[ `bg-[${getNodeColour(message.from)}]`, `text-[${getNodeTextColour(message.from)}]` ]">
|
||||||
|
<div class="mx-auto my-auto drop-shadow-sm">{{ getNodeShortName(message.from) }}</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col">
|
||||||
|
|
||||||
|
<!-- sender -->
|
||||||
|
<div class="text-xs text-gray-500">
|
||||||
|
<a target="_blank" :href="`/?node_id=${message.from}`" class="hover:text-blue-500">
|
||||||
|
<span>{{ getNodeLongName(message.from) }}</span>
|
||||||
|
</a>
|
||||||
|
<span v-if="message.to.toString() !== '4294967295'">
|
||||||
|
<span> → </span>
|
||||||
|
<a target="_blank" :href="`/?node_id=${message.to}`" class="hover:text-blue-500">{{ getNodeName(message.to) }}</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- message -->
|
||||||
|
<div @click="message.is_details_expanded = !message.is_details_expanded" class="flex">
|
||||||
|
<div class="border border-gray-300 rounded-xl shadow overflow-hidden bg-[#efefef] divide-y">
|
||||||
|
<div class="w-full space-y-0.5 px-2.5 py-1" v-html="escapeMessageText(message.text)" style="white-space:pre-wrap;word-break:break-word;"></div>
|
||||||
|
<div v-if="message.is_details_expanded" class="text-xs text-gray-500 px-2 py-1">
|
||||||
|
<span :title="message.created_at">{{ formatMessageTimestamp(message.created_at) }}</span>
|
||||||
|
<span> • Gated by <a target="_blank" :href="`/?node_id=${message.gateway_id}`" class="hover:text-blue-500">{{ getNodeName(message.gateway_id) }}</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- load previous -->
|
||||||
|
<button v-show="!isLoadingPrevious && hasMorePrevious" id="load-previous" @click="loadPrevious" type="button" class="flex space-x-2 mx-auto bg-gray-200 px-3 py-1 hover:bg-gray-300 rounded-full shadow">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m15 11.25-3-3m0 0-3 3m3-3v7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
||||||
|
</svg>
|
||||||
|
<span>Load Previous</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
Vue.createApp({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
to: null,
|
||||||
|
from: null,
|
||||||
|
channelId: null,
|
||||||
|
gatewayId: null,
|
||||||
|
|
||||||
|
isLoadingPrevious: false,
|
||||||
|
isLoadingMore: false,
|
||||||
|
shouldAutoScroll: true,
|
||||||
|
loadPreviousObserver: null,
|
||||||
|
hasMorePrevious: true,
|
||||||
|
|
||||||
|
messages: [],
|
||||||
|
nodesById: {},
|
||||||
|
|
||||||
|
moment: window.moment,
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted: function() {
|
||||||
|
|
||||||
|
// parse url params
|
||||||
|
const queryParams = new URLSearchParams(window.location.search);
|
||||||
|
this.to = queryParams.get('to');
|
||||||
|
this.from = queryParams.get('from');
|
||||||
|
this.channelId = queryParams.get('channel_id');
|
||||||
|
this.gatewayId = queryParams.get('gateway_id');
|
||||||
|
this.directMessageNodeIds = queryParams.get('direct_message_node_ids');
|
||||||
|
this.count = queryParams.get('count');
|
||||||
|
|
||||||
|
// listen for scrolling of messages list
|
||||||
|
document.getElementById("messages").addEventListener("scroll", (event) => {
|
||||||
|
|
||||||
|
// check if messages is scrolled to bottom
|
||||||
|
const element = event.target;
|
||||||
|
const isAtBottom = element.scrollTop === (element.scrollHeight - element.offsetHeight);
|
||||||
|
|
||||||
|
// we want to auto scroll if user is at bottom of messages list
|
||||||
|
this.shouldAutoScroll = isAtBottom;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// setup intersection observer
|
||||||
|
this.loadPreviousObserver = new IntersectionObserver((entries) => {
|
||||||
|
const loadMoreElement = entries[0];
|
||||||
|
if(loadMoreElement && loadMoreElement.isIntersecting){
|
||||||
|
this.loadPrevious();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.initialLoad();
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async initialLoad() {
|
||||||
|
|
||||||
|
// load 1 page of previous messages
|
||||||
|
await this.loadPrevious();
|
||||||
|
|
||||||
|
// scroll to bottom
|
||||||
|
this.scrollToBottom();
|
||||||
|
|
||||||
|
// setup auto loading previous
|
||||||
|
this.loadPreviousObserver.observe(document.querySelector("#load-previous"));
|
||||||
|
|
||||||
|
// load more every few seconds
|
||||||
|
setInterval(async () => {
|
||||||
|
await this.loadMore();
|
||||||
|
}, 2500);
|
||||||
|
|
||||||
|
},
|
||||||
|
async loadPrevious() {
|
||||||
|
|
||||||
|
// do nothing if already loading
|
||||||
|
if(this.isLoadingPrevious){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isLoadingPrevious = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const response = await window.axios.get('/api/v1/text-messages', {
|
||||||
|
params: {
|
||||||
|
to: this.to,
|
||||||
|
from: this.from,
|
||||||
|
channel_id: this.channelId,
|
||||||
|
gateway_id: this.gatewayId,
|
||||||
|
direct_message_node_ids: this.directMessageNodeIds,
|
||||||
|
count: this.count,
|
||||||
|
order: "desc",
|
||||||
|
last_id: this.oldestMessageId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// add messages to start of existing messages
|
||||||
|
const messages = response.data.text_messages;
|
||||||
|
for(const message of messages){
|
||||||
|
this.messages.unshift(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// no more previous to load if previous list is empty
|
||||||
|
if(messages.length === 0){
|
||||||
|
this.hasMorePrevious = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch node info
|
||||||
|
for(const message of messages){
|
||||||
|
await this.fetchNodeInfo(message.to);
|
||||||
|
await this.fetchNodeInfo(message.from);
|
||||||
|
await this.fetchNodeInfo(message.gateway_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(e) {
|
||||||
|
// do nothing
|
||||||
|
} finally {
|
||||||
|
this.isLoadingPrevious = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
async loadMore() {
|
||||||
|
|
||||||
|
// do nothing if already loading
|
||||||
|
if(this.isLoadingMore){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isLoadingMore = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const response = await window.axios.get('/api/v1/text-messages', {
|
||||||
|
params: {
|
||||||
|
to: this.to,
|
||||||
|
from: this.from,
|
||||||
|
channel_id: this.channelId,
|
||||||
|
gateway_id: this.gatewayId,
|
||||||
|
direct_message_node_ids: this.directMessageNodeIds,
|
||||||
|
count: this.count,
|
||||||
|
order: "asc",
|
||||||
|
last_id: this.latestMessageId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// add messages to end of existing messages
|
||||||
|
const messages = response.data.text_messages;
|
||||||
|
for(const message of messages){
|
||||||
|
this.messages.push(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// scroll to bottom
|
||||||
|
if(this.shouldAutoScroll){
|
||||||
|
this.scrollToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch node info
|
||||||
|
for(const message of messages){
|
||||||
|
await this.fetchNodeInfo(message.to);
|
||||||
|
await this.fetchNodeInfo(message.from);
|
||||||
|
await this.fetchNodeInfo(message.gateway_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(e) {
|
||||||
|
// do nothing
|
||||||
|
} finally {
|
||||||
|
this.isLoadingMore = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
async fetchNodeInfo(nodeId) {
|
||||||
|
|
||||||
|
// do nothing if already fetched
|
||||||
|
if(nodeId in this.nodesById){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do nothing if broadcast address
|
||||||
|
if(nodeId.toString() === "4294967295"){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const response = await window.axios.get(`/api/v1/nodes/${nodeId}`);
|
||||||
|
const node = response.data.node;
|
||||||
|
|
||||||
|
if(node){
|
||||||
|
this.nodesById[node.node_id] = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(e) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
scrollToBottom: function() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
var container = this.$el.querySelector("#messages");
|
||||||
|
container.scrollTop = container.scrollHeight;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getNodeHexId(nodeId) {
|
||||||
|
return "!" + parseInt(nodeId).toString(16);
|
||||||
|
},
|
||||||
|
getNodeName(nodeId) {
|
||||||
|
|
||||||
|
// find node by id
|
||||||
|
const node = this.nodesById[nodeId];
|
||||||
|
if(!node){
|
||||||
|
return this.getNodeHexId(nodeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return `[${node.short_name}] ${node.long_name}`;
|
||||||
|
|
||||||
|
},
|
||||||
|
getNodeShortName(nodeId) {
|
||||||
|
return this.nodesById[nodeId]?.short_name?.substring(0, 4) ?? "?";
|
||||||
|
},
|
||||||
|
getNodeLongName(nodeId) {
|
||||||
|
return this.nodesById[nodeId]?.long_name ?? this.getNodeHexId(nodeId);
|
||||||
|
},
|
||||||
|
getNodeColour(nodeId) {
|
||||||
|
// convert node id to a hex colour
|
||||||
|
return "#" + (nodeId & 0x00FFFFFF).toString(16).padStart(6, '0');
|
||||||
|
},
|
||||||
|
getNodeTextColour(nodeId) {
|
||||||
|
|
||||||
|
// extract rgb components
|
||||||
|
const r = (nodeId & 0xFF0000) >> 16;
|
||||||
|
const g = (nodeId & 0x00FF00) >> 8;
|
||||||
|
const b = nodeId & 0x0000FF;
|
||||||
|
|
||||||
|
// calculate brightness
|
||||||
|
const brightness = ((r * 0.299) + (g * 0.587) + (b * 0.114)) / 255;
|
||||||
|
|
||||||
|
// determine text color based on brightness
|
||||||
|
return brightness > 0.5 ? "#000000" : "#FFFFFF";
|
||||||
|
|
||||||
|
},
|
||||||
|
escapeMessageText(text) {
|
||||||
|
return text.replaceAll('<', '<')
|
||||||
|
.replaceAll('>', '>')
|
||||||
|
.replaceAll('\n', '<br/>');
|
||||||
|
},
|
||||||
|
formatMessageTimestamp(createdAt) {
|
||||||
|
return moment(new Date(createdAt)).local().format("DD/MMM/YYYY hh:mm:ss A");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
reversedMessages() {
|
||||||
|
// ensure a copy of the array is returned in reverse order
|
||||||
|
return this.messages.map((message) => message).reverse();
|
||||||
|
},
|
||||||
|
oldestMessageId() {
|
||||||
|
|
||||||
|
if(this.messages.length > 0){
|
||||||
|
return this.messages[0].id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
},
|
||||||
|
latestMessageId() {
|
||||||
|
|
||||||
|
if(this.messages.length > 0){
|
||||||
|
return this.messages[this.messages.length - 1].id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}).mount('#app');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
306
webapp/frontend/src/LayerControl.js
Normal file
306
webapp/frontend/src/LayerControl.js
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
export default class LayersControl {
|
||||||
|
constructor(options) {
|
||||||
|
// This div will hold all the checkboxes and their labels
|
||||||
|
this._container = document.createElement('div');
|
||||||
|
this._container.style.padding = '12px';
|
||||||
|
this._container.classList.add(
|
||||||
|
// Built-in classes for consistency
|
||||||
|
'maplibregl-ctrl',
|
||||||
|
'maplibregl-ctrl-group',
|
||||||
|
// Custom class, see later
|
||||||
|
'layers-control',
|
||||||
|
);
|
||||||
|
// Options
|
||||||
|
this._options = options;
|
||||||
|
// Map inputs
|
||||||
|
this._mapInputs = {};
|
||||||
|
this.activeMap = null;
|
||||||
|
// Control inputs
|
||||||
|
this._controlInputs = {};
|
||||||
|
this._activeControl = {};
|
||||||
|
this._previousLayers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
_createGroupHeader(name) {
|
||||||
|
const label = document.createElement('label');
|
||||||
|
const text = document.createElement('span');
|
||||||
|
text.innerText = name;
|
||||||
|
text.classList.add('layer-group-name');
|
||||||
|
label.appendChild(text);
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createGroupContainer() {
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.classList.add('layer-group');
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createGroup(name, data) {
|
||||||
|
const container = this._createGroupContainer();
|
||||||
|
const header = this._createGroupHeader(name);
|
||||||
|
container.appendChild(header);
|
||||||
|
for (const key of Object.keys(data.layers)) {
|
||||||
|
let input = null;
|
||||||
|
if (data.type === 'radio') {
|
||||||
|
input = this._createLabeledRadio(`${name}_${key}`, key, '_control_selection');
|
||||||
|
} else if (data.type === 'checkbox') {
|
||||||
|
input = this._createLabeledCheckbox(`${name}_${key}`, key, '_control_selection');
|
||||||
|
}
|
||||||
|
container.appendChild(input);
|
||||||
|
}
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyDefaults() {
|
||||||
|
for (const name of Object.keys(this._options.controls)) {
|
||||||
|
const config = this._options.controls[name];
|
||||||
|
if (typeof config.default === 'string') {
|
||||||
|
this._controlInputs[name][config.default].checked = true;
|
||||||
|
this._doControlAction(this._options.controls[name].layers[config.default]);
|
||||||
|
} else if (Array.isArray(config.default)) {
|
||||||
|
for (const id of config.default) {
|
||||||
|
this._controlInputs[name][id].checked = true;
|
||||||
|
this._doControlAction(this._options.controls[name].layers[id], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_createSeparator() {
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.classList.add('layers-control-separator');
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getLayers() {
|
||||||
|
return this._map.getLayersOrder().filter(name => !this._mapInputs.hasOwnProperty(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
_getVisibleLayers() {
|
||||||
|
return this._getLayers().filter(layer => {
|
||||||
|
const visibility = this._map.getLayer(layer).getLayoutProperty('visibility') ?? 'visible';
|
||||||
|
return visibility === 'visible';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_doControlAction(config, value) {
|
||||||
|
switch(config.type) {
|
||||||
|
case 'source_filter':
|
||||||
|
const source = this._map.getSource(config.source);
|
||||||
|
const data = config.getter().filter(config.filter);
|
||||||
|
source.setData({
|
||||||
|
type: 'FeatureCollection',
|
||||||
|
features: data,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'toggle_element':
|
||||||
|
if (config.element ?? false) {
|
||||||
|
document.querySelector(config.element).style.display = value ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'layer_toggle':
|
||||||
|
if (value) {
|
||||||
|
this._showLayer(config.layer);
|
||||||
|
} else {
|
||||||
|
this._hideLayer(config.layer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'layer_control':
|
||||||
|
this._previousLayers = this._getVisibleLayers();
|
||||||
|
if (config.hideAllExcept ?? false) {
|
||||||
|
const layersToRemove = this._getVisibleLayers().filter(name => !config.hideAllExcept.includes(name));
|
||||||
|
for (const id of layersToRemove) {
|
||||||
|
this._hideLayer(id);
|
||||||
|
}
|
||||||
|
for (const id of config.hideAllExcept) {
|
||||||
|
this._showLayer(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.disableCluster ?? false) {
|
||||||
|
const style = this._map.getStyle()
|
||||||
|
style.sources[config.disableCluster].cluster = false;
|
||||||
|
this._map.setStyle(style);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_disableLayerTransitions(name) {
|
||||||
|
const layerType = this._map.getLayer(name)?.type;
|
||||||
|
if (layerType === 'fill' || layerType === 'line' || layerType === 'circle') {
|
||||||
|
this._map.setPaintProperty(name, `${layerType}-opacity-transition`, { duration: 0 });
|
||||||
|
} else if (layerType === 'symbol') {
|
||||||
|
this._map.setPaintProperty(name, 'text-opacity-transition', { duration: 0 });
|
||||||
|
this._map.setPaintProperty(name, 'icon-opacity-transition', { duration: 0 });
|
||||||
|
this._map.setPaintProperty(name, 'text-opacity', 1);
|
||||||
|
this._map.setPaintProperty(name, 'icon-opacity', 1);
|
||||||
|
const layout = this._map.getLayoutProperty(name, 'text-field');
|
||||||
|
if (layout) {
|
||||||
|
this._map.setLayoutProperty(name, 'text-optional', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_hideLayer(name) {
|
||||||
|
if (this._getLayers().includes(name)) {
|
||||||
|
this._disableLayerTransitions(name);
|
||||||
|
this._map.setLayoutProperty(name, 'visibility', 'none');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_showLayer(name) {
|
||||||
|
if (this._getLayers().includes(name)) {
|
||||||
|
this._disableLayerTransitions(name);
|
||||||
|
this._map.setLayoutProperty(name, 'visibility', 'visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_revertControlAction(config) {
|
||||||
|
switch(config.type) {
|
||||||
|
case 'source_filter':
|
||||||
|
const source = this._map.getSource(config.source);
|
||||||
|
source.setData({
|
||||||
|
type: 'FeatureCollection',
|
||||||
|
features: config.getter(),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'toggle_element':
|
||||||
|
if (config.element ?? false) {
|
||||||
|
const el = document.querySelector(config.element).style.display;
|
||||||
|
document.querySelector(config.element).style.display = (el === 'block' ? 'none' : 'block');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'layer_toggle':
|
||||||
|
const visibility = this._map.getLayer(config.layer).getLayoutProperty('visibility') ?? 'visible';
|
||||||
|
if (visibility === 'visible') {
|
||||||
|
this._hideLayer(config.layer);
|
||||||
|
} else {
|
||||||
|
this._showLayer(config.layer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'layer_control':
|
||||||
|
// i want to hide all layers in current layers that weren't in previous layers, so all layers in current layers that are not in previous layers
|
||||||
|
const toHide = this._getVisibleLayers().filter(layer => !this._previousLayers.includes(layer));
|
||||||
|
const toShow = this._getLayers().filter(layer => this._previousLayers.includes(layer));
|
||||||
|
for (const id of toShow) {
|
||||||
|
this._showLayer(id);
|
||||||
|
}
|
||||||
|
for (const id of toHide) {
|
||||||
|
this._hideLayer(id);
|
||||||
|
}
|
||||||
|
this._previousLayers = [];
|
||||||
|
if (config.disableCluster ?? false) {
|
||||||
|
const style = this._map.getStyle()
|
||||||
|
style.sources[config.disableCluster].cluster = true;
|
||||||
|
this._map.setStyle(style);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_createLabeledRadio(id, display, type) {
|
||||||
|
const label = document.createElement('label');
|
||||||
|
const text = document.createElement('span');
|
||||||
|
text.innerText = ` ${display}`;
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'radio';
|
||||||
|
input.name = type;
|
||||||
|
input.value = id;
|
||||||
|
input.addEventListener('change', (e) => {
|
||||||
|
if (type === '_map_control_selection') {
|
||||||
|
if (this.activeMap != e.target.value) {
|
||||||
|
this._map.setLayoutProperty(this.activeMap, 'visibility', 'none');
|
||||||
|
this._map.setLayoutProperty(e.target.value, 'visibility', 'visible');
|
||||||
|
this.activeMap = e.target.value;
|
||||||
|
}
|
||||||
|
} else if (type === '_control_selection') {
|
||||||
|
const [ parent, child ] = id.split('_');
|
||||||
|
const layerConfig = this._options.controls[parent].layers[child];
|
||||||
|
this._revertControlAction(this._activeControl[parent] ?? {type: ''});
|
||||||
|
this._doControlAction(layerConfig);
|
||||||
|
this._activeControl[parent] = layerConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (type === '_map_control_selection') {
|
||||||
|
this._mapInputs[id] = input;
|
||||||
|
} else if (type === '_control_selection') {
|
||||||
|
const [ parent, child ] = id.split('_');
|
||||||
|
this._controlInputs[parent][child] = input;
|
||||||
|
}
|
||||||
|
label.appendChild(input);
|
||||||
|
label.appendChild(text);
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createLabeledCheckbox(id, display, type) {
|
||||||
|
const label = document.createElement('label');
|
||||||
|
const text = document.createElement('span');
|
||||||
|
text.innerText = ` ${display}`;
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'checkbox';
|
||||||
|
input.name = id;
|
||||||
|
input.addEventListener('change', (e) => {
|
||||||
|
if (type === '_control_selection') {
|
||||||
|
const [ parent, child ] = id.split('_');
|
||||||
|
const layerConfig = this._options.controls[parent].layers[child];
|
||||||
|
this._revertControlAction(this._activeControl[parent] ?? {type: ''});
|
||||||
|
this._doControlAction(layerConfig, e.target.checked);
|
||||||
|
this._activeControl[parent] = layerConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (type === '_control_selection') {
|
||||||
|
const [ parent, child ] = id.split('_');
|
||||||
|
this._controlInputs[parent][child] = input;
|
||||||
|
}
|
||||||
|
label.appendChild(input);
|
||||||
|
label.appendChild(text);
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
onAdd(map) {
|
||||||
|
this._map = map;
|
||||||
|
map.on('load', () => {
|
||||||
|
// create map changer
|
||||||
|
for (const map of this._options.maps) {
|
||||||
|
const radioSelection = this._createLabeledRadio(map.id, map.display, '_map_control_selection');
|
||||||
|
this._container.appendChild(radioSelection);
|
||||||
|
}
|
||||||
|
this._container.appendChild(this._createSeparator());
|
||||||
|
// Create the checkboxes and add them to the container
|
||||||
|
for (const key of Object.keys(this._options.controls)) {
|
||||||
|
this._controlInputs[key] = {};
|
||||||
|
this._activeControl[parent] = {};
|
||||||
|
const group = this._createGroup(key, this._options.controls[key]);
|
||||||
|
this._container.appendChild(group);
|
||||||
|
}
|
||||||
|
this._options.maps.forEach(({ id, tiles, sourceExtraParams = {}, layerExtraParams = {} }) => {
|
||||||
|
map.addSource(id, {
|
||||||
|
...sourceExtraParams,
|
||||||
|
type: 'raster',
|
||||||
|
tiles,
|
||||||
|
});
|
||||||
|
map.addLayer({ ...layerExtraParams, id, source: id, type: 'raster' });
|
||||||
|
if (this._options.initialMap === id) {
|
||||||
|
map.setLayoutProperty(id, 'visibility', 'visible');
|
||||||
|
this._mapInputs[id].checked = true;
|
||||||
|
this.activeMap = id;
|
||||||
|
} else {
|
||||||
|
map.setLayoutProperty(id, 'visibility', 'none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return this._container;
|
||||||
|
}
|
||||||
|
|
||||||
|
onRemove(map) {
|
||||||
|
// Not sure why we have to do this ourselves since we are not the ones
|
||||||
|
// adding us to the map.
|
||||||
|
// Copied from their example so keeping it in.
|
||||||
|
this._container.parentNode.removeChild(this._container);
|
||||||
|
// This might be to help garbage collection? Also from their example.
|
||||||
|
// Or perhaps to ensure calls to this object do not change the map still
|
||||||
|
// after removal.
|
||||||
|
this._map = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
19
webapp/frontend/src/LegendControl.js
Normal file
19
webapp/frontend/src/LegendControl.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
export default class LegendControl {
|
||||||
|
onAdd(map) {
|
||||||
|
this._map = map;
|
||||||
|
this._container = document.createElement('div');
|
||||||
|
this._container.style.backgroundColor = 'white';
|
||||||
|
this._container.style.padding = '12px';
|
||||||
|
this._container.innerHTML = `<div style="margin-bottom:6px;"><strong>Legend</strong></div>`
|
||||||
|
+ `<div style="display:flex"><div class="icon-mqtt-connected" style="width:12px;height:12px;margin-right:4px;margin-top:auto;margin-bottom:auto;"></div> MQTT Connected</div>`
|
||||||
|
+ `<div style="display:flex"><div class="icon-mqtt-disconnected" style="width:12px;height:12px;margin-right:4px;margin-top:auto;margin-bottom:auto;"></div> MQTT Disconnected</div>`
|
||||||
|
+ `<div style="display:flex"><div class="icon-offline" style="width:12px;height:12px;margin-right:4px;margin-top:auto;margin-bottom:auto;"></div> Offline Too Long</div>`;
|
||||||
|
this._container.className = 'maplibregl-ctrl maplibregl-ctrl-group legend-control';
|
||||||
|
return this._container;
|
||||||
|
}
|
||||||
|
|
||||||
|
onRemove() {
|
||||||
|
this._container.parentNode.removeChild(this._container);
|
||||||
|
this._map = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,46 @@
|
|||||||
@import "tailwindcss";
|
@import "tailwindcss";
|
||||||
@import "leaflet/dist/leaflet.css";
|
@import "maplibre-gl/dist/maplibre-gl.css";
|
||||||
@import "leaflet.markercluster/dist/MarkerCluster.css";
|
|
||||||
@import "leaflet.markercluster/dist/MarkerCluster.Default.css";
|
.layers-control {
|
||||||
@import "leaflet-groupedlayercontrol/dist/leaflet.groupedlayercontrol.min.css";
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-group-name {
|
||||||
|
margin-bottom: .2em;
|
||||||
|
margin-left: 3px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-group {
|
||||||
|
margin-bottom: .5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layers-control label {
|
||||||
|
font-size: 1.08333em;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layers-control radio {
|
||||||
|
margin-top: 2px;
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layers-control-separator {
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
height: 0;
|
||||||
|
margin: 5px -10px 5px -6px;
|
||||||
|
}
|
||||||
|
|
||||||
/* used to prevent ui flicker before vuejs loads */
|
/* used to prevent ui flicker before vuejs loads */
|
||||||
[v-cloak] {
|
[v-cloak] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.maplibregl-ctrl-basemaps:not(.closed) > .hidden {
|
||||||
|
display: unset !important;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-mqtt-connected {
|
.icon-mqtt-connected {
|
||||||
background-color: #16a34a;
|
background-color: #16a34a;
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
|
|||||||
@ -1,22 +1,25 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { state } from '../store.js';
|
import { CURRENT_ANNOUNCEMENT_ID } from '@/config';
|
||||||
import { lastSeenAnnouncementId, CURRENT_ANNOUNCEMENT_ID } from '../config.js';
|
import { useUIStore } from '@/stores/uiStore';
|
||||||
|
import { useConfigStore } from '@/stores/configStore';
|
||||||
|
const ui = useUIStore();
|
||||||
|
const config = useConfigStore();
|
||||||
|
|
||||||
function dismissAnnouncement() {
|
function dismissAnnouncement() {
|
||||||
if (lastSeenAnnouncementId.value != CURRENT_ANNOUNCEMENT_ID) {
|
if (config.lastSeenAnnouncementId != CURRENT_ANNOUNCEMENT_ID) {
|
||||||
lastSeenAnnouncementId.value = CURRENT_ANNOUNCEMENT_ID;
|
config.lastSeenAnnouncementId = CURRENT_ANNOUNCEMENT_ID;
|
||||||
}
|
}
|
||||||
state.announcementVisible = false;
|
ui.hideAnnouncement();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<!-- announcement -->
|
<!-- announcement -->
|
||||||
<div v-if="state.announcementVisible" class="flex bg-yellow-300 p-2 border-gray-300 border-b">
|
<div v-if="ui.announcementVisible" class="flex bg-yellow-300 p-2 border-gray-300 border-b">
|
||||||
<!-- info -->
|
<!-- info -->
|
||||||
<div class="my-auto leading-tight">
|
<div class="my-auto leading-tight">
|
||||||
<div class="font-bold">Service Announcement</div>
|
<div class="font-bold">Service Announcement</div>
|
||||||
<div class="text-sm">
|
<div class="text-sm">
|
||||||
<span>Changes were made to mqtt.meshtastic.org. Uplink your nodes to <button @click="state.infoModalVisible = true" type="button" class="link">our MQTT server</button> to continue showing on this map.</span>
|
<span>Changes were made to mqtt.meshtastic.org. Uplink your nodes to <button @click="ui.showInfoModal()" type="button" class="link">our MQTT server</button> to continue showing on this map.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- action buttons -->
|
<!-- action buttons -->
|
||||||
|
|||||||
17
webapp/frontend/src/components/Chart/Legend.vue
Normal file
17
webapp/frontend/src/components/Chart/Legend.vue
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
legendData: { // Object with legend labels as keys and Tailwind color classes as values
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<!-- Chart Legend -->
|
||||||
|
<div class="flex justify-center space-x-4 py-2">
|
||||||
|
<div v-for="(colorClass, label) in legendData" :key="label" class="flex items-center space-x-1">
|
||||||
|
<div :class="['w-2 h-2', colorClass]" class="rounded-full"></div>
|
||||||
|
<div class="text-sm text-gray-500">{{ label }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
137
webapp/frontend/src/components/Chart/Metrics.vue
Normal file
137
webapp/frontend/src/components/Chart/Metrics.vue
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, watch, defineProps, onUnmounted, nextTick } from 'vue';
|
||||||
|
import { Chart, TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement } from 'chart.js';
|
||||||
|
import 'chartjs-adapter-moment';
|
||||||
|
import ChartLegend from '@/components/Chart/Legend.vue';
|
||||||
|
import { useConfigStore } from '@/stores/configStore';
|
||||||
|
import { getTimeSpans } from '@/utils';
|
||||||
|
// Props for chart data, type, and customization
|
||||||
|
const props = defineProps({
|
||||||
|
title: String,
|
||||||
|
data: Object,
|
||||||
|
chartType: String,
|
||||||
|
timeRangeKey: String,
|
||||||
|
legendData: Object,
|
||||||
|
scales: Array,
|
||||||
|
chartConfig: Object,
|
||||||
|
});
|
||||||
|
|
||||||
|
const configStore = useConfigStore();
|
||||||
|
const chartEl = ref(null);
|
||||||
|
|
||||||
|
async function initChart() {
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
|
// Check if chart element is present
|
||||||
|
if (!chartEl.value) {
|
||||||
|
console.error('initChart(): Canvas element is not available.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const labels = props.data?.labels || [];
|
||||||
|
|
||||||
|
// Destroy existing chart to avoid conflicts with new data
|
||||||
|
const existingChart = chartEl.value ? Chart.getChart(chartEl.value) : null;
|
||||||
|
if (existingChart) {
|
||||||
|
existingChart.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine if we actually have data
|
||||||
|
const hasEmptyDataset = labels.length === 0;
|
||||||
|
|
||||||
|
// Use an empty dataset for no data
|
||||||
|
const datasets = !hasEmptyDataset
|
||||||
|
? props.data.datasets
|
||||||
|
: [{
|
||||||
|
label: 'No Data',
|
||||||
|
data: [],
|
||||||
|
borderColor: '#e5e7eb',
|
||||||
|
backgroundColor: '#e5e7eb',
|
||||||
|
borderDash: [5, 5], // Dashed border for the placeholder line
|
||||||
|
pointRadius: 0,
|
||||||
|
fill: false,
|
||||||
|
}];
|
||||||
|
|
||||||
|
const chartData = {
|
||||||
|
labels: !hasEmptyDataset ? labels : [new Date()], // Show empty chart with a placeholder date if no data
|
||||||
|
datasets,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
new Chart(chartEl.value, {
|
||||||
|
type: props.chartType,
|
||||||
|
data: chartData,
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
scales: props.chartConfig.scales,
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
display: props.chartConfig.legendDisplay ?? false,
|
||||||
|
labels: {
|
||||||
|
generateLabels: () => Object.keys(props.legendData).map((key) => ({
|
||||||
|
text: key,
|
||||||
|
fillStyle: props.legendData[key],
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tooltip: props.chartConfig.tooltipOptions,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call initChart again if the props.data changes (e.g., when time range changes)
|
||||||
|
// Watch for changes in the props.data and trigger chart initialization only when the data changes
|
||||||
|
watch(
|
||||||
|
() => props.data,
|
||||||
|
async (newData, oldData) => {
|
||||||
|
if (typeof oldData === 'undefined') return; // first load
|
||||||
|
if (JSON.stringify(newData) !== JSON.stringify(oldData)) {
|
||||||
|
// Now check if chartEl is available
|
||||||
|
if (chartEl.value) {
|
||||||
|
await initChart(); // Initialize the chart after the DOM update
|
||||||
|
} else {
|
||||||
|
console.error('watch(): Canvas element is not available.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
onMounted(async () => {
|
||||||
|
Chart.register(TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement);
|
||||||
|
// Now check if chartEl is available
|
||||||
|
if (chartEl.value) {
|
||||||
|
await initChart(); // Initialize the chart after the DOM update
|
||||||
|
} else {
|
||||||
|
console.error('onMounted(): Canvas element is not available.');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onUnmounted(() => {
|
||||||
|
const existingChart = chartEl.value ? Chart.getChart(chartEl.value) : null;
|
||||||
|
if (existingChart) existingChart.destroy();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="flex bg-gray-200 p-2 font-semibold">
|
||||||
|
<div class="my-auto">{{ props.title }}</div>
|
||||||
|
<div class="ml-auto">
|
||||||
|
<select v-model="configStore[props.timeRangeKey]" class="block w-full rounded-md border-0 py-0.5 pl-2 pr-8 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6">
|
||||||
|
<option v-for="(range, index) in getTimeSpans()" :key="index" :value="index">{{ range.name }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
|
<li>
|
||||||
|
<div class="px-4 py-2">
|
||||||
|
<div class="w-full min-h-[150px]">
|
||||||
|
<canvas ref="chartEl" class="h-[150px]"></canvas>
|
||||||
|
<ChartLegend :legendData="legendData" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<slot />
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
channel: Number, // Channel number (1, 2, or 3),
|
||||||
|
latest: Array,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<li class="flex p-3">
|
||||||
|
<div class="text-sm font-medium text-gray-900">Channel {{ channel }}</div>
|
||||||
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
|
<span v-if="latest">
|
||||||
|
<span v-if="latest[`ch${channel}_voltage`]" >
|
||||||
|
{{ Number(latest[`ch${channel}_voltage`]).toFixed(2) }}V
|
||||||
|
</span>
|
||||||
|
<span v-else>???</span>
|
||||||
|
<span v-if="latest[`ch${channel}_current`]">
|
||||||
|
/ {{ Number(latest[`ch${channel}_current`]).toFixed(2) }}mA
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span v-else>???</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
27
webapp/frontend/src/components/CloseActionButton.vue
Normal file
27
webapp/frontend/src/components/CloseActionButton.vue
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<script setup>
|
||||||
|
// Emits a click event for parent to handle
|
||||||
|
defineEmits(['click']);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button
|
||||||
|
@click="$emit('click')"
|
||||||
|
class="p-2 rounded-full bg-gray-100 hover:bg-gray-200"
|
||||||
|
aria-label="Close"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="w-6 h-6"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" />
|
||||||
|
<path d="M18 6L6 18" />
|
||||||
|
<path d="M6 6l12 12" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
@ -1,16 +1,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { state } from '../store.js';
|
import { buildPath } from '@/utils';
|
||||||
import { buildPath } from '../utils.js';
|
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { useUIStore } from '@/stores/uiStore';
|
||||||
|
const ui = useUIStore();
|
||||||
const hardwareModelStats = ref([]);
|
const hardwareModelStats = ref([]);
|
||||||
onMounted(() => {
|
async function loadHardwareStats() {
|
||||||
axios.get(buildPath('/api/v1/stats/hardware-models')).then((response) => {
|
try {
|
||||||
hardwareModelStats.value = response.data.hardware_model_stats;
|
const { data } = await axios.get(buildPath('/api/v1/stats/hardware-models'));
|
||||||
}).catch((error) => {
|
hardwareModelStats.value = data.hardware_model_stats;
|
||||||
// do nothing
|
} catch (error) {
|
||||||
});
|
console.warn('Failed to fetch hardware model stats:', error);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
onMounted(loadHardwareStats);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -24,7 +27,7 @@ onMounted(() => {
|
|||||||
leave-active-class="transition-opacity duration-300 ease-linear"
|
leave-active-class="transition-opacity duration-300 ease-linear"
|
||||||
leave-from-class="opacity-100"
|
leave-from-class="opacity-100"
|
||||||
leave-to-class="opacity-0">
|
leave-to-class="opacity-0">
|
||||||
<div v-show="state.hardwareStatsVisible" @click="state.hardwareStatsVisible = !state.hardwareStatsVisible" class="fixed inset-0 bg-gray-900/75"></div>
|
<div v-show="ui.hardwareStatsVisible" @click="ui.toggleHardwareStats" class="fixed inset-0 bg-gray-900/75"></div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<!-- sidebar -->
|
<!-- sidebar -->
|
||||||
@ -35,7 +38,7 @@ onMounted(() => {
|
|||||||
leave-active-class="transition duration-300 ease-in-out transform"
|
leave-active-class="transition duration-300 ease-in-out transform"
|
||||||
leave-from-class="translate-x-0"
|
leave-from-class="translate-x-0"
|
||||||
leave-to-class="-translate-x-full">
|
leave-to-class="-translate-x-full">
|
||||||
<div v-show="state.hardwareStatsVisible" class="fixed top-0 left-0 bottom-0">
|
<div v-show="ui.hardwareStatsVisible" class="fixed top-0 left-0 bottom-0">
|
||||||
<div class="w-screen h-full max-w-md overflow-hidden">
|
<div class="w-screen h-full max-w-md overflow-hidden">
|
||||||
<div class="flex h-full flex-col bg-white shadow-xl">
|
<div class="flex h-full flex-col bg-white shadow-xl">
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ onMounted(() => {
|
|||||||
<h3 class="text-sm">Ordered by most popular</h3>
|
<h3 class="text-sm">Ordered by most popular</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-auto ml-3 flex h-7 items-center">
|
<div class="my-auto ml-3 flex h-7 items-center">
|
||||||
<a href="javascript:void(0)" class="rounded-full" @click="state.hardwareStatsVisible = false">
|
<a href="javascript:void(0)" class="rounded-full" @click="ui.hideHardwareStats">
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
@ -62,13 +65,13 @@ onMounted(() => {
|
|||||||
|
|
||||||
<!-- list of hardware models -->
|
<!-- list of hardware models -->
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200 overflow-y-auto">
|
<ul role="list" class="flex-1 divide-y divide-gray-200 overflow-y-auto">
|
||||||
<li v-for="hardwareModel of hardwareModelStats">
|
<li v-for="hardwareModel in hardwareModelStats" :key="hardwareModel.hardware_model_name">
|
||||||
<div class="group relative flex items-center">
|
<div class="group relative flex items-center">
|
||||||
<a href="#" class="block flex-1 px-4 py-2">
|
<a href="#" class="block flex-1 px-4 py-2">
|
||||||
<div class="absolute inset-0 group-hover:bg-gray-100" aria-hidden="true"></div>
|
<div class="absolute inset-0 group-hover:bg-gray-100" aria-hidden="true"></div>
|
||||||
<div class="relative flex min-w-0 flex-1 items-center">
|
<div class="relative flex min-w-0 flex-1 items-center">
|
||||||
<span class="relative inline-block flex-shrink-0 mr-4">
|
<span class="relative inline-block flex-shrink-0 mr-4">
|
||||||
<img class="h-20 w-20 rounded-sm object-contain" :src="`/images/devices/${hardwareModel.hardware_model_name}.png`" alt="" onerror="if(this.src != '/images/no_image.png') this.src = '/images/no_image.png';">
|
<img class="h-20 w-20 rounded-sm object-contain" :src="`/images/devices/${hardwareModel.hardware_model_name}.png`" alt="" @error="(e) => e.target.src = '/images/no_image.png'">
|
||||||
</span>
|
</span>
|
||||||
<div class="truncate">
|
<div class="truncate">
|
||||||
<p class="truncate text-sm font-medium text-gray-900">{{ hardwareModel.hardware_model_name }}</p>
|
<p class="truncate text-sm font-medium text-gray-900">{{ hardwareModel.hardware_model_name }}</p>
|
||||||
|
|||||||
@ -1,141 +1,111 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { useUIStore } from '@/stores/uiStore';
|
||||||
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
|
import { useSearchedNodes } from '@/composables/useSearchedNodes';
|
||||||
|
import ActionButton from '@/components/Header/ActionButton.vue';
|
||||||
|
import MobileCloseIcon from '@/icons/MobileCloseIcon.Vue';
|
||||||
|
|
||||||
const emit = defineEmits(['reload', 'randomNode', 'searchClick']);
|
const emit = defineEmits(['reload', 'randomNode', 'searchClick']);
|
||||||
import { ref } from 'vue';
|
|
||||||
import { state, searchedNodes } from '../store.js';
|
const ui = useUIStore();
|
||||||
import { getNodeColor, getNodeTextColor } from '../utils.js';
|
const mapData = useMapStore();
|
||||||
|
const { searchedNodes } = useSearchedNodes();
|
||||||
|
|
||||||
|
const search = computed({
|
||||||
|
get: () => ui.searchText,
|
||||||
|
set: val => ui.search(val),
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: reload button is jumpy when it spins
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex bg-white p-2 border-gray-300 border-b h-16">
|
<div class="flex h-16 items-center bg-white p-2 border-b border-gray-300">
|
||||||
|
|
||||||
<!-- close mobile search button -->
|
<!-- Close button (mobile only) -->
|
||||||
<div v-if="state.mobileSearchVisible" class="my-auto">
|
<button v-if="ui.mobileSearchVisible" @click="ui.hideMobileSearch" class="p-2 bg-gray-100 hover:bg-gray-200 rounded-full">
|
||||||
<a @click="state.mobileSearchVisible = false" href="javascript:void(0)" class="rounded-full">
|
<MobileCloseIcon />
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
</button>
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18" />
|
<!-- Logo and title (desktop only) -->
|
||||||
</svg>
|
<div v-if="!ui.mobileSearchVisible" class="hidden sm:flex items-center mr-3 space-x-2">
|
||||||
</div>
|
<img class="w-10 h-10 rounded" src="/images/icon.png" />
|
||||||
</a>
|
<div>
|
||||||
</div>
|
<div class="font-bold">CT Mesh Map</div>
|
||||||
|
<div class="text-sm">
|
||||||
<!-- icon -->
|
Created by <a class="link" href="https://liamcottle.com" target="_blank">Liam Cottle</a>
|
||||||
<div v-if="!state.mobileSearchVisible" class="hidden sm:block my-auto mr-3">
|
|
||||||
<img class="w-10 h-10 rounded" src="/images/icon.png"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- app info -->
|
|
||||||
<div v-if="!state.mobileSearchVisible" class="my-auto leading-tight">
|
|
||||||
<div class="font-bold">CT Mesh Map</div>
|
|
||||||
<div class="text-sm">
|
|
||||||
Created by <a class="link" target="_blank" href="https://liamcottle.com">Liam Cottle</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- search bar -->
|
|
||||||
<div class="mx-3 flex-1 relative" :class="{ 'hidden lg:block': !state.mobileSearchVisible }">
|
|
||||||
<input v-model="state.searchText" type="text" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" :placeholder="`Search ${state.nodes.length} nodes...`">
|
|
||||||
<div v-if="state.searchText !== ''" class="absolute z-search bg-white w-full border border-gray-200 rounded-lg shadow-md mt-1 overflow-y-scroll max-h-80 divide-y divide-gray-200">
|
|
||||||
|
|
||||||
<template v-if="searchedNodes.length > 0">
|
|
||||||
<div @click="$emit('searchClick', node)" class="flex space-x-2 p-2 hover:bg-gray-100 cursor-pointer" v-for="node of searchedNodes">
|
|
||||||
<div>
|
|
||||||
<div class="flex rounded-full h-12 w-12 text-white shadow" :style="{backgroundColor: getNodeColor(node.node_id)}" :class="[ `text-[${getNodeTextColor(node.node_id)}]` ]">
|
|
||||||
<div class="mx-auto my-auto drop-shadow-sm">{{ node.short_name }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="text-gray-900" :class="{ 'text-red-500': node.latitude == null || node.longitude == null }">{{ node.long_name !== '' ? node.long_name : "-" }}</div>
|
|
||||||
<div class="flex space-x-1 text-sm text-gray-700">
|
|
||||||
<div>{{ node.node_id_hex }} / {{ node.node_id }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="searchedNodes.length === 500" class="text-gray-500 text-sm px-2 py-1">
|
|
||||||
Only the first 500 results are shown.
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<div class="p-2">
|
|
||||||
No results found...
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- header action buttons -->
|
|
||||||
<div v-if="!state.mobileSearchVisible" class="flex my-auto ml-auto mr-0 sm:mr-2 space-x-1 sm:space-x-2">
|
|
||||||
<a @click="state.infoModalVisible = !state.infoModalVisible" href="javascript:void(0)" class="tooltip rounded-full">
|
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:block">
|
|
||||||
<span class="tooltip-text">About</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a @click="state.mobileSearchVisible = true" href="javascript:void(0)" class="tooltip rounded-full block lg:hidden">
|
|
||||||
<div id="search-button" class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"></path>
|
|
||||||
<path d="M21 21l-6 -6"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:block">
|
|
||||||
<span class="tooltip-text">Search</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a @click="state.hardwareStatsVisible = !state.hardwareStatsVisible" href="javascript:void(0)" class="tooltip rounded-full hidden sm:block">
|
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 1.5H8.25A2.25 2.25 0 0 0 6 3.75v16.5a2.25 2.25 0 0 0 2.25 2.25h7.5A2.25 2.25 0 0 0 18 20.25V3.75a2.25 2.25 0 0 0-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:block">
|
|
||||||
<span class="tooltip-text">Devices</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="tooltip rounded-full hidden lg:block" @click="$emit('randomNode')">
|
|
||||||
<div id="random-button" class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M18 4l3 3l-3 3"></path>
|
|
||||||
<path d="M18 20l3 -3l-3 -3"></path>
|
|
||||||
<path d="M3 7h3a5 5 0 0 1 5 5a5 5 0 0 0 5 5h5"></path>
|
|
||||||
<path d="M21 7h-5a4.978 4.978 0 0 0 -3 1m-4 8a4.984 4.984 0 0 1 -3 1h-3"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:block">
|
|
||||||
<span class="tooltip-text">Random</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a @click="state.settingsVisible = !state.settingsVisible" href="javascript:void(0)" class="tooltip rounded-full">
|
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z" />
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:block">
|
|
||||||
<span class="tooltip-text">Settings</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="tooltip rounded-full" @click="$emit('reload')">
|
|
||||||
<div id="reload-button" class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full" :class="{'animate-spin': state.loading}">
|
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747"></path>
|
|
||||||
<path d="M20 4v5h-5"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:block">
|
|
||||||
<span class="tooltip-text">Reload</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Search Bar -->
|
||||||
|
<div class="flex-1 mx-3 relative" :class="{ 'hidden lg:block': !ui.mobileSearchVisible }">
|
||||||
|
<input
|
||||||
|
v-model="search"
|
||||||
|
type="text"
|
||||||
|
class="w-full p-2.5 text-sm rounded-lg border border-gray-300 bg-gray-50 focus:ring-blue-500 focus:border-blue-500"
|
||||||
|
:placeholder="`Search ${mapData.nodes.length} nodes...`"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Search results -->
|
||||||
|
<div
|
||||||
|
v-if="ui.searchText !== ''"
|
||||||
|
class="absolute z-search w-full mt-1 max-h-80 overflow-y-scroll bg-white border border-gray-200 rounded-lg shadow divide-y divide-gray-200"
|
||||||
|
>
|
||||||
|
<template v-if="searchedNodes.length > 0">
|
||||||
|
<div
|
||||||
|
v-for="node in searchedNodes"
|
||||||
|
:key="node.node_id"
|
||||||
|
@click="$emit('searchClick', node)"
|
||||||
|
class="flex p-2 space-x-2 hover:bg-gray-100 cursor-pointer"
|
||||||
|
>
|
||||||
|
<div class="flex items-center justify-center w-12 h-12 rounded-full text-white shadow" :style="{ backgroundColor: node.backgroundColor, color: node.textColor }">
|
||||||
|
<span class="drop-shadow-sm">{{ node.short_name }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div :class="['text-gray-900', { 'text-red-500': !node.latitude || !node.longitude }]">
|
||||||
|
{{ node.long_name || '-' }}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-700">
|
||||||
|
{{ node.node_id_hex }} / {{ node.node_id }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="searchedNodes.length === 500" class="px-2 py-1 text-sm text-gray-500">
|
||||||
|
Only the first 500 results are shown.
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div class="p-2">No results found...</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div v-if="!ui.mobileSearchVisible" class="flex items-center ml-auto space-x-1 sm:space-x-2">
|
||||||
|
<!-- Info -->
|
||||||
|
<ActionButton @click="ui.toggleInfoModal" icon="info" tooltip="About" />
|
||||||
|
|
||||||
|
<!-- Search (mobile only) -->
|
||||||
|
<ActionButton class="block lg:hidden" @click="ui.showMobileSearch" icon="search" tooltip="Search" />
|
||||||
|
|
||||||
|
<!-- Hardware Stats -->
|
||||||
|
<ActionButton class="hidden sm:block" @click="ui.toggleHardwareStats" icon="device" tooltip="Devices" />
|
||||||
|
|
||||||
|
<!-- Random Node -->
|
||||||
|
<ActionButton class="hidden lg:block" @click="$emit('randomNode')" icon="random" tooltip="Random" />
|
||||||
|
|
||||||
|
<!-- Settings -->
|
||||||
|
<ActionButton @click="ui.toggleSettings" icon="settings" tooltip="Settings" />
|
||||||
|
|
||||||
|
<!-- Reload -->
|
||||||
|
<ActionButton
|
||||||
|
@click="$emit('reload')"
|
||||||
|
icon="reload"
|
||||||
|
:loading="ui.loading"
|
||||||
|
tooltip="Reload"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
36
webapp/frontend/src/components/Header/ActionButton.vue
Normal file
36
webapp/frontend/src/components/Header/ActionButton.vue
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<script setup>
|
||||||
|
import { defineAsyncComponent } from 'vue';
|
||||||
|
const emit = defineEmits(['click']);
|
||||||
|
defineProps({
|
||||||
|
icon: String,
|
||||||
|
tooltip: String,
|
||||||
|
loading: Boolean,
|
||||||
|
})
|
||||||
|
|
||||||
|
const getIcon = (iconName) => {
|
||||||
|
const icons = {
|
||||||
|
info: defineAsyncComponent(() => import('@/icons/InfoIcon.vue')),
|
||||||
|
search: defineAsyncComponent(() => import('@/icons/SearchIcon.vue')),
|
||||||
|
device: defineAsyncComponent(() => import('@/icons/DeviceIcon.vue')),
|
||||||
|
random: defineAsyncComponent(() => import('@/icons/RandomIcon.vue')),
|
||||||
|
settings: defineAsyncComponent(() => import('@/icons/SettingsIcon.vue')),
|
||||||
|
reload: defineAsyncComponent(() => import('@/icons/ReloadIcon.vue')),
|
||||||
|
};
|
||||||
|
|
||||||
|
return icons[iconName] || icons.info;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button class="tooltip rounded-full relative" @click="$emit('click')">
|
||||||
|
<div
|
||||||
|
:class="[
|
||||||
|
'p-2 rounded-full bg-gray-100 hover:bg-gray-200',
|
||||||
|
{ 'animate-spin': loading }
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<component :is="getIcon(icon)" class="w-6 h-6" />
|
||||||
|
</div>
|
||||||
|
<span v-if="tooltip" class="hidden sm:block tooltip-text">{{ tooltip }}</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
@ -1,12 +1,15 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { state } from '../store.js';
|
import { useConfigStore } from '@/stores/configStore';
|
||||||
import { hasSeenInfoModal } from '../config.js';
|
import { useUIStore } from '@/stores/uiStore';
|
||||||
|
|
||||||
|
const ui = useUIStore();
|
||||||
|
const config = useConfigStore();
|
||||||
|
|
||||||
function dismissInfoModal() {
|
function dismissInfoModal() {
|
||||||
if (hasSeenInfoModal.value === false) {
|
if (config.hasSeenInfoModal === false) {
|
||||||
hasSeenInfoModal.value = true;
|
config.hasSeenInfoModal = true;
|
||||||
}
|
}
|
||||||
state.infoModalVisible = false;
|
ui.hideInfoModal();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
@ -21,7 +24,7 @@ function dismissInfoModal() {
|
|||||||
leave-active-class="transition-opacity duration-300 ease-linear"
|
leave-active-class="transition-opacity duration-300 ease-linear"
|
||||||
leave-from-class="opacity-100"
|
leave-from-class="opacity-100"
|
||||||
leave-to-class="opacity-0">
|
leave-to-class="opacity-0">
|
||||||
<div v-show="state.infoModalVisible" @click="dismissInfoModal" class="fixed inset-0 bg-gray-900/75"></div>
|
<div v-show="ui.infoModalVisible" @click="dismissInfoModal" class="fixed inset-0 bg-gray-900/75"></div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<!-- modal -->
|
<!-- modal -->
|
||||||
@ -32,7 +35,7 @@ function dismissInfoModal() {
|
|||||||
leave-active-class="transition duration-300 ease-in-out transform"
|
leave-active-class="transition duration-300 ease-in-out transform"
|
||||||
leave-from-class="translate-y-0"
|
leave-from-class="translate-y-0"
|
||||||
leave-to-class="translate-y-full">
|
leave-to-class="translate-y-full">
|
||||||
<div @click="dismissInfoModal" v-show="state.infoModalVisible" class="fixed left-0 right-0 top-0 bottom-0 lg:pointer-events-none">
|
<div @click="dismissInfoModal" v-show="ui.infoModalVisible" class="fixed left-0 right-0 top-0 bottom-0 lg:pointer-events-none">
|
||||||
<div class="flex w-full h-full overflow-y-auto p-4">
|
<div class="flex w-full h-full overflow-y-auto p-4">
|
||||||
<div @click.stop class="mx-auto my-auto w-full max-w-2xl flex-col bg-white shadow-xl rounded-xl p-2 lg:pointer-events-auto">
|
<div @click.stop class="mx-auto my-auto w-full max-w-2xl flex-col bg-white shadow-xl rounded-xl p-2 lg:pointer-events-auto">
|
||||||
<div class="relative flex">
|
<div class="relative flex">
|
||||||
|
|||||||
@ -4,33 +4,78 @@ import moment from 'moment';
|
|||||||
import { Chart } from 'chart.js';
|
import { Chart } from 'chart.js';
|
||||||
import 'chartjs-adapter-moment';
|
import 'chartjs-adapter-moment';
|
||||||
import { onMounted, useTemplateRef, ref, watch } from 'vue';
|
import { onMounted, useTemplateRef, ref, watch } from 'vue';
|
||||||
import { state } from '../store.js';
|
import { state } from '@/store';
|
||||||
import { environmentMetricsTimeRange, powerMetricsTimeRange, deviceMetricsTimeRange } from '../config.js';
|
import DeviceMetricsChart from '@/components/NodeInfo/DeviceMetricsChart.vue';
|
||||||
import DeviceMetricsChart from './NodeInfo/DeviceMetricsChart.vue';
|
import PowerMetricsChart from '@/components/NodeInfo/PowerMetricsChart.vue';
|
||||||
import PowerMetricsChart from './NodeInfo/PowerMetricsChart.vue';
|
import EnvironmentMetricsChart from '@/components/NodeInfo/EnvironmentMetricsChart.vue';
|
||||||
import EnvironmentMetricsChart from './NodeInfo/EnvironmentMetricsChart.vue';
|
import LoraConfig from '@/components/NodeInfo/LoraConfig.vue';
|
||||||
import LoraConfig from './NodeInfo/LoraConfig.vue';
|
import NodeDetails from '@/components/NodeInfo/NodeDetails.vue';
|
||||||
import NodeDetails from './NodeInfo/NodeDetails.vue';
|
import MqttHistory from '@/components/NodeInfo/MqttHistory.vue';
|
||||||
import MqttHistory from './NodeInfo/MqttHistory.vue';
|
import OtherInfo from '@/components/NodeInfo/OtherInfo.vue';
|
||||||
import OtherInfo from './NodeInfo/OtherInfo.vue';
|
import Share from '@/components/NodeInfo/Share.vue';
|
||||||
import Share from './NodeInfo/Share.vue';
|
import Traceroutes from '@/components/NodeInfo/Traceroutes.vue';
|
||||||
import Traceroutes from './NodeInfo/Traceroutes.vue';
|
import Position from '@/components/NodeInfo/Position.vue';
|
||||||
import Position from './NodeInfo/Position.vue';
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
import { getNodeColor, getNodeTextColor, copyShareLinkForNode, getTimeSpan, buildPath } from '../utils.js';
|
import { copyShareLinkForNode, getTimeSpan, buildPath } from '@/utils';
|
||||||
const emit = defineEmits(['showPositionHistory']);
|
import { useConfigStore } from '@/stores/configStore';
|
||||||
|
|
||||||
function showPositionHistory(id) {
|
const configStore = useConfigStore();
|
||||||
emit('showPositionHistory', id);
|
const emit = defineEmits(['showPositionHistory', 'showTraceRoute']);
|
||||||
|
const mapData = useMapStore();
|
||||||
|
|
||||||
|
const mqttMetrics = ref([]);
|
||||||
|
const traceroutes = ref([]);
|
||||||
|
const deviceMetrics = ref([]);
|
||||||
|
const environmentMetrics = ref([]);
|
||||||
|
const powerMetrics = ref([]);
|
||||||
|
|
||||||
|
// Generalized function for loading data
|
||||||
|
async function loadData(path, params = {}, targetRef, metrics = false) {
|
||||||
|
try {
|
||||||
|
const response = await axios.get(buildPath(path), { params });
|
||||||
|
|
||||||
|
// Grab the first key from the response (assuming it's always an object with a single data array)
|
||||||
|
const key = Object.keys(response.data)[0];
|
||||||
|
const rawData = response.data[key] ?? [];
|
||||||
|
|
||||||
|
// Reverse if it's metric data, otherwise just assign
|
||||||
|
targetRef.value = metrics ? rawData.slice().reverse() : rawData;
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error loading data from ${path}:`, error);
|
||||||
|
targetRef.value = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showTraceRoute(traceroute) {
|
// Utility function to calculate the timeFrom value based on a given time range
|
||||||
emit('showTraceRoute', traceroute);
|
function calculateTimeFrom(timeRange) {
|
||||||
state.selectedTraceRoute = traceroute;
|
const time = getTimeSpan(timeRange).amount;
|
||||||
|
return new Date().getTime() - (time * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// find node marker by id
|
// Load MQTT metrics
|
||||||
function findNodeMarkerById(id) {
|
function loadNodeMqttMetrics(nodeId) {
|
||||||
return state.nodeMarkers[id] ?? null;
|
loadData(`/api/v1/nodes/${nodeId}/mqtt-metrics`, {}, mqttMetrics);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load Traceroutes
|
||||||
|
function loadNodeTraceroutes(nodeId) {
|
||||||
|
loadData(`/api/v1/nodes/${nodeId}/traceroutes`, { count: 5 }, traceroutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load Device Metrics
|
||||||
|
function loadNodeDeviceMetrics(nodeId) {
|
||||||
|
loadData(`/api/v1/nodes/${nodeId}/device-metrics`, { time_from: calculateTimeFrom(configStore.deviceMetricsTimeRange) }, deviceMetrics, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load Environment Metrics
|
||||||
|
function loadNodeEnvironmentMetrics(nodeId) {
|
||||||
|
loadData(`/api/v1/nodes/${nodeId}/environment-metrics`, { time_from: calculateTimeFrom(configStore.environmentMetricsTimeRange) }, environmentMetrics, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load Power Metrics
|
||||||
|
function loadNodePowerMetrics(nodeId) {
|
||||||
|
loadData(`/api/v1/nodes/${nodeId}/power-metrics`, { time_from: calculateTimeFrom(configStore.powerMetricsTimeRange) }, powerMetrics, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNode(nodeId) {
|
function loadNode(nodeId) {
|
||||||
@ -41,73 +86,6 @@ function loadNode(nodeId) {
|
|||||||
loadNodePowerMetrics(nodeId);
|
loadNodePowerMetrics(nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNodeMqttMetrics(nodeId) {
|
|
||||||
state.selectedNodeMqttMetrics = [];
|
|
||||||
axios.get(buildPath(`/api/v1/nodes/${nodeId}/mqtt-metrics`)).then((response) => {
|
|
||||||
state.selectedNodeMqttMetrics = response.data.mqtt_metrics;
|
|
||||||
}).catch(() => {
|
|
||||||
// do nothing
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadNodeTraceroutes(nodeId) {
|
|
||||||
state.selectedNodeTraceroutes = [];
|
|
||||||
axios.get(buildPath(`/api/v1/nodes/${nodeId}/traceroutes`), {
|
|
||||||
params: {
|
|
||||||
count: 5,
|
|
||||||
},
|
|
||||||
}).then((response) => {
|
|
||||||
state.selectedNodeTraceroutes = response.data.traceroutes;
|
|
||||||
}).catch(() => {
|
|
||||||
// do nothing
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadNodeDeviceMetrics(nodeId) {
|
|
||||||
const time = getTimeSpan(deviceMetricsTimeRange.value).amount
|
|
||||||
const timeFrom = new Date().getTime() - (time * 1000);
|
|
||||||
axios.get(buildPath(`/api/v1/nodes/${nodeId}/device-metrics`), {
|
|
||||||
params: {
|
|
||||||
time_from: timeFrom,
|
|
||||||
},
|
|
||||||
}).then((response) => {
|
|
||||||
// reverse response, as it's newest to oldest, but we want oldest to newest
|
|
||||||
state.selectedNodeDeviceMetrics = response.data.device_metrics.reverse();
|
|
||||||
}).catch(() => {
|
|
||||||
state.selectedNodeDeviceMetrics = [];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadNodeEnvironmentMetrics(nodeId) {
|
|
||||||
const time = getTimeSpan(environmentMetricsTimeRange.value).amount
|
|
||||||
const timeFrom = new Date().getTime() - (time * 1000);
|
|
||||||
axios.get(buildPath(`/api/v1/nodes/${nodeId}/environment-metrics`), {
|
|
||||||
params: {
|
|
||||||
time_from: timeFrom,
|
|
||||||
},
|
|
||||||
}).then((response) => {
|
|
||||||
// reverse response, as it's newest to oldest, but we want oldest to newest
|
|
||||||
state.selectedNodeEnvironmentMetrics = response.data.environment_metrics.reverse();
|
|
||||||
}).catch(() => {
|
|
||||||
state.selectedNodeEnvironmentMetrics = [];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadNodePowerMetrics(nodeId) {
|
|
||||||
const time = getTimeSpan(powerMetricsTimeRange.value).amount
|
|
||||||
const timeFrom = new Date().getTime() - (time * 1000);
|
|
||||||
axios.get(buildPath(`/api/v1/nodes/${nodeId}/power-metrics`), {
|
|
||||||
params: {
|
|
||||||
time_from: timeFrom,
|
|
||||||
},
|
|
||||||
}).then((response) => {
|
|
||||||
// reverse response, as it's newest to oldest, but we want oldest to newest
|
|
||||||
state.selectedNodePowerMetrics = response.data.power_metrics.reverse();
|
|
||||||
}).catch(() => {
|
|
||||||
state.selectedNodePowerMetrics = [];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => state.selectedNode,
|
() => state.selectedNode,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
@ -118,25 +96,28 @@ watch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => deviceMetricsTimeRange.value,
|
() => configStore.deviceMetricsTimeRange,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
loadNodeDeviceMetrics(state.selectedNode.node_id)
|
loadNodeDeviceMetrics(state.selectedNode.node_id)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => powerMetricsTimeRange.value,
|
() => configStore.powerMetricsTimeRange,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
loadNodePowerMetrics(state.selectedNode.node_id)
|
loadNodePowerMetrics(state.selectedNode.node_id)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => environmentMetricsTimeRange.value,
|
() => configStore.environmentMetricsTimeRange,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
loadNodeEnvironmentMetrics(state.selectedNode.node_id)
|
if (state.selectedNode?.node_id) {
|
||||||
|
loadNodeEnvironmentMetrics(state.selectedNode.node_id);
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
||||||
@ -168,7 +149,7 @@ watch(
|
|||||||
<div class="p-2 border-b border-gray-200 shadow-sm">
|
<div class="p-2 border-b border-gray-200 shadow-sm">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="my-auto mr-2">
|
<div class="my-auto mr-2">
|
||||||
<div class="flex rounded-full h-12 w-12 text-white shadow-sm" :style="{backgroundColor: getNodeColor(state.selectedNode.node_id)}" :class="[ `text-[${getNodeTextColor(state.selectedNode.node_id)}]` ]">
|
<div class="flex rounded-full h-12 w-12 text-white shadow-sm" :style="{backgroundColor: state.selectedNode.backgroundColor, color: state.selectedNode.textColor}">
|
||||||
<div class="mx-auto my-auto drop-shadow-sm">{{ state.selectedNode.short_name }}</div>
|
<div class="mx-auto my-auto drop-shadow-sm">{{ state.selectedNode.short_name }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -200,7 +181,7 @@ watch(
|
|||||||
<div class="overflow-y-auto">
|
<div class="overflow-y-auto">
|
||||||
|
|
||||||
<!-- no position banner -->
|
<!-- no position banner -->
|
||||||
<div v-if="findNodeMarkerById(state.selectedNode.node_id) == null" class="flex bg-orange-500 text-white p-2">
|
<div v-if="mapData.findNodeMarkerById(state.selectedNode.node_id) == null" class="flex bg-orange-500 text-white p-2">
|
||||||
<div class="my-auto mr-2">
|
<div class="my-auto mr-2">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
||||||
<path fill-rule="evenodd" d="m11.54 22.351.07.04.028.016a.76.76 0 0 0 .723 0l.028-.015.071-.041a16.975 16.975 0 0 0 1.144-.742 19.58 19.58 0 0 0 2.683-2.282c1.944-1.99 3.963-4.98 3.963-8.827a8.25 8.25 0 0 0-16.5 0c0 3.846 2.02 6.837 3.963 8.827a19.58 19.58 0 0 0 2.682 2.282 16.975 16.975 0 0 0 1.145.742ZM12 13.5a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" clip-rule="evenodd" />
|
<path fill-rule="evenodd" d="m11.54 22.351.07.04.028.016a.76.76 0 0 0 .723 0l.028-.015.071-.041a16.975 16.975 0 0 0 1.144-.742 19.58 19.58 0 0 0 2.683-2.282c1.944-1.99 3.963-4.98 3.963-8.827a8.25 8.25 0 0 0-16.5 0c0 3.846 2.02 6.837 3.963 8.827a19.58 19.58 0 0 0 2.682 2.282 16.975 16.975 0 0 0 1.145.742ZM12 13.5a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" clip-rule="evenodd" />
|
||||||
@ -261,17 +242,17 @@ watch(
|
|||||||
<!-- lora config -->
|
<!-- lora config -->
|
||||||
<LoraConfig :node="state.selectedNode"/>
|
<LoraConfig :node="state.selectedNode"/>
|
||||||
<!-- position -->
|
<!-- position -->
|
||||||
<Position @show-position-history="showPositionHistory" :node="state.selectedNode"/>
|
<Position @show-position-history="(nodeId) => $emit('showPositionHistory', nodeId)" :node="state.selectedNode"/>
|
||||||
<!-- device metrics -->
|
<!-- device metrics -->
|
||||||
<DeviceMetricsChart :node="state.selectedNode"/>
|
<DeviceMetricsChart :node="state.selectedNode" :data="deviceMetrics"/>
|
||||||
<!-- environment metrics -->
|
<!-- environment metrics -->
|
||||||
<EnvironmentMetricsChart :node="state.selectedNode"/>
|
<EnvironmentMetricsChart :node="state.selectedNode" :data="environmentMetrics"/>
|
||||||
<!-- power metrics -->
|
<!-- power metrics -->
|
||||||
<PowerMetricsChart/>
|
<PowerMetricsChart :data="powerMetrics"/>
|
||||||
<!-- mqtt -->
|
<!-- mqtt -->
|
||||||
<MqttHistory />
|
<MqttHistory :data="mqttMetrics"/>
|
||||||
<!-- traceroutes -->
|
<!-- traceroutes -->
|
||||||
<Traceroutes @show-trace-route="showTraceRoute"/>
|
<Traceroutes @show-trace-route="(traceroute) => $emit('showTraceRoute', traceroute)" :data="traceroutes"/>
|
||||||
<!-- other -->
|
<!-- other -->
|
||||||
<OtherInfo :node="state.selectedNode"/>
|
<OtherInfo :node="state.selectedNode"/>
|
||||||
<!-- share -->
|
<!-- share -->
|
||||||
|
|||||||
@ -1,207 +1,135 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps(['node']);
|
const props = defineProps(['node', 'data']);
|
||||||
import axios from 'axios';
|
import { computed } from 'vue';
|
||||||
import moment from 'moment';
|
import MetricsChart from '@/components/Chart/Metrics.vue';
|
||||||
import { Chart, TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement } from 'chart.js';
|
|
||||||
import 'chartjs-adapter-moment';
|
|
||||||
import { onMounted, useTemplateRef, watch } from 'vue';
|
|
||||||
import { state } from '../../store.js';
|
|
||||||
import { deviceMetricsTimeRange } from '../../config.js';
|
|
||||||
import { formatUptimeSeconds, getTimeSpans } from '../../utils.js';
|
|
||||||
import { useStorage } from '@vueuse/core';
|
|
||||||
const deviceMetricsChartEl = useTemplateRef('device-metrics-chart');
|
|
||||||
|
|
||||||
function initChart() {
|
const chartData = computed(() => {
|
||||||
// destroy existing chart
|
const metrics = props.data;
|
||||||
const existingChart = Chart.getChart(deviceMetricsChartEl.value);
|
|
||||||
if (existingChart != null) {
|
return {
|
||||||
existingChart.destroy();
|
labels: metrics.map(m => m.created_at),
|
||||||
}
|
datasets: [
|
||||||
// create chart data
|
{
|
||||||
const labels = [];
|
label: 'Battery Level',
|
||||||
const batteryMetrics = [];
|
data: metrics.map(m => m.battery_level),
|
||||||
const channelUtilizationMetrics = [];
|
borderColor: '#3b82f6',
|
||||||
const airUtilTxMetrics = [];
|
backgroundColor: '#3b82f6',
|
||||||
for(const deviceMetric of state.selectedNodeDeviceMetrics) {
|
pointStyle: false,
|
||||||
labels.push(moment(deviceMetric.created_at));
|
fill: false,
|
||||||
batteryMetrics.push(deviceMetric.battery_level);
|
},
|
||||||
channelUtilizationMetrics.push(deviceMetric.channel_utilization);
|
{
|
||||||
airUtilTxMetrics.push(deviceMetric.air_util_tx);
|
label: 'Channel Util',
|
||||||
}
|
data: metrics.map(m => m.channel_utilization),
|
||||||
// create chart
|
borderColor: '#22c55e',
|
||||||
new Chart(deviceMetricsChartEl.value, {
|
backgroundColor: '#22c55e',
|
||||||
type: 'line',
|
showLine: false,
|
||||||
data: {
|
fill: false,
|
||||||
labels: labels,
|
},
|
||||||
datasets: [
|
{
|
||||||
{
|
label: 'Air Util TX',
|
||||||
label: 'Battery Level',
|
data: metrics.map(m => m.air_util_tx),
|
||||||
borderColor: '#3b82f6',
|
borderColor: '#f97316',
|
||||||
backgroundColor: '#3b82f6',
|
backgroundColor: '#f97316',
|
||||||
pointStyle: false, // no points
|
showLine: false,
|
||||||
fill: false,
|
fill: false,
|
||||||
data: batteryMetrics,
|
},
|
||||||
},
|
],
|
||||||
{
|
};
|
||||||
label: 'Channel Util',
|
});
|
||||||
borderColor: '#22c55e',
|
|
||||||
backgroundColor: '#22c55e',
|
const legendData = {
|
||||||
showLine: false, // no lines between points
|
'Battery Level': 'bg-blue-500',
|
||||||
fill: false,
|
'Channel Util': 'bg-green-500',
|
||||||
data: channelUtilizationMetrics,
|
'Air Util TX': 'bg-orange-500',
|
||||||
},
|
};
|
||||||
{
|
|
||||||
label: 'Air Util TX',
|
const chartConfig = {
|
||||||
borderColor: '#f97316',
|
legendDisplay: false, // or true if you want Chart.js legend too
|
||||||
backgroundColor: '#f97316',
|
tooltipOptions: {
|
||||||
showLine: false, // no lines between points
|
mode: 'index',
|
||||||
fill: false,
|
intersect: false,
|
||||||
data: airUtilTxMetrics,
|
callbacks: {
|
||||||
},
|
label: (item) => `${item.dataset.label}: ${item.formattedValue}%`,
|
||||||
],
|
},
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
x: {
|
||||||
|
position: 'top',
|
||||||
|
type: 'time',
|
||||||
|
time: {
|
||||||
|
unit: 'day',
|
||||||
|
displayFormats: {
|
||||||
|
day: 'MMM DD',
|
||||||
},
|
},
|
||||||
options: {
|
},
|
||||||
responsive: true,
|
},
|
||||||
borderWidth: 2,
|
y: {
|
||||||
elements: {
|
min: 0,
|
||||||
point: {
|
max: 101,
|
||||||
radius: 2,
|
ticks: {
|
||||||
},
|
callback: (label) => `${label}%`,
|
||||||
},
|
},
|
||||||
scales: {
|
},
|
||||||
x: {
|
},
|
||||||
position: 'top',
|
};
|
||||||
type: 'time',
|
|
||||||
time: {
|
|
||||||
unit: 'day',
|
|
||||||
displayFormats: {
|
|
||||||
day: 'MMM DD', // Jan 01
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
min: 0,
|
|
||||||
max: 101, // 101 is "Plugged In", need to include for tooltip to work
|
|
||||||
ticks: {
|
|
||||||
callback: (label) => `${label}%`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false,
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
mode: "index",
|
|
||||||
intersect: false,
|
|
||||||
callbacks: {
|
|
||||||
label: (item) => {
|
|
||||||
return `${item.dataset.label}: ${item.formattedValue}%`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
watch(
|
|
||||||
() => state.selectedNodeDeviceMetrics,
|
|
||||||
(newValue) => {
|
|
||||||
if (newValue !== []) {
|
|
||||||
initChart()
|
|
||||||
}
|
|
||||||
}, {deep: true}
|
|
||||||
)
|
|
||||||
onMounted(() => {
|
|
||||||
Chart.register(TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- device metrics -->
|
<MetricsChart
|
||||||
<div>
|
title="Device Metrics"
|
||||||
<div class="flex bg-gray-200 p-2 font-semibold">
|
:data="chartData"
|
||||||
<div class="my-auto">Device Metrics</div>
|
chartType="line"
|
||||||
<div class="my-auto ml-auto">
|
timeRangeKey="deviceMetricsTimeRange"
|
||||||
<select v-model="deviceMetricsTimeRange" class="block w-full rounded-md border-0 py-0.5 pl-2 pr-8 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6">
|
:legendData="legendData"
|
||||||
<option v-for="(range, index) in getTimeSpans()" :value="index">{{ range.name }}</option>
|
:chartConfig="chartConfig"
|
||||||
</select>
|
>
|
||||||
|
<!-- Battery Level -->
|
||||||
|
<li class="flex p-3">
|
||||||
|
<div class="text-sm font-medium text-gray-900">Battery Level</div>
|
||||||
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
|
<span v-if="props.node.battery_level">
|
||||||
|
<span v-if="props.node.battery_level > 100">Plugged In</span>
|
||||||
|
<span v-else>{{ props.node.battery_level }}%</span>
|
||||||
|
</span>
|
||||||
|
<span v-else>???</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</li>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
|
||||||
|
|
||||||
<!-- device metrics chart -->
|
<!-- Voltage -->
|
||||||
<li>
|
<li class="flex p-3">
|
||||||
<div class="px-4 py-2">
|
<div class="text-sm font-medium text-gray-900">Voltage</div>
|
||||||
<div class="w-full">
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<canvas id="deviceMetricsChart" style="height:150px;" ref="device-metrics-chart"></canvas>
|
<span v-if="props.node.voltage">{{ Number(props.node.voltage).toFixed(2) }}V</span>
|
||||||
<div class="flex">
|
<span v-else>???</span>
|
||||||
<div class="mx-auto flex space-x-2">
|
</div>
|
||||||
<div class="flex mx-auto">
|
</li>
|
||||||
<div class="my-auto w-2 h-2 bg-blue-500 rounded-full"></div>
|
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Battery Level</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex mx-auto">
|
|
||||||
<div class="my-auto w-2 h-2 bg-green-500 rounded-full"></div>
|
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Channel Utilization</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex mx-auto">
|
|
||||||
<div class="my-auto w-2 h-2 bg-orange-500 rounded-full"></div>
|
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Air Util TX</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- battery level -->
|
<!-- Channel Utilization -->
|
||||||
<li class="flex p-3">
|
<li class="flex p-3">
|
||||||
<div class="text-sm font-medium text-gray-900">Battery Level</div>
|
<div class="text-sm font-medium text-gray-900">Channel Utilization</div>
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<span v-if="props.node.battery_level">
|
<span v-if="props.node.channel_utilization">{{ Number(props.node.channel_utilization).toFixed(2) }}%</span>
|
||||||
<span v-if="props.node.battery_level > 100">Plugged In</span>
|
<span v-else>???</span>
|
||||||
<span v-else>{{ props.node.battery_level }}%</span>
|
</div>
|
||||||
</span>
|
</li>
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- voltage -->
|
<!-- Air Util TX -->
|
||||||
<li class="flex p-3">
|
<li class="flex p-3">
|
||||||
<div class="text-sm font-medium text-gray-900">Voltage</div>
|
<div class="text-sm font-medium text-gray-900">Air Util Tx</div>
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<span v-if="props.node.voltage">{{ Number(props.node.voltage).toFixed(2) }}V</span>
|
<span v-if="props.node.air_util_tx">{{ Number(props.node.air_util_tx).toFixed(2) }}%</span>
|
||||||
<span v-else>???</span>
|
<span v-else>???</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- channel utilization -->
|
<!-- Uptime -->
|
||||||
<li class="flex p-3">
|
<li class="flex p-3">
|
||||||
<div class="text-sm font-medium text-gray-900">Channel Utilization</div>
|
<div class="text-sm font-medium text-gray-900">Uptime</div>
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<span v-if="props.node.channel_utilization">{{ Number(props.node.channel_utilization).toFixed(2) }}%</span>
|
<span v-if="props.node.uptime_seconds">{{ formatUptimeSeconds(props.node.uptime_seconds) }}</span>
|
||||||
<span v-else>???</span>
|
<span v-else>???</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
</MetricsChart>
|
||||||
<!-- air util tx -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Air Util Tx</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.air_util_tx">{{ Number(props.node.air_util_tx).toFixed(2) }}%</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- air util tx -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Uptime</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.uptime_seconds">{{ formatUptimeSeconds(props.node.uptime_seconds) }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
@ -1,202 +1,135 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps(['node']);
|
const props = defineProps(['node', 'data']);
|
||||||
import axios from 'axios';
|
import { computed } from 'vue';
|
||||||
import moment from 'moment';
|
import { formatTemperature } from '@/utils';
|
||||||
import { Chart, TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement } from 'chart.js';
|
import MetricsChart from '@/components/Chart/Metrics.vue';
|
||||||
import 'chartjs-adapter-moment';
|
|
||||||
import { onMounted, useTemplateRef, watch } from 'vue';
|
|
||||||
import { state } from '../../store.js';
|
|
||||||
import { environmentMetricsTimeRange } from '../../config.js';
|
|
||||||
import { formatTemperature, getTimeSpans } from '../../utils.js';
|
|
||||||
const environmentMetricsChartEl = useTemplateRef('environment-metrics-chart');
|
|
||||||
|
|
||||||
function initChart() {
|
// Chart data prep
|
||||||
// destroy existing chart
|
const labels = computed(() => props.data.map(m => m.created_at));
|
||||||
const existingChart = Chart.getChart(environmentMetricsChartEl.value);
|
const temperatureMetrics = computed(() => props.data.map(m => m.temperature));
|
||||||
if (existingChart != null) {
|
const relativeHumidityMetrics = computed(() => props.data.map(m => m.relative_humidity));
|
||||||
existingChart.destroy();
|
const barometricPressureMetrics = computed(() => props.data.map(m => m.barometric_pressure));
|
||||||
}
|
|
||||||
// create chart data
|
const chartData = computed(() => ({
|
||||||
const labels = [];
|
labels: labels.value,
|
||||||
const temperatureMetrics = [];
|
datasets: [
|
||||||
const relativeHumidityMetrics = [];
|
{
|
||||||
const barometricPressureMetrics = [];
|
label: 'Temperature',
|
||||||
for(const deviceMetric of state.selectedNodeEnvironmentMetrics){
|
suffix: 'ºC',
|
||||||
labels.push(moment(deviceMetric.created_at));
|
borderColor: '#3b82f6',
|
||||||
temperatureMetrics.push(deviceMetric.temperature);
|
backgroundColor: '#3b82f6',
|
||||||
relativeHumidityMetrics.push(deviceMetric.relative_humidity);
|
pointStyle: false,
|
||||||
barometricPressureMetrics.push(deviceMetric.barometric_pressure);
|
fill: false,
|
||||||
}
|
data: temperatureMetrics.value,
|
||||||
// create chart
|
yAxisID: 'y',
|
||||||
new Chart(environmentMetricsChartEl.value, {
|
},
|
||||||
type: 'line',
|
{
|
||||||
data: {
|
label: 'Humidity',
|
||||||
labels: labels,
|
suffix: '%',
|
||||||
datasets: [
|
borderColor: '#22c55e',
|
||||||
{
|
backgroundColor: '#22c55e',
|
||||||
label: 'Temperature',
|
pointStyle: false,
|
||||||
suffix: 'ºC',
|
fill: false,
|
||||||
borderColor: '#3b82f6',
|
data: relativeHumidityMetrics.value,
|
||||||
backgroundColor: '#3b82f6',
|
yAxisID: 'y',
|
||||||
pointStyle: false, // no points
|
},
|
||||||
fill: false,
|
{
|
||||||
data: temperatureMetrics,
|
label: 'Pressure',
|
||||||
yAxisID: 'y',
|
suffix: 'hPa',
|
||||||
},
|
borderColor: '#f97316',
|
||||||
{
|
backgroundColor: '#f97316',
|
||||||
label: 'Humidity',
|
pointStyle: false,
|
||||||
suffix: '%',
|
fill: false,
|
||||||
borderColor: '#22c55e',
|
data: barometricPressureMetrics.value,
|
||||||
backgroundColor: '#22c55e',
|
yAxisID: 'y1',
|
||||||
pointStyle: false, // no points
|
},
|
||||||
fill: false,
|
],
|
||||||
data: relativeHumidityMetrics,
|
}));
|
||||||
yAxisID: 'y',
|
|
||||||
},
|
const chartConfig = {
|
||||||
{
|
legendDisplay: false,
|
||||||
label: 'Pressure',
|
scales: {
|
||||||
suffix: 'hPa',
|
x: {
|
||||||
borderColor: '#f97316',
|
position: 'top',
|
||||||
backgroundColor: '#f97316',
|
type: 'time',
|
||||||
pointStyle: false, // no points
|
time: {
|
||||||
fill: false,
|
unit: 'day',
|
||||||
data: barometricPressureMetrics,
|
displayFormats: {
|
||||||
yAxisID: 'y1',
|
day: 'MMM DD',
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
options: {
|
},
|
||||||
responsive: true,
|
},
|
||||||
borderWidth: 2,
|
y: {
|
||||||
spanGaps: 1000 * 60 * 60 * 3, // only show lines between metrics with a 3 hour or less gap
|
min: -20,
|
||||||
elements: {
|
max: 100,
|
||||||
point: {
|
},
|
||||||
radius: 2,
|
y1: {
|
||||||
},
|
min: 800,
|
||||||
},
|
max: 1100,
|
||||||
scales: {
|
ticks: {
|
||||||
x: {
|
stepSize: 10,
|
||||||
position: 'top',
|
callback: (label) => `${label} hPa`,
|
||||||
type: 'time',
|
},
|
||||||
time: {
|
position: 'right',
|
||||||
unit: 'day',
|
grid: {
|
||||||
displayFormats: {
|
drawOnChartArea: false,
|
||||||
day: 'MMM DD', // Jan 01
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
tooltipOptions: {
|
||||||
y: {
|
mode: 'index',
|
||||||
min: -20,
|
intersect: false,
|
||||||
max: 100,
|
callbacks: {
|
||||||
},
|
label: (item) => {
|
||||||
y1: {
|
return `${item.dataset.label}: ${item.formattedValue}${item.dataset.suffix}`;
|
||||||
min: 800,
|
},
|
||||||
max: 1100,
|
},
|
||||||
ticks: {
|
},
|
||||||
stepSize: 10,
|
};
|
||||||
callback: (label) => `${label} hPa`,
|
|
||||||
},
|
|
||||||
position: 'right',
|
|
||||||
grid: {
|
|
||||||
drawOnChartArea: false, // only want the grid lines for one axis to show up
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false,
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
mode: "index",
|
|
||||||
intersect: false,
|
|
||||||
callbacks: {
|
|
||||||
label: (item) => {
|
|
||||||
return `${item.dataset.label}: ${item.formattedValue}${item.dataset.suffix}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
const legendData = {
|
||||||
() => state.selectedNodeEnvironmentMetrics,
|
Temperature: 'bg-blue-500',
|
||||||
(newValue) => {
|
Humidity: 'bg-green-500',
|
||||||
if (newValue !== []) {
|
Pressure: 'bg-orange-500',
|
||||||
initChart()
|
};
|
||||||
}
|
|
||||||
}, {deep: true}
|
|
||||||
)
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
Chart.register(TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<MetricsChart
|
||||||
<div class="flex bg-gray-200 p-2 font-semibold">
|
title="Environment Metrics"
|
||||||
<div class="my-auto">Environment Metrics</div>
|
:data="chartData"
|
||||||
<div class="my-auto ml-auto">
|
chartType="line"
|
||||||
<select v-model="environmentMetricsTimeRange" class="block w-full rounded-md border-0 py-0.5 pl-2 pr-8 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6">
|
timeRangeKey="environmentMetricsTimeRange"
|
||||||
<option v-for="(range, index) in getTimeSpans()" :value="index">{{ range.name }}</option>
|
:legendData="legendData"
|
||||||
</select>
|
:chartConfig="chartConfig"
|
||||||
</div>
|
>
|
||||||
|
<!-- Chart Details (below the chart) -->
|
||||||
|
<li class="flex p-3">
|
||||||
|
<div class="text-sm font-medium text-gray-900">Temperature</div>
|
||||||
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
|
<span v-if="props.node?.temperature">{{ formatTemperature(props.node.temperature) }}</span>
|
||||||
|
<span v-else>???</span>
|
||||||
</div>
|
</div>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
</li>
|
||||||
|
|
||||||
<!-- environment metrics chart -->
|
<li class="flex p-3">
|
||||||
<li>
|
<div class="text-sm font-medium text-gray-900">Relative Humidity</div>
|
||||||
<div class="px-4 py-2">
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<div class="w-full">
|
<span v-if="props.node?.relative_humidity">
|
||||||
<canvas id="environmentMetricsChart" style="height:150px;" ref="environment-metrics-chart"></canvas>
|
{{ Number(props.node.relative_humidity).toFixed(0) }}%
|
||||||
<div class="flex">
|
</span>
|
||||||
<div class="mx-auto flex space-x-2">
|
<span v-else>???</span>
|
||||||
<div class="flex mx-auto">
|
</div>
|
||||||
<div class="my-auto w-2 h-2 bg-blue-500 rounded-full"></div>
|
</li>
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Temperature</div>
|
|
||||||
</div>
|
<li class="flex p-3">
|
||||||
<div class="flex mx-auto">
|
<div class="text-sm font-medium text-gray-900">Barometric Pressure</div>
|
||||||
<div class="my-auto w-2 h-2 bg-green-500 rounded-full"></div>
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Humidity</div>
|
<span v-if="props.node?.barometric_pressure">
|
||||||
</div>
|
{{ Number(props.node.barometric_pressure).toFixed(1) }} hPa
|
||||||
<div class="flex mx-auto">
|
</span>
|
||||||
<div class="my-auto w-2 h-2 bg-orange-500 rounded-full"></div>
|
<span v-else>???</span>
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Pressure</div>
|
</div>
|
||||||
</div>
|
</li>
|
||||||
</div>
|
</MetricsChart>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- temperature -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Temperature</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.temperature">{{ formatTemperature(props.node.temperature) }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- relative humidity -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Relative Humidity</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.relative_humidity">{{ Number(props.node.relative_humidity).toFixed(0) }}%</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- barometric pressure -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Barometric Pressure</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.barometric_pressure">{{ Number(props.node.barometric_pressure).toFixed(1) }}hPa</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@ -1,40 +1,40 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { getRegionFrequencyRange } from '../../utils.js';
|
import { getRegionFrequencyRange } from '@/utils';
|
||||||
const props = defineProps(['node']);
|
const props = defineProps({
|
||||||
|
node: Object,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Define a structure for the LoRa config fields
|
||||||
|
const loraConfigFields = [
|
||||||
|
{
|
||||||
|
label: 'Region',
|
||||||
|
key: 'region_name',
|
||||||
|
value: (node) => node.region_name ? `${node.region_name} (${getRegionFrequencyRange(node.region_name)})` : '???',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modem Preset',
|
||||||
|
key: 'modem_preset_name',
|
||||||
|
value: (node) => node.modem_preset_name || '???',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Has Default Channel',
|
||||||
|
key: 'has_default_channel',
|
||||||
|
value: (node) => node.has_default_channel != null ? (node.has_default_channel ? 'Yes' : 'No') : '???',
|
||||||
|
},
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- lora config -->
|
<div>
|
||||||
<div>
|
<div class="bg-gray-200 p-2 font-semibold">LoRa Config</div>
|
||||||
<div class="bg-gray-200 p-2 font-semibold">LoRa Config</div>
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
<!-- Iterate through loraConfigFields to display each item -->
|
||||||
|
<li v-for="(field, index) in loraConfigFields" :key="index" class="flex p-3">
|
||||||
<!-- region -->
|
<div class="text-sm font-medium text-gray-900">{{ field.label }}</div>
|
||||||
<li class="flex p-3">
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<div class="text-sm font-medium text-gray-900">Region</div>
|
{{ field.value(props.node) }}
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
</div>
|
||||||
<span v-if="props.node.region_name">{{ props.node.region_name }} ({{ getRegionFrequencyRange(props.node.region_name) }})</span>
|
</li>
|
||||||
<span v-else>???</span>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- modem preset -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Modem Preset</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.modem_preset_name">{{ props.node.modem_preset_name }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- has default channel -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Has Default Channel</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.has_default_channel != null">{{ props.node.has_default_channel ? "Yes" : "No" }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
@ -1,6 +1,9 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { state } from '../../store.js';
|
const props = defineProps(['data']);
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
const mqttMetrics = computed(() => props.data);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
@ -8,34 +11,27 @@ import moment from 'moment';
|
|||||||
<div class="font-semibold">MQTT</div>
|
<div class="font-semibold">MQTT</div>
|
||||||
<div class="text-sm text-gray-600">Topics this node sent packets to</div>
|
<div class="text-sm text-gray-600">Topics this node sent packets to</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- List of MQTT Topics or No Data -->
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
<template v-if="state.selectedNodeMqttMetrics.length > 0">
|
<li v-if="mqttMetrics.length === 0">
|
||||||
<li v-for="mqttMetric of state.selectedNodeMqttMetrics">
|
<div class="block flex-1 px-4 py-2">
|
||||||
<div class="relative flex items-center">
|
<div class="text-sm text-gray-700">No packets seen on MQTT</div>
|
||||||
<div class="block flex-1 px-4 py-2">
|
</div>
|
||||||
<div class="relative flex min-w-0 flex-1 items-center">
|
</li>
|
||||||
<div class="truncate">
|
|
||||||
<p class="truncate text-sm font-medium text-gray-900">{{ mqttMetric.mqtt_topic }}</p>
|
<li v-else v-for="(mqttMetric, index) in mqttMetrics" :key="`${mqttMetric.mqtt_topic}-${index}`">
|
||||||
<div class="text-sm text-gray-700">Last packet {{ moment(new Date(mqttMetric.last_packet_at)).fromNow() }}</div>
|
<div class="relative flex items-center">
|
||||||
</div>
|
<div class="block flex-1 px-4 py-2">
|
||||||
|
<div class="truncate">
|
||||||
|
<p class="truncate text-sm font-medium text-gray-900">{{ mqttMetric.mqtt_topic }}</p>
|
||||||
|
<div class="text-sm text-gray-700">
|
||||||
|
Last packet {{ moment(new Date(mqttMetric.last_packet_at)).fromNow() }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</div>
|
||||||
</template>
|
</li>
|
||||||
<template v-else>
|
|
||||||
<li>
|
|
||||||
<div class="relative flex items-center">
|
|
||||||
<div class="block flex-1 px-4 py-2">
|
|
||||||
<div class="relative flex min-w-0 flex-1 items-center">
|
|
||||||
<div class="truncate">
|
|
||||||
<div class="text-sm text-gray-700">No packets seen on MQTT</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</template>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -1,45 +1,32 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps(['node']);
|
const props = defineProps({
|
||||||
|
node: Object,
|
||||||
|
});
|
||||||
|
const details = [
|
||||||
|
{ label: 'ID', value: 'node_id' },
|
||||||
|
{ label: 'Hex ID', value: 'node_id_hex' },
|
||||||
|
{ label: 'Role', value: 'role_name' },
|
||||||
|
{ label: 'Hardware', value: 'hardware_model_name' },
|
||||||
|
{ label: 'Firmware', value: 'firmware_version' },
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="bg-gray-200 p-2 font-semibold">Details</div>
|
<div class="bg-gray-200 p-2 font-semibold">Details</div>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
|
<!-- Iterate through the details array to display each item -->
|
||||||
<!-- id -->
|
<li v-for="(detail, index) in details" :key="index" class="flex p-3">
|
||||||
<li class="flex p-3">
|
<div class="text-sm font-medium text-gray-900">{{ detail.label }}</div>
|
||||||
<div class="text-sm font-medium text-gray-900">ID</div>
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
<div class="ml-auto text-sm text-gray-700">{{ props.node.node_id }}</div>
|
<!-- Check for firmware version as special case -->
|
||||||
</li>
|
<span v-if="detail.value === 'firmware_version'">
|
||||||
|
{{ props.node[detail.value] || '???' }}
|
||||||
<!-- hex id -->
|
</span>
|
||||||
<li class="flex p-3">
|
<!-- For other fields, use the node property directly -->
|
||||||
<div class="text-sm font-medium text-gray-900">Hex ID</div>
|
<span v-else>{{ props.node[detail.value] }}</span>
|
||||||
<div class="ml-auto text-sm text-gray-700">{{ props.node.node_id_hex }}</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
</ul>
|
||||||
<!-- role -->
|
</div>
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Role</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">{{ props.node.role_name }}</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- hardware -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Hardware</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">{{ props.node.hardware_model_name }}</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- firmware version -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Firmware</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.firmware_version">{{ props.node.firmware_version }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
@ -1,40 +1,45 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps(['node']);
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
const props = defineProps({
|
||||||
|
node: Object,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Define structure for 'Other' fields
|
||||||
|
const otherFields = [
|
||||||
|
{
|
||||||
|
label: 'First Seen',
|
||||||
|
key: 'created_at',
|
||||||
|
value: (node) => moment(new Date(node.created_at)).fromNow(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Last Seen',
|
||||||
|
key: 'updated_at',
|
||||||
|
value: (node) => moment(new Date(node.updated_at)).fromNow(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Neighbours Updated',
|
||||||
|
key: 'neighbours_updated_at',
|
||||||
|
value: (node) => node.neighbours_updated_at ? moment(new Date(node.neighbours_updated_at)).fromNow() : '???',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Position Updated',
|
||||||
|
key: 'position_updated_at',
|
||||||
|
value: (node) => node.position_updated_at ? moment(new Date(node.position_updated_at)).fromNow() : '???',
|
||||||
|
},
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="bg-gray-200 p-2 font-semibold">Other</div>
|
<div class="bg-gray-200 p-2 font-semibold">Other</div>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
<!-- first seen -->
|
<!-- Iterate through otherFields to display each item -->
|
||||||
<li class="flex p-3">
|
<li v-for="(field, index) in otherFields" :key="index" class="flex p-3">
|
||||||
<div class="text-sm font-medium text-gray-900">First Seen</div>
|
<div class="text-sm font-medium text-gray-900">{{ field.label }}</div>
|
||||||
<div class="ml-auto text-sm text-gray-700">{{ moment(new Date(props.node.created_at)).fromNow() }}</div>
|
<div class="ml-auto text-sm text-gray-700">
|
||||||
</li>
|
{{ field.value(props.node) }}
|
||||||
|
</div>
|
||||||
<!-- last seen -->
|
</li>
|
||||||
<li class="flex p-3">
|
</ul>
|
||||||
<div class="text-sm font-medium text-gray-900">Last Seen</div>
|
</div>
|
||||||
<div class="ml-auto text-sm text-gray-700">{{ moment(new Date(props.node.updated_at)).fromNow() }}</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- neighbours updated -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Neighbours Updated</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.neighbours_updated_at">{{ moment(new Date(props.node.neighbours_updated_at)).fromNow() }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- position updated -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Position Updated</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.position_updated_at">{{ moment(new Date(props.node.position_updated_at)).fromNow() }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
@ -1,34 +1,43 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps(['node']);
|
const props = defineProps({
|
||||||
|
node: Object,
|
||||||
|
});
|
||||||
const emit = defineEmits(['showPositionHistory']);
|
const emit = defineEmits(['showPositionHistory']);
|
||||||
|
|
||||||
|
const positionFields = [
|
||||||
|
{
|
||||||
|
label: 'Lat/Long',
|
||||||
|
key: ['latitude', 'longitude'],
|
||||||
|
value: (node) => node.latitude && node.longitude ? `${node.latitude}, ${node.longitude}` : '???',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Altitude',
|
||||||
|
key: 'altitude',
|
||||||
|
value: (node) => node.altitude ? `${node.altitude}m` : '???',
|
||||||
|
},
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div @click.stop class="flex bg-gray-200 p-2 font-semibold">
|
<div @click.stop class="flex bg-gray-200 p-2 font-semibold">
|
||||||
<div class="my-auto">Position</div>
|
<div class="my-auto">Position</div>
|
||||||
<div class="ml-auto">
|
<div class="ml-auto">
|
||||||
<button @click="$emit('showPositionHistory', props.node.node_id)" type="button" class="rounded-sm bg-white px-2 py-1 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50">
|
<button
|
||||||
Show History
|
@click="$emit('showPositionHistory', props.node.node_id)"
|
||||||
</button>
|
type="button"
|
||||||
</div>
|
class="rounded-sm bg-white px-2 py-1 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50"
|
||||||
</div>
|
>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
Show History
|
||||||
<!-- position -->
|
</button>
|
||||||
<li class="flex p-3">
|
</div>
|
||||||
<div class="text-sm font-medium text-gray-900">Lat/Long</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.latitude && props.node.longitude">{{ props.node.latitude }}, {{ props.node.longitude }}</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<!-- altitude -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Altitude</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="props.node.altitude">{{ props.node.altitude }}m</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
|
<li v-for="(field, index) in positionFields" :key="index" class="flex p-3">
|
||||||
|
<div class="text-sm font-medium text-gray-900">{{ field.label }}</div>
|
||||||
|
<div class="ml-auto text-sm text-gray-700">{{ field.value(props.node) }}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -1,251 +1,119 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import { computed } from 'vue';
|
||||||
import moment from 'moment';
|
import MetricsChart from '@/components/Chart/Metrics.vue';
|
||||||
import { Chart, TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement } from 'chart.js';
|
import ChannelData from '@/components/Chart/PowerMetrics/ChannelData.vue';
|
||||||
import 'chartjs-adapter-moment';
|
const props = defineProps(['data']);
|
||||||
import { onMounted, useTemplateRef, watch } from 'vue';
|
|
||||||
import { state, selectedNodeLatestPowerMetric } from '../../store.js';
|
|
||||||
import { powerMetricsTimeRange } from '../../config.js';
|
|
||||||
import { getTimeSpans } from '../../utils.js';
|
|
||||||
const powerMetricsChartEl = useTemplateRef('power-metrics-chart');
|
|
||||||
|
|
||||||
function initChart() {
|
const legendData = {
|
||||||
// destroy existing chart
|
'Channel 1': 'bg-blue-500',
|
||||||
const existingChart = Chart.getChart(powerMetricsChartEl.value);
|
'Channel 2': 'bg-green-500',
|
||||||
if (existingChart != null) {
|
'Channel 3': 'bg-orange-500',
|
||||||
existingChart.destroy();
|
};
|
||||||
}
|
|
||||||
// create chart data
|
const latestMetric = computed(() => {
|
||||||
const labels = [];
|
const [ latest ] = (props.data ?? []).slice(-1);
|
||||||
const channel1VoltageReadings = [];
|
return latest;
|
||||||
const channel2VoltageReadings = [];
|
});
|
||||||
const channel3VoltageReadings = [];
|
|
||||||
const channel1CurrentReadings = [];
|
// Computed dataset for the chart container
|
||||||
const channel2CurrentReadings = [];
|
const chartData = computed(() => {
|
||||||
const channel3CurrentReadings = [];
|
const metrics = props.data;
|
||||||
for(const powerMetric of state.selectedNodePowerMetrics) {
|
const labels = metrics.map(m => m.created_at);
|
||||||
labels.push(moment(powerMetric.created_at));
|
|
||||||
channel1VoltageReadings.push(powerMetric.ch1_voltage);
|
const colors = ['#3b82f6', '#22c55e', '#f97316'];
|
||||||
channel2VoltageReadings.push(powerMetric.ch2_voltage);
|
const currentColors = ['#93c5fd', '#86efac', '#fdba74'];
|
||||||
channel3VoltageReadings.push(powerMetric.ch3_voltage);
|
|
||||||
channel1CurrentReadings.push(powerMetric.ch1_current);
|
const voltage = [[], [], []];
|
||||||
channel2CurrentReadings.push(powerMetric.ch2_current);
|
const current = [[], [], []];
|
||||||
channel3CurrentReadings.push(powerMetric.ch3_current);
|
|
||||||
}
|
for (const m of metrics) {
|
||||||
// create chart
|
voltage[0].push(m.ch1_voltage);
|
||||||
new Chart(powerMetricsChartEl.value, {
|
voltage[1].push(m.ch2_voltage);
|
||||||
type: 'line',
|
voltage[2].push(m.ch3_voltage);
|
||||||
data: {
|
current[0].push(m.ch1_current);
|
||||||
labels: labels,
|
current[1].push(m.ch2_current);
|
||||||
datasets: [
|
current[2].push(m.ch3_current);
|
||||||
{
|
}
|
||||||
label: 'Ch1 Voltage',
|
|
||||||
suffix: "V",
|
return {
|
||||||
borderColor: '#3b82f6',
|
labels,
|
||||||
backgroundColor: '#3b82f6',
|
datasets: [
|
||||||
pointStyle: false, // no points
|
...voltage.map((data, i) => ({
|
||||||
fill: false,
|
label: `Ch${i + 1} Voltage`,
|
||||||
data: channel1VoltageReadings,
|
suffix: 'V',
|
||||||
yAxisID: 'y',
|
data,
|
||||||
},
|
borderColor: colors[i],
|
||||||
{
|
backgroundColor: colors[i],
|
||||||
label: 'Ch2 Voltage',
|
pointStyle: false,
|
||||||
suffix: "V",
|
fill: false,
|
||||||
borderColor: '#22c55e',
|
yAxisID: 'y',
|
||||||
backgroundColor: '#22c55e',
|
})),
|
||||||
pointStyle: false, // no points
|
...current.map((data, i) => ({
|
||||||
fill: false,
|
label: `Ch${i + 1} Current`,
|
||||||
data: channel2VoltageReadings,
|
suffix: 'mA',
|
||||||
yAxisID: 'y',
|
data,
|
||||||
},
|
borderColor: currentColors[i],
|
||||||
{
|
backgroundColor: currentColors[i],
|
||||||
label: 'Ch3 Voltage',
|
pointStyle: false,
|
||||||
suffix: "V",
|
fill: false,
|
||||||
borderColor: '#f97316',
|
yAxisID: 'y1',
|
||||||
backgroundColor: '#f97316',
|
})),
|
||||||
pointStyle: false, // no points
|
]
|
||||||
fill: false,
|
};
|
||||||
data: channel3VoltageReadings,
|
});
|
||||||
yAxisID: 'y',
|
|
||||||
},
|
// Chart config for axes, tooltips, etc.
|
||||||
{
|
const chartConfig = {
|
||||||
label: 'Ch1 Current',
|
legendDisplay: false,
|
||||||
suffix: "mA",
|
tooltipOptions: {
|
||||||
borderColor: '#93c5fd',
|
mode: 'index',
|
||||||
backgroundColor: '#93c5fd',
|
intersect: false,
|
||||||
pointStyle: false, // no points
|
callbacks: {
|
||||||
fill: false,
|
label: (item) => `${item.dataset.label}: ${item.formattedValue}${item.dataset.suffix || ''}`,
|
||||||
data: channel1CurrentReadings,
|
},
|
||||||
yAxisID: 'y1',
|
},
|
||||||
},
|
scales: {
|
||||||
{
|
x: {
|
||||||
label: 'Ch2 Current',
|
position: 'top',
|
||||||
suffix: "mA",
|
type: 'time',
|
||||||
borderColor: '#86efac',
|
time: {
|
||||||
backgroundColor: '#86efac',
|
unit: 'day',
|
||||||
pointStyle: false, // no points
|
displayFormats: {
|
||||||
fill: false,
|
day: 'MMM DD',
|
||||||
data: channel2CurrentReadings,
|
|
||||||
yAxisID: 'y1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Ch3 Current',
|
|
||||||
suffix: "mA",
|
|
||||||
borderColor: '#fdba74',
|
|
||||||
backgroundColor: '#fdba74',
|
|
||||||
pointStyle: false, // no points
|
|
||||||
fill: false,
|
|
||||||
data: channel3CurrentReadings,
|
|
||||||
yAxisID: 'y1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
options: {
|
},
|
||||||
responsive: true,
|
},
|
||||||
borderWidth: 2,
|
y: {
|
||||||
spanGaps: 1000 * 60 * 60 * 3, // only show lines between metrics with a 3 hour or less gap
|
min: 0,
|
||||||
elements: {
|
max: 30,
|
||||||
point: {
|
ticks: {
|
||||||
radius: 2,
|
callback: (label) => `${label}V`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
scales: {
|
y1: {
|
||||||
x: {
|
min: -500,
|
||||||
position: 'top',
|
max: 500,
|
||||||
type: 'time',
|
position: 'right',
|
||||||
time: {
|
grid: {
|
||||||
unit: 'day',
|
drawOnChartArea: false,
|
||||||
displayFormats: {
|
},
|
||||||
day: 'MMM DD', // Jan 01
|
ticks: {
|
||||||
},
|
stepSize: 50,
|
||||||
},
|
callback: (label) => `${label}mA`,
|
||||||
},
|
},
|
||||||
y: {
|
},
|
||||||
min: 0,
|
},
|
||||||
max: 30,
|
};
|
||||||
ticks: {
|
|
||||||
callback: (label) => `${label}V`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
y1: {
|
|
||||||
min: -500,
|
|
||||||
max: 500,
|
|
||||||
ticks: {
|
|
||||||
stepSize: 50,
|
|
||||||
callback: (label) => `${label}mA`,
|
|
||||||
},
|
|
||||||
position: 'right',
|
|
||||||
grid: {
|
|
||||||
drawOnChartArea: false, // only want the grid lines for one axis to show up
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false,
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
mode: "index",
|
|
||||||
intersect: false,
|
|
||||||
callbacks: {
|
|
||||||
label: (item) => {
|
|
||||||
return `${item.dataset.label}: ${item.formattedValue}${item.dataset.suffix}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
watch(
|
|
||||||
() => state.selectedNodePowerMetrics,
|
|
||||||
(newValue) => {
|
|
||||||
if (newValue !== []) {
|
|
||||||
initChart()
|
|
||||||
}
|
|
||||||
}, {deep: true}
|
|
||||||
)
|
|
||||||
onMounted(() => {
|
|
||||||
Chart.register(TimeScale, LinearScale, LineController, Tooltip, Legend, PointElement, LineElement)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<!-- power metrics -->
|
<MetricsChart
|
||||||
<div>
|
title="Power Metrics"
|
||||||
<div class="flex bg-gray-200 p-2 font-semibold">
|
:data="chartData"
|
||||||
<div class="my-auto">Power Metrics</div>
|
chartType="line"
|
||||||
<div class="my-auto ml-auto">
|
timeRangeKey="powerMetricsTimeRange"
|
||||||
<select v-model="powerMetricsTimeRange" class="block w-full rounded-md border-0 py-0.5 pl-2 pr-8 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6">
|
:legendData="legendData"
|
||||||
<option v-for="(range, index) in getTimeSpans()" :value="index">{{ range.name }}</option>
|
:chartConfig="chartConfig"
|
||||||
</select>
|
>
|
||||||
</div>
|
<ChannelData v-for="i in [1, 2, 3]" :key="i" :channel="i" :latest="latestMetric"/>
|
||||||
</div>
|
</MetricsChart>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
</template>
|
||||||
|
|
||||||
<!-- power metrics chart -->
|
|
||||||
<li>
|
|
||||||
<div class="px-4 py-2">
|
|
||||||
<div class="w-full">
|
|
||||||
<canvas id="powerMetricsChart" style="height:150px;" ref="power-metrics-chart"></canvas>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="mx-auto flex space-x-2">
|
|
||||||
<div class="flex mx-auto">
|
|
||||||
<div class="my-auto w-2 h-2 bg-blue-500 rounded-full"></div>
|
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Channel 1</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex mx-auto">
|
|
||||||
<div class="my-auto w-2 h-2 bg-green-500 rounded-full"></div>
|
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Channel 2</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex mx-auto">
|
|
||||||
<div class="my-auto w-2 h-2 bg-orange-500 rounded-full"></div>
|
|
||||||
<div class="my-auto ml-1 text-sm text-gray-500">Channel 3</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- channel 1 -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Channel 1</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric">
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric?.ch1_voltage">{{ Number(selectedNodeLatestPowerMetric.ch1_voltage).toFixed(2) }}V</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric?.ch1_current"> / {{ Number(selectedNodeLatestPowerMetric.ch1_current).toFixed(2) }}mA</span>
|
|
||||||
</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- channel 2 -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Channel 2</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric">
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric?.ch2_voltage">{{ Number(selectedNodeLatestPowerMetric.ch2_voltage).toFixed(2) }}V</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric?.ch2_current"> / {{ Number(selectedNodeLatestPowerMetric.ch2_current).toFixed(2) }}mA</span>
|
|
||||||
</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- channel 3 -->
|
|
||||||
<li class="flex p-3">
|
|
||||||
<div class="text-sm font-medium text-gray-900">Channel 3</div>
|
|
||||||
<div class="ml-auto text-sm text-gray-700">
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric">
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric?.ch3_voltage">{{ Number(selectedNodeLatestPowerMetric.ch3_voltage).toFixed(2) }}V</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
<span v-if="selectedNodeLatestPowerMetric?.ch3_current"> / {{ Number(selectedNodeLatestPowerMetric.ch3_current).toFixed(2) }}mA</span>
|
|
||||||
</span>
|
|
||||||
<span v-else>???</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@ -1,27 +1,35 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps(['node']);
|
const props = defineProps({
|
||||||
import { getShareLinkForNode, copyShareLinkForNode } from '../../utils.js';
|
node: Object,
|
||||||
|
});
|
||||||
|
import { getShareLinkForNode, copyShareLinkForNode } from '@/utils';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="flex bg-gray-200 p-2 font-semibold">
|
<div class="flex bg-gray-200 p-2 font-semibold">
|
||||||
<div class="my-auto">Share Link</div>
|
<div class="my-auto">Share Link</div>
|
||||||
<div class="ml-auto">
|
<div class="ml-auto">
|
||||||
<button @click="copyShareLinkForNode(props.node.node_id)" type="button" class="rounded-sm bg-white px-2 py-1 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">
|
<button
|
||||||
Copy
|
@click="copyShareLinkForNode(props.node.node_id)"
|
||||||
</button>
|
type="button"
|
||||||
</div>
|
class="rounded-sm bg-white px-2 py-1 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"
|
||||||
</div>
|
>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
Copy
|
||||||
<li>
|
</button>
|
||||||
<div class="relative flex items-center">
|
</div>
|
||||||
<div class="block flex-1 p-2">
|
|
||||||
<div class="flex space-x-2">
|
|
||||||
<input type="text" readonly class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" :value="getShareLinkForNode(props.node.node_id)">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
|
<li class="p-3">
|
||||||
|
<div class="flex space-x-2">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
readonly
|
||||||
|
:value="getShareLinkForNode(props.node.node_id)"
|
||||||
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -1,7 +1,9 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
const props = defineProps(['data']);
|
||||||
const emit = defineEmits(['showTraceRoute']);
|
const emit = defineEmits(['showTraceRoute']);
|
||||||
import { state } from '../../store.js';
|
import moment from 'moment';
|
||||||
import { findNodeById } from '../../utils.js';
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
|
const mapData = useMapStore();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
@ -10,13 +12,13 @@ import { findNodeById } from '../../utils.js';
|
|||||||
<div class="text-sm text-gray-600">Only 5 most recent are shown</div>
|
<div class="text-sm text-gray-600">Only 5 most recent are shown</div>
|
||||||
</div>
|
</div>
|
||||||
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
<ul role="list" class="flex-1 divide-y divide-gray-200">
|
||||||
<template v-if="state.selectedNodeTraceroutes.length > 0">
|
<template v-if="props.data.length > 0">
|
||||||
<li @click="$emit('showTraceRoute', traceroute)" v-for="traceroute of state.selectedNodeTraceroutes">
|
<li @click="$emit('showTraceRoute', traceroute)" v-for="traceroute of props.data">
|
||||||
<div class="relative flex items-center">
|
<div class="relative flex items-center">
|
||||||
<div class="block flex-1 px-4 py-2">
|
<div class="block flex-1 px-4 py-2">
|
||||||
<div class="relative flex min-w-0 flex-1 items-center">
|
<div class="relative flex min-w-0 flex-1 items-center">
|
||||||
<div>
|
<div>
|
||||||
<p class="text-sm text-gray-900"><span class="font-medium">{{ findNodeById(traceroute.to)?.long_name || '???' }}</span> to <span class="font-medium">{{ findNodeById(traceroute.from)?.long_name || '???' }}</span></p>
|
<p class="text-sm text-gray-900"><span class="font-medium">{{ mapData.findNodeById(traceroute.to)?.long_name || '???' }}</span> to <span class="font-medium">{{ mapData.findNodeById(traceroute.from)?.long_name || '???' }}</span></p>
|
||||||
<div class="text-sm text-gray-700">{{ moment(new Date(traceroute.updated_at)).fromNow() }} - {{ traceroute.route.length }} hops {{ traceroute.channel_id ? `on ${traceroute.channel_id}` : '' }}</div>
|
<div class="text-sm text-gray-700">{{ moment(new Date(traceroute.updated_at)).fromNow() }} - {{ traceroute.route.length }} hops {{ traceroute.channel_id ? `on ${traceroute.channel_id}` : '' }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,47 +1,62 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
// TODO: close node details tooltip when this opens
|
||||||
|
import { state } from '@/store';
|
||||||
|
import CloseActionButton from '@/components/CloseActionButton.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['dismiss']);
|
const emit = defineEmits(['dismiss']);
|
||||||
import { state } from '../store.js';
|
const props = defineProps({
|
||||||
function dismissShowingNodeNeighbours() {
|
node: {
|
||||||
state.selectedNodeToShowNeighbours = null;
|
type: Object,
|
||||||
emit('dismiss');
|
required: false,
|
||||||
}
|
validator(value) {
|
||||||
|
return value === null || typeof value === 'object';
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
||||||
<!-- sidebar -->
|
<transition
|
||||||
<transition
|
enter-active-class="transition duration-300 ease-in-out transform"
|
||||||
enter-active-class="transition duration-300 ease-in-out transform"
|
enter-from-class="translate-y-full"
|
||||||
enter-from-class="translate-y-full"
|
enter-to-class="translate-y-0"
|
||||||
enter-to-class="translate-y-0"
|
leave-active-class="transition duration-300 ease-in-out transform"
|
||||||
leave-active-class="transition duration-300 ease-in-out transform"
|
leave-from-class="translate-y-0"
|
||||||
leave-from-class="translate-y-0"
|
leave-to-class="translate-y-full"
|
||||||
leave-to-class="translate-y-full">
|
>
|
||||||
<div v-show="state.selectedNodeToShowNeighbours != null" class="fixed left-0 right-0 bottom-0">
|
<div v-show="props.node !== null" class="fixed left-0 right-0 bottom-0">
|
||||||
<div v-if="state.selectedNodeToShowNeighbours != null" class="mx-auto w-screen max-w-md p-4">
|
<div v-if="props.node !== null" class="mx-auto w-screen max-w-md p-4">
|
||||||
<div class="flex h-full flex-col bg-white shadow-xl rounded-xl border">
|
<div class="flex h-full flex-col bg-white shadow-xl rounded-xl border">
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<div class="flex items-start justify-between">
|
<div class="flex items-start justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="font-bold">{{ state.selectedNodeToShowNeighbours.short_name }} Neighbours</h2>
|
<h2 class="font-bold">
|
||||||
<h3 v-if="state.selectedNodeToShowNeighboursType === 'weHeard'" class="text-sm">Nodes heard by {{ state.selectedNodeToShowNeighbours.short_name }}</h3>
|
{{ props.node.short_name }} Neighbors
|
||||||
<h3 v-if="state.selectedNodeToShowNeighboursType === 'theyHeard'" class="text-sm">Nodes that heard {{ state.selectedNodeToShowNeighbours.short_name }}</h3>
|
</h2>
|
||||||
</div>
|
<h3
|
||||||
<div class="my-auto ml-3 flex h-7 items-center">
|
v-if="state.neighborsModalType === 'weHeard'"
|
||||||
<a href="javascript:void(0)" class="rounded-full" @click="dismissShowingNodeNeighbours">
|
class="text-sm"
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
>
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
Nodes heard by {{ props.node.short_name }}
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
</h3>
|
||||||
<path d="M18 6l-12 12"></path>
|
<h3
|
||||||
<path d="M6 6l12 12"></path>
|
v-if="state.neighborsModalType === 'theyHeard'"
|
||||||
</svg>
|
class="text-sm"
|
||||||
</div>
|
>
|
||||||
</a>
|
Nodes that heard {{ props.node.short_name }}
|
||||||
</div>
|
</h3>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<CloseActionButton
|
||||||
|
@click="$emit('dismiss')"
|
||||||
|
class="my-auto ml-3"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -1,11 +1,21 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const emit = defineEmits(['dismiss']);
|
const emit = defineEmits(['dismiss']);
|
||||||
import { state } from '../store.js';
|
const props = defineProps({
|
||||||
|
node: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
validator(value) {
|
||||||
|
return value === null || typeof value === 'object';
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
import { state } from '@/store';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { useUIStore } from '@/stores/uiStore';
|
||||||
|
|
||||||
|
const ui = useUIStore();
|
||||||
function dismissShowingNodePositionHistory() {
|
function dismissShowingNodePositionHistory() {
|
||||||
state.selectedNodePositionHistory = [];
|
ui.collapsePositionHistoryModal();
|
||||||
state.selectedNodeToShowPositionHistory = null;
|
|
||||||
state.positionHistoryModalExpanded = false;
|
|
||||||
emit('dismiss');
|
emit('dismiss');
|
||||||
}
|
}
|
||||||
function onPositionHistoryQuickRangeClick(range) {
|
function onPositionHistoryQuickRangeClick(range) {
|
||||||
@ -41,15 +51,15 @@ function onPositionHistoryQuickRangeClick(range) {
|
|||||||
leave-active-class="transition duration-300 ease-in-out transform"
|
leave-active-class="transition duration-300 ease-in-out transform"
|
||||||
leave-from-class="translate-y-0"
|
leave-from-class="translate-y-0"
|
||||||
leave-to-class="translate-y-full">
|
leave-to-class="translate-y-full">
|
||||||
<div v-show="state.selectedNodeToShowPositionHistory != null" class="fixed left-0 right-0 bottom-0">
|
<div v-show="props.node != null" class="fixed left-0 right-0 bottom-0">
|
||||||
<div v-if="state.selectedNodeToShowPositionHistory != null" class="mx-auto w-screen max-w-md p-4">
|
<div v-if="props.node != null" class="mx-auto w-screen max-w-md p-4">
|
||||||
<div class="flex h-full flex-col bg-white shadow-xl rounded-xl border">
|
<div class="flex h-full flex-col bg-white shadow-xl rounded-xl border">
|
||||||
<div>
|
<div>
|
||||||
<div class="flex p-2">
|
<div class="flex p-2">
|
||||||
<div class="flex my-auto mr-3 space-x-2">
|
<div class="flex my-auto mr-3 space-x-2">
|
||||||
<a href="javascript:void(0)" @click="state.positionHistoryModalExpanded = !state.positionHistoryModalExpanded" class="rounded-full">
|
<a href="javascript:void(0)" @click="ui.togglePositionHistoryModalExpansion" class="rounded-full">
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-1 rounded-full">
|
<div class="bg-gray-100 hover:bg-gray-200 p-1 rounded-full">
|
||||||
<svg v-if="state.positionHistoryModalExpanded" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
<svg v-if="ui.positionHistoryModalExpanded" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
|
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
|
||||||
</svg>
|
</svg>
|
||||||
<svg v-else xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
<svg v-else xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||||
@ -58,7 +68,7 @@ function onPositionHistoryQuickRangeClick(range) {
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-auto mr-auto font-bold">{{ state.selectedNodeToShowPositionHistory.short_name }} Position History</div>
|
<div class="my-auto mr-auto font-bold">{{ props.node.short_name }} Position History</div>
|
||||||
<div class="flex my-auto ml-3 space-x-2">
|
<div class="flex my-auto ml-3 space-x-2">
|
||||||
<a href="javascript:void(0)" class="rounded-full" @click="dismissShowingNodePositionHistory">
|
<a href="javascript:void(0)" class="rounded-full" @click="dismissShowingNodePositionHistory">
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-1 rounded-full">
|
<div class="bg-gray-100 hover:bg-gray-200 p-1 rounded-full">
|
||||||
@ -71,7 +81,7 @@ function onPositionHistoryQuickRangeClick(range) {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="state.positionHistoryModalExpanded" class="divide-y border-t">
|
<div v-if="ui.positionHistoryModalExpanded" class="divide-y border-t">
|
||||||
|
|
||||||
<!-- quick range -->
|
<!-- quick range -->
|
||||||
<div class="flex p-2 space-x-2">
|
<div class="flex p-2 space-x-2">
|
||||||
|
|||||||
138
webapp/frontend/src/components/NodeTooltip.vue
Normal file
138
webapp/frontend/src/components/NodeTooltip.vue
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed, onMounted } from 'vue';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { hasNodeUplinkedToMqttRecently, getRegionFrequencyRange, formatPositionPrecision } from '@/utils';
|
||||||
|
import { state } from '@/store';
|
||||||
|
const emit = defineEmits(['showNeighbors']);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
node: Object,
|
||||||
|
});
|
||||||
|
const popupContent = ref(null);
|
||||||
|
const hideImage = ref(false);
|
||||||
|
const hardwareImage = `/images/devices/${props.node.hardware_model_name}.png`;
|
||||||
|
|
||||||
|
const mqttStatus = hasNodeUplinkedToMqttRecently(props.node);
|
||||||
|
const mqttClass = mqttStatus ? 'text-green-700' : 'text-blue-700';
|
||||||
|
const mqttLabel = mqttStatus ? 'Connected' : 'Disconnected';
|
||||||
|
const mqttUpdatedAt = props.node.mqtt_connection_state_updated_at
|
||||||
|
? moment(props.node.mqtt_connection_state_updated_at).fromNow()
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const loraFrequencyRange = getRegionFrequencyRange(props.node.region_name);
|
||||||
|
|
||||||
|
const formattedVoltage = computed(() => {
|
||||||
|
return typeof props.node.value?.voltage === 'number'
|
||||||
|
? `${props.node.value.voltage.toFixed(2)}V`
|
||||||
|
: null;
|
||||||
|
});
|
||||||
|
|
||||||
|
const formattedChannelUtilization = computed(() => {
|
||||||
|
return typeof props.node.value?.channel_utilization === 'number'
|
||||||
|
? `${props.node.value.channel_utilization.toFixed(2)}%`
|
||||||
|
: null;
|
||||||
|
});
|
||||||
|
|
||||||
|
const formattedAirUtil = computed(() => {
|
||||||
|
return typeof props.node.value?.air_util_tx === 'number'
|
||||||
|
? `${props.node.value.air_util_tx.toFixed(2)}%`
|
||||||
|
: null;
|
||||||
|
});
|
||||||
|
|
||||||
|
function formatDate(date) {
|
||||||
|
return moment(date).fromNow();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ref="popupContent">
|
||||||
|
<img
|
||||||
|
v-if="hardwareImage"
|
||||||
|
class="mb-4 w-40 mx-auto"
|
||||||
|
:src="hardwareImage"
|
||||||
|
@error="hideImage = true"
|
||||||
|
v-show="!hideImage"
|
||||||
|
/>
|
||||||
|
<div class="font-bold text-center">{{ node.long_name }}</div>
|
||||||
|
Short Name: {{ node.short_name }}
|
||||||
|
<br />MQTT:
|
||||||
|
<span>
|
||||||
|
<span :class="mqttClass">{{ mqttLabel }}</span>
|
||||||
|
<span v-if="mqttUpdatedAt"> ({{ mqttUpdatedAt }})</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br v-if="node.num_online_local_nodes !== null" />
|
||||||
|
<span v-if="node.num_online_local_nodes !== null">
|
||||||
|
Local Nodes Online: {{ node.num_online_local_nodes }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br v-if="node.position_precision !== 32 && node.position_precision !== null" />
|
||||||
|
<span v-if="node.position_precision !== 32 && node.position_precision !== null">
|
||||||
|
Position Precision: {{ formatPositionPrecision(node.position_precision) }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br /><br />Role: {{ node.role_name }}
|
||||||
|
<br />Hardware: {{ node.hardware_model_name }}
|
||||||
|
|
||||||
|
<br v-if="node.firmware_version" />
|
||||||
|
<span v-if="node.firmware_version">Firmware: {{ node.firmware_version }}</span>
|
||||||
|
|
||||||
|
<br v-if="node.region_name" />
|
||||||
|
<span v-if="node.region_name">
|
||||||
|
LoRa Region: {{ node.region_name }} ({{ loraFrequencyRange }})
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br v-if="node.modem_preset_name" />
|
||||||
|
<span v-if="node.modem_preset_name">Modem Preset: {{ node.modem_preset_name }}</span>
|
||||||
|
|
||||||
|
<br v-if="node.has_default_channel !== null" />
|
||||||
|
<span v-if="node.has_default_channel !== null">
|
||||||
|
Has Default Channel: {{ node.has_default_channel ? 'Yes' : 'No' }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br v-if="node.battery_level" />
|
||||||
|
<span v-if="node.battery_level">
|
||||||
|
Battery:
|
||||||
|
{{
|
||||||
|
node.battery_level > 100
|
||||||
|
? 'Plugged In'
|
||||||
|
: `${node.battery_level}%`
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br v-if="formattedVoltage" />
|
||||||
|
<span v-if="formattedVoltage">Voltage: {{ formattedVoltage }}</span>
|
||||||
|
|
||||||
|
<br v-if="formattedChannelUtilization" />
|
||||||
|
<span v-if="formattedChannelUtilization">
|
||||||
|
Ch Util: {{ formattedChannelUtilization }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br v-if="formattedAirUtil" />
|
||||||
|
<span v-if="formattedAirUtil">Air Util: {{ formattedAirUtil }}</span>
|
||||||
|
|
||||||
|
<br v-if="node.altitude && node.altitude < 42949000" />
|
||||||
|
<span v-if="node.altitude && node.altitude < 42949000">
|
||||||
|
Altitude: {{ node.altitude }}m
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br /><br />ID: {{ node.node_id }}
|
||||||
|
<br />Hex ID: {{ node.node_id_hex }}
|
||||||
|
<br />Updated: {{ formatDate(node.updated_at) }}
|
||||||
|
<br v-if="node.neighbours_updated_at" />
|
||||||
|
<span v-if="node.neighbours_updated_at">
|
||||||
|
Neighbours Updated: {{ formatDate(node.neighbours_updated_at) }}
|
||||||
|
</span>
|
||||||
|
<br v-if="node.position_updated_at" />
|
||||||
|
<span v-if="node.position_updated_at">
|
||||||
|
Position Updated: {{ formatDate(node.position_updated_at) }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br /><br />
|
||||||
|
<button @click="state.selectedNode = node" class="border border-gray-300 bg-gray-100 p-1 w-full rounded-sm hover:bg-gray-200 mb-1">Show Full Details</button>
|
||||||
|
<br />
|
||||||
|
<button @click="$emit('showNeighbors', node.node_id, 'theyHeard')" class="border border-gray-300 bg-gray-100 p-1 w-full rounded-sm hover:bg-gray-200 mb-1">Show Neighbours (Heard Us)</button>
|
||||||
|
<br />
|
||||||
|
<button @click="$emit('showNeighbors', node.node_id, 'weHeard')" class="border border-gray-300 bg-gray-100 p-1 w-full rounded-sm hover:bg-gray-200">Show Neighbours (We Heard)</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@ -1,210 +1,144 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { state } from '../store.js';
|
import { useUIStore } from '@/stores/uiStore';
|
||||||
import {
|
import { useConfigStore } from '@/stores/configStore';
|
||||||
nodesMaxAge,
|
import SettingField from '@/components/Settings/Field.vue';
|
||||||
nodesDisconnectedAge,
|
|
||||||
nodesOfflineAge,
|
const ui = useUIStore();
|
||||||
waypointsMaxAge,
|
const configStore = useConfigStore();
|
||||||
neighboursMaxDistance,
|
|
||||||
goToNodeZoomLevel,
|
const timeOptions = [
|
||||||
temperatureFormat,
|
{ value: null, label: 'Show All' },
|
||||||
autoUpdatePositionInUrl,
|
{ value: 900, label: '15 minutes' },
|
||||||
enableMapAnimations,
|
{ value: 1800, label: '30 minutes' },
|
||||||
} from '../config.js';
|
{ value: 3600, label: '1 hour' },
|
||||||
|
{ value: 10800, label: '3 hours' },
|
||||||
|
{ value: 21600, label: '6 hours' },
|
||||||
|
{ value: 43200, label: '12 hours' },
|
||||||
|
{ value: 86400, label: '24 hours' },
|
||||||
|
{ value: 172800, label: '2 days' },
|
||||||
|
{ value: 259200, label: '3 days' },
|
||||||
|
{ value: 345600, label: '4 days' },
|
||||||
|
{ value: 432000, label: '5 days' },
|
||||||
|
{ value: 518400, label: '6 days' },
|
||||||
|
{ value: 604800, label: '7 days' },
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- settings sidebar -->
|
|
||||||
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
||||||
|
<!-- Overlay -->
|
||||||
<!-- overlay -->
|
<transition
|
||||||
<transition
|
enter-active-class="transition-opacity duration-300 ease-linear"
|
||||||
enter-active-class="transition-opacity duration-300 ease-linear"
|
enter-from-class="opacity-0"
|
||||||
enter-from-class="opacity-0"
|
enter-to-class="opacity-100"
|
||||||
enter-to-class="opacity-100"
|
leave-active-class="transition-opacity duration-300 ease-linear"
|
||||||
leave-active-class="transition-opacity duration-300 ease-linear"
|
leave-from-class="opacity-100"
|
||||||
leave-from-class="opacity-100"
|
leave-to-class="opacity-0"
|
||||||
leave-to-class="opacity-0">
|
>
|
||||||
<div v-show="state.settingsVisible" @click="state.settingsVisible = !state.settingsVisible" class="fixed inset-0 bg-gray-900/75"></div>
|
<div v-show="ui.settingsVisible" @click="ui.toggleSettings" class="fixed inset-0 bg-gray-900/75"></div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<!-- sidebar -->
|
<!-- Sidebar -->
|
||||||
<transition
|
<transition
|
||||||
enter-active-class="transition duration-300 ease-in-out transform"
|
enter-active-class="transition duration-300 ease-in-out transform"
|
||||||
enter-from-class="-translate-x-full"
|
enter-from-class="-translate-x-full"
|
||||||
enter-to-class="translate-x-0"
|
enter-to-class="translate-x-0"
|
||||||
leave-active-class="transition duration-300 ease-in-out transform"
|
leave-active-class="transition duration-300 ease-in-out transform"
|
||||||
leave-from-class="translate-x-0"
|
leave-from-class="translate-x-0"
|
||||||
leave-to-class="-translate-x-full">
|
leave-to-class="-translate-x-full"
|
||||||
<div v-show="state.settingsVisible" class="fixed top-0 left-0 bottom-0">
|
>
|
||||||
<div v-if="state.settingsVisible" class="w-screen h-full max-w-md overflow-hidden">
|
<div v-show="ui.settingsVisible" class="fixed top-0 left-0 bottom-0">
|
||||||
<div class="flex h-full flex-col bg-white shadow-xl">
|
<div v-if="ui.settingsVisible" class="w-screen h-full max-w-md overflow-hidden">
|
||||||
|
<div class="flex h-full flex-col bg-white shadow-xl">
|
||||||
<!-- slideover header -->
|
<!-- Header -->
|
||||||
<div class="p-2 border-b border-gray-200 shadow-sm">
|
<div class="p-2 border-b border-gray-200 shadow-sm">
|
||||||
<div class="flex items-start justify-between">
|
<div class="flex items-start justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="font-bold">Settings</h2>
|
<h2 class="font-bold">Settings</h2>
|
||||||
<h3 class="text-sm">Changes are only saved in this browser.</h3>
|
<h3 class="text-sm">Changes are only saved in this browser.</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-auto ml-3 flex h-7 items-center">
|
<button class="ml-3 p-2 bg-gray-100 hover:bg-gray-200 rounded-full" @click="ui.hideSettings">
|
||||||
<a href="javascript:void(0)" class="rounded-full" @click="state.settingsVisible = false">
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6 18L18 6M6 6l12 12" />
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
</svg>
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
</button>
|
||||||
<path d="M18 6l-12 12"></path>
|
|
||||||
<path d="M6 6l12 12"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="overflow-y-auto divide-y divide-gray-200">
|
|
||||||
|
|
||||||
<!-- configNodesMaxAgeInSeconds -->
|
|
||||||
<div class="p-2">
|
|
||||||
<label class="block text-sm font-medium text-gray-900">Nodes Max Age</label>
|
|
||||||
<div class="text-xs text-gray-600 mb-2">Nodes not updated within this time are hidden. Reload to update map.</div>
|
|
||||||
<select v-model="nodesMaxAge" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
|
||||||
<option :value="null">Show All</option>
|
|
||||||
<option value="900">15 minutes</option>
|
|
||||||
<option value="1800">30 minutes</option>
|
|
||||||
<option value="3600">1 hour</option>
|
|
||||||
<option value="10800">3 hours</option>
|
|
||||||
<option value="21600">6 hours</option>
|
|
||||||
<option value="43200">12 hours</option>
|
|
||||||
<option value="86400">24 hours</option>
|
|
||||||
<option value="172800">2 days</option>
|
|
||||||
<option value="259200">3 days</option>
|
|
||||||
<option value="345600">4 days</option>
|
|
||||||
<option value="432000">5 days</option>
|
|
||||||
<option value="518400">6 days</option>
|
|
||||||
<option value="604800">7 days</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configNodesDisconnectedAgeInSeconds -->
|
|
||||||
<div class="p-2">
|
|
||||||
<label class="block text-sm font-medium text-gray-900">Nodes Disconnected Age</label>
|
|
||||||
<div class="text-xs text-gray-600 mb-2">Nodes that have not uplinked to MQTT in this time will show as blue icons. Reload to update map.</div>
|
|
||||||
<select v-model="nodesDisconnectedAge" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
|
||||||
<option value="900">15 minutes</option>
|
|
||||||
<option value="1800">30 minutes</option>
|
|
||||||
<option value="2700">45 minutes</option>
|
|
||||||
<option value="3600">1 hour</option>
|
|
||||||
<option value="7200">2 hours</option>
|
|
||||||
<option value="10800">3 hours</option>
|
|
||||||
<option value="21600">6 hours</option>
|
|
||||||
<option value="43200">12 hours</option>
|
|
||||||
<option value="86400">24 hours</option>
|
|
||||||
<option value="172800">2 days</option>
|
|
||||||
<option value="259200">3 days</option>
|
|
||||||
<option value="345600">4 days</option>
|
|
||||||
<option value="432000">5 days</option>
|
|
||||||
<option value="518400">6 days</option>
|
|
||||||
<option value="604800">7 days</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configNodesOfflineAgeInSeconds -->
|
|
||||||
<div class="p-2">
|
|
||||||
<label class="block text-sm font-medium text-gray-900">Nodes Offline Age</label>
|
|
||||||
<div class="text-xs text-gray-600 mb-2">Nodes not updated within this time will show as red icons. Reload to update map.</div>
|
|
||||||
<select v-model="nodesOfflineAge" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
|
||||||
<option :value="null">Don't show as offline</option>
|
|
||||||
<option value="900">15 minutes</option>
|
|
||||||
<option value="1800">30 minutes</option>
|
|
||||||
<option value="2700">45 minutes</option>
|
|
||||||
<option value="3600">1 hour</option>
|
|
||||||
<option value="7200">2 hours</option>
|
|
||||||
<option value="10800">3 hours</option>
|
|
||||||
<option value="21600">6 hours</option>
|
|
||||||
<option value="43200">12 hours</option>
|
|
||||||
<option value="86400">24 hours</option>
|
|
||||||
<option value="172800">2 days</option>
|
|
||||||
<option value="259200">3 days</option>
|
|
||||||
<option value="345600">4 days</option>
|
|
||||||
<option value="432000">5 days</option>
|
|
||||||
<option value="518400">6 days</option>
|
|
||||||
<option value="604800">7 days</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configWaypointsMaxAgeInSeconds -->
|
|
||||||
<div class="p-2">
|
|
||||||
<label class="block text-sm font-medium text-gray-900">Waypoints Max Age</label>
|
|
||||||
<div class="text-xs text-gray-600 mb-2">Waypoints not updated within this time are hidden. Reload to update map.</div>
|
|
||||||
<select v-model="waypointsMaxAge" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
|
||||||
<option :value="null">Show All</option>
|
|
||||||
<option value="900">15 minutes</option>
|
|
||||||
<option value="1800">30 minutes</option>
|
|
||||||
<option value="3600">1 hour</option>
|
|
||||||
<option value="10800">3 hours</option>
|
|
||||||
<option value="21600">6 hours</option>
|
|
||||||
<option value="43200">12 hours</option>
|
|
||||||
<option value="86400">24 hours</option>
|
|
||||||
<option value="172800">2 days</option>
|
|
||||||
<option value="259200">3 days</option>
|
|
||||||
<option value="345600">4 days</option>
|
|
||||||
<option value="432000">5 days</option>
|
|
||||||
<option value="518400">6 days</option>
|
|
||||||
<option value="604800">7 days</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configNeighboursMaxDistanceInMeters -->
|
|
||||||
<div class="p-2">
|
|
||||||
<label class="block text-sm font-medium text-gray-900">Neighbours Max Distance (meters)</label>
|
|
||||||
<div class="text-xs text-gray-600 mb-2">Neighbours further than this are hidden. Reload to update map.</div>
|
|
||||||
<input type="number" v-model="neighboursMaxDistance" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configZoomLevelGoToNode -->
|
|
||||||
<div class="p-2">
|
|
||||||
<label class="block text-sm font-medium text-gray-900">Zoom Level (go to node)</label>
|
|
||||||
<div class="text-xs text-gray-600 mb-2">How far to zoom map when navigating to a node.</div>
|
|
||||||
<input type="number" v-model="goToNodeZoomLevel" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configTemperatureFormat -->
|
|
||||||
<div class="p-2">
|
|
||||||
<label class="block text-sm font-medium text-gray-900">Temperature Format</label>
|
|
||||||
<div class="text-xs text-gray-600 mb-2">Metrics will be shown in the selected format.</div>
|
|
||||||
<select v-model="temperatureFormat" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
|
||||||
<option value="celsius">Celsius (ºC)</option>
|
|
||||||
<option value="fahrenheit">Fahrenheit (ºF)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configAutoUpdatePositionInUrl -->
|
|
||||||
<div class="p-2">
|
|
||||||
<div class="flex items-start">
|
|
||||||
<div class="flex items-center h-5">
|
|
||||||
<input type="checkbox" v-model="autoUpdatePositionInUrl" class="w-4 h-4 border border-gray-300 rounded-sm bg-gray-50 focus:ring-3 focus:ring-blue-300" required>
|
|
||||||
</div>
|
|
||||||
<label class="ml-2 text-sm font-medium text-gray-900">Auto Update Position in URL</label>
|
|
||||||
</div>
|
|
||||||
<div class="text-xs text-gray-600">Sets lat/lng/zoom as query parameters.</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- configEnableMapAnimations -->
|
|
||||||
<div class="p-2">
|
|
||||||
<div class="flex items-start">
|
|
||||||
<div class="flex items-center h-5">
|
|
||||||
<input type="checkbox" v-model="enableMapAnimations" class="w-4 h-4 border border-gray-300 rounded-sm bg-gray-50 focus:ring-3 focus:ring-blue-300" required>
|
|
||||||
</div>
|
|
||||||
<label class="ml-2 text-sm font-medium text-gray-900">Enable Map Animations</label>
|
|
||||||
</div>
|
|
||||||
<div class="text-xs text-gray-600">Map will animate flying to nodes.</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<div class="overflow-y-auto divide-y divide-gray-200">
|
||||||
|
<SettingField
|
||||||
|
label="Nodes Max Age"
|
||||||
|
helpText="Nodes not updated within this time are hidden. Reload to update map."
|
||||||
|
v-model="configStore.nodesMaxAge"
|
||||||
|
:options="timeOptions"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Nodes Disconnected Age"
|
||||||
|
helpText="Nodes without recent MQTT uplinks appear blue. Reload to update map."
|
||||||
|
v-model="configStore.nodesDisconnectedAge"
|
||||||
|
:options="timeOptions.filter(o => o.value !== null)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Nodes Offline Age"
|
||||||
|
helpText="Nodes not updated within this time appear red. Reload to update map."
|
||||||
|
v-model="configStore.nodesOfflineAge"
|
||||||
|
:options="[
|
||||||
|
{ value: null, label: `Don't show as offline` },
|
||||||
|
...timeOptions.filter(o => o.value !== null)
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Waypoints Max Age"
|
||||||
|
helpText="Old waypoints are hidden. Reload to update map."
|
||||||
|
v-model="configStore.waypointsMaxAge"
|
||||||
|
:options="timeOptions"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Neighbours Max Distance (meters)"
|
||||||
|
helpText="Hides neighbours further than this distance."
|
||||||
|
v-model="configStore.neighboursMaxDistance"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Zoom Level (go to node)"
|
||||||
|
helpText="How far to zoom map when navigating to a node."
|
||||||
|
v-model="configStore.goToNodeZoomLevel"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Temperature Format"
|
||||||
|
helpText="Display temperatures in this format."
|
||||||
|
v-model="configStore.temperatureFormat"
|
||||||
|
:options="[
|
||||||
|
{ value: 'celsius', label: 'Celsius (ºC)' },
|
||||||
|
{ value: 'fahrenheit', label: 'Fahrenheit (ºF)' }
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Auto Update Position in URL"
|
||||||
|
helpText="Sets lat/lng/zoom as query parameters."
|
||||||
|
v-model="configStore.autoUpdatePositionInUrl"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SettingField
|
||||||
|
label="Enable Map Animations"
|
||||||
|
helpText="Map will animate flying to nodes."
|
||||||
|
v-model="configStore.enableMapAnimations"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
55
webapp/frontend/src/components/Settings/Field.vue
Normal file
55
webapp/frontend/src/components/Settings/Field.vue
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
label: String,
|
||||||
|
helpText: String,
|
||||||
|
modelValue: [String, Number, Boolean, null],
|
||||||
|
options: Array,
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: 'select', // "select", "number", or "checkbox"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
defineEmits(['update:modelValue']);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="p-2">
|
||||||
|
<label class="block text-sm font-medium text-gray-900">{{ label }}</label>
|
||||||
|
<div class="text-xs text-gray-600 mb-2">{{ helpText }}</div>
|
||||||
|
|
||||||
|
<template v-if="type === 'select'">
|
||||||
|
<select
|
||||||
|
:value="modelValue === null ? 'null' : modelValue"
|
||||||
|
@change="$emit('update:modelValue', $event.target.value === 'null' ? null : Number($event.target.value))"
|
||||||
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||||
|
>
|
||||||
|
<option v-for="opt in options" :key="opt.value" :value="opt.value === null ? 'null' : opt.value">
|
||||||
|
{{ opt.label }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'number'">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="modelValue"
|
||||||
|
@input="$emit('update:modelValue', $event.target.valueAsNumber)"
|
||||||
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'checkbox'">
|
||||||
|
<div class="flex items-start">
|
||||||
|
<div class="flex items-center h-5">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
:checked="modelValue"
|
||||||
|
@change="$emit('update:modelValue', $event.target.checked)"
|
||||||
|
class="w-4 h-4 border border-gray-300 rounded-sm bg-gray-50 focus:ring-3 focus:ring-blue-300"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<label class="ml-2 text-sm font-medium text-gray-900">{{ label }}</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
28
webapp/frontend/src/components/Traceroute/NodeEntry.vue
Normal file
28
webapp/frontend/src/components/Traceroute/NodeEntry.vue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
node: Object,
|
||||||
|
description: String,
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['goTo']);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<li @click.prevent="$emit('goTo', node.node_id)" :key="node.node_id" class="relative flex gap-x-4" role="button" tabindex="0">
|
||||||
|
<div class="absolute left-0 top-0 flex w-12 justify-center top-3 -bottom-3">
|
||||||
|
<div class="w-px bg-gray-200"></div>
|
||||||
|
</div>
|
||||||
|
<div class="my-auto relative flex flex-none items-center justify-center">
|
||||||
|
<div>
|
||||||
|
<div class="flex rounded-full h-12 w-12 text-white shadow-sm"
|
||||||
|
:style="{backgroundColor: node.backgroundColor, color: node.textColor}">
|
||||||
|
<div class="mx-auto my-auto drop-shadow-sm">{{ node.short_name ?? '?' }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex-auto py-0.5 text-sm leading-5 text-gray-500">
|
||||||
|
<div class="font-medium text-gray-900">{{ node.long_name || '???' }}</div>
|
||||||
|
<div>Hex ID: !{{ Number(node.node_id).toString(16) }}</div>
|
||||||
|
<div>{{ description }}</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
@ -1,8 +1,22 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const emit = defineEmits(['goTo']);
|
const emit = defineEmits(['goTo', 'dismiss']);
|
||||||
|
const props = defineProps(['data']);
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { state } from '../store.js';
|
import { computed } from 'vue';
|
||||||
import { getNodeColor, getNodeTextColor, findNodeById, findNodeMarkerById } from '../utils.js';
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
|
import NodeEntry from '@/components/Traceroute/NodeEntry.vue';
|
||||||
|
const mapData = useMapStore();
|
||||||
|
// selected node IDs
|
||||||
|
const toNode = computed(() => mapData.findNodeById(props.data.to));
|
||||||
|
const fromNode = computed(() => mapData.findNodeById(props.data.from));
|
||||||
|
const gatewayNode = computed(() => mapData.findNodeById(props.data.gateway_id));
|
||||||
|
// pre-resolve the route nodes into an array
|
||||||
|
const routeNodes = computed(() =>
|
||||||
|
props.data.route?.map(id => ({
|
||||||
|
id,
|
||||||
|
node: mapData.findNodeById(id),
|
||||||
|
})) ?? []
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
<div class="relative z-sidebar" role="dialog" aria-modal="true">
|
||||||
@ -15,7 +29,7 @@ import { getNodeColor, getNodeTextColor, findNodeById, findNodeMarkerById } from
|
|||||||
leave-active-class="transition-opacity duration-300 ease-linear"
|
leave-active-class="transition-opacity duration-300 ease-linear"
|
||||||
leave-from-class="opacity-100"
|
leave-from-class="opacity-100"
|
||||||
leave-to-class="opacity-0">
|
leave-to-class="opacity-0">
|
||||||
<div v-show="state.selectedTraceRoute != null" @click="state.selectedTraceRoute = null" class="fixed inset-0 bg-gray-900/75"></div>
|
<div v-show="props.data != null" @click="$emit('dismiss')" class="fixed inset-0 bg-gray-900/75"></div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<!-- sidebar -->
|
<!-- sidebar -->
|
||||||
@ -26,19 +40,19 @@ import { getNodeColor, getNodeTextColor, findNodeById, findNodeMarkerById } from
|
|||||||
leave-active-class="transition duration-300 ease-in-out transform"
|
leave-active-class="transition duration-300 ease-in-out transform"
|
||||||
leave-from-class="translate-x-0"
|
leave-from-class="translate-x-0"
|
||||||
leave-to-class="-translate-x-full">
|
leave-to-class="-translate-x-full">
|
||||||
<div v-show="state.selectedTraceRoute != null" class="fixed top-0 left-0 bottom-0">
|
<div v-show="props.data != null" class="fixed top-0 left-0 bottom-0">
|
||||||
<div v-if="state.selectedTraceRoute != null" class="w-screen h-full max-w-md overflow-hidden">
|
<div v-if="props.data != null" class="w-screen h-full max-w-md overflow-hidden">
|
||||||
<div class="flex h-full flex-col bg-white shadow-xl">
|
<div class="flex h-full flex-col bg-white shadow-xl">
|
||||||
|
|
||||||
<!-- slideover header -->
|
<!-- slideover header -->
|
||||||
<div class="p-2 border-b border-gray-200 shadow-sm">
|
<div class="p-2 border-b border-gray-200 shadow-sm">
|
||||||
<div class="flex items-start justify-between">
|
<div class="flex items-start justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="font-bold">Traceroute #{{ state.selectedTraceRoute.id }}</h2>
|
<h2 class="font-bold">Traceroute #{{ props.data.id }}</h2>
|
||||||
<h3 class="text-sm">{{ moment(new Date(state.selectedTraceRoute.updated_at)).fromNow() }} - {{ state.selectedTraceRoute.route.length }} hops {{ state.selectedTraceRoute.channel_id ? `on ${state.selectedTraceRoute.channel_id}` : '' }}</h3>
|
<h3 class="text-sm">{{ moment(new Date(props.data.updated_at)).fromNow() }} - {{ props.data.route.length }} hops {{ props.data.channel_id ? `on ${props.data.channel_id}` : '' }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-auto ml-3 flex h-7 items-center">
|
<div class="my-auto ml-3 flex h-7 items-center">
|
||||||
<a href="javascript:void(0)" class="rounded-full" @click="state.selectedTraceRoute = null">
|
<a href="javascript:void(0)" class="rounded-full" @click="$emit('dismiss')">
|
||||||
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
<div class="bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
||||||
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
@ -52,95 +66,24 @@ import { getNodeColor, getNodeTextColor, findNodeById, findNodeMarkerById } from
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="overflow-y-auto">
|
<div class="overflow-y-auto">
|
||||||
|
|
||||||
<!-- details -->
|
<!-- details -->
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<ul role="list" class="space-y-3">
|
<ul role="list" class="space-y-3">
|
||||||
|
|
||||||
<!-- node that initiated traceroute -->
|
<!-- node that initiated traceroute -->
|
||||||
<li @click="$emit('goTo', state.selectedTraceRoute.to)" class="relative flex gap-x-4">
|
<NodeEntry :node="toNode" description="Started the traceroute" @go-to="$emit('goTo', toNode.node_id)"/>
|
||||||
<div class="absolute left-0 top-0 flex w-12 justify-center top-3 -bottom-3">
|
|
||||||
<div class="w-px bg-gray-200"></div>
|
|
||||||
</div>
|
|
||||||
<div class="my-auto relative flex flex-none items-center justify-center">
|
|
||||||
<div>
|
|
||||||
<div class="flex rounded-full h-12 w-12 text-white shadow-sm" :class="[ `bg-[${getNodeColor(state.selectedTraceRoute.to)}]`, `text-[${getNodeTextColor(state.selectedTraceRoute.to)}]` ]">
|
|
||||||
<div class="mx-auto my-auto drop-shadow-sm">{{ findNodeById(state.selectedTraceRoute.to)?.short_name ?? "?" }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex-auto py-0.5 text-sm leading-5 text-gray-500">
|
|
||||||
<div class="font-medium text-gray-900">{{ findNodeById(state.selectedTraceRoute.to)?.long_name || '???' }}</div>
|
|
||||||
<div>Hex ID: !{{ Number(state.selectedTraceRoute.to).toString(16) }}</div>
|
|
||||||
<div>Started the traceroute</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- middleman nodes -->
|
<!-- middleman nodes -->
|
||||||
<li @click="$emit('goTo', route)" v-for="route of state.selectedTraceRoute.route" class="relative flex gap-x-4">
|
<NodeEntry v-for="{ id, node } in routeNodes" :key="id" :node="node" description="Forwarded the packet" @go-to="$emit('goTo', id)"/>
|
||||||
<div class="absolute left-0 top-0 flex w-12 justify-center -bottom-3">
|
|
||||||
<div class="w-px bg-gray-200"></div>
|
|
||||||
</div>
|
|
||||||
<div class="my-auto relative flex flex-none items-center justify-center">
|
|
||||||
<div>
|
|
||||||
<div class="flex rounded-full h-12 w-12 text-white shadow" :class="[ `bg-[${getNodeColor(route)}]`, `text-[${getNodeTextColor(route)}]` ]">
|
|
||||||
<div class="mx-auto my-auto drop-shadow-sm">{{ findNodeById(route)?.short_name ?? "?" }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex-auto py-0.5 text-sm leading-5 text-gray-500">
|
|
||||||
<div class="font-medium text-gray-900">{{ findNodeById(route)?.long_name || '???' }}</div>
|
|
||||||
<div>Hex ID: !{{ Number(route).toString(16) }}</div>
|
|
||||||
<div>Forwarded the packet</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- node that replied to traceroute -->
|
<!-- node that replied to traceroute -->
|
||||||
<li @click="$emit('goTo', state.selectedTraceRoute.from)" v-if="state.selectedTraceRoute.from" class="relative flex gap-x-4">
|
<NodeEntry v-if="fromNode" :node="fromNode" description="Replied to traceroute" @go-to="$emit('goTo', fromNode.node_id)"/>
|
||||||
<div class="absolute left-0 top-0 flex w-12 justify-center -bottom-3">
|
|
||||||
<div class="w-px bg-gray-200"></div>
|
|
||||||
</div>
|
|
||||||
<div class="my-auto relative flex flex-none items-center justify-center">
|
|
||||||
<div>
|
|
||||||
<div class="flex rounded-full h-12 w-12 text-white shadow" :class="[ `bg-[${getNodeColor(state.selectedTraceRoute.from)}]`, `text-[${getNodeTextColor(state.selectedTraceRoute.from)}]` ]">
|
|
||||||
<div class="mx-auto my-auto drop-shadow-sm">{{ findNodeById(state.selectedTraceRoute.from)?.short_name ?? "?" }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex-auto py-0.5 text-sm leading-5 text-gray-500">
|
|
||||||
<div class="font-medium text-gray-900">{{ findNodeById(state.selectedTraceRoute.from)?.long_name || '???' }}</div>
|
|
||||||
<div>Hex ID: !{{ Number(state.selectedTraceRoute.from).toString(16) }}</div>
|
|
||||||
<div>Replied to traceroute</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- node that gated traceroute to mqtt -->
|
<!-- node that gated traceroute to mqtt -->
|
||||||
<li @click="$emit('goTo', state.selectedTraceRoute.gateway_id)" v-if="state.selectedTraceRoute.gateway_id" class="relative flex gap-x-4">
|
<NodeEntry v-if="gatewayNode" :node="gatewayNode" description="Gated the packet to MQTT" @go-to="$emit('goTo', gatewayNode.node_id)" />
|
||||||
<div class="absolute left-0 top-0 flex w-12 justify-center h-6">
|
|
||||||
<div class="w-px bg-gray-200"></div>
|
|
||||||
</div>
|
|
||||||
<div class="my-auto relative flex flex-none items-center justify-center">
|
|
||||||
<div>
|
|
||||||
<div class="flex rounded-full h-12 w-12 text-white shadow" :class="[ `bg-[${getNodeColor(state.selectedTraceRoute.gateway_id)}]`, `text-[${getNodeTextColor(state.selectedTraceRoute.gateway_id)}]` ]">
|
|
||||||
<div class="mx-auto my-auto drop-shadow-sm">{{ findNodeById(state.selectedTraceRoute.gateway_id)?.short_name ?? "?" }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex-auto py-0.5 text-sm leading-5 text-gray-500">
|
|
||||||
<div class="font-medium text-gray-900">{{ findNodeById(state.selectedTraceRoute.gateway_id)?.long_name || '???' }}</div>
|
|
||||||
<div>Hex ID: !{{ Number(state.selectedTraceRoute.gateway_id).toString(16) }}</div>
|
|
||||||
<div>Gated the packet to MQTT</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="bg-gray-200 p-2 font-semibold">Raw Data</div>
|
<div class="bg-gray-200 p-2 font-semibold">Raw Data</div>
|
||||||
<div class="text-sm text-gray-700">
|
<div class="text-sm text-gray-700">
|
||||||
<pre class="bg-gray-100 rounded-sm p-2 overflow-x-auto">{{ JSON.stringify(state.selectedTraceRoute, null, 4) }}</pre>
|
<pre class="bg-gray-100 rounded-sm p-2 overflow-x-auto">{{ JSON.stringify(props.data, null, 4) }}</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
118
webapp/frontend/src/composables/useNodeProcessor.js
Normal file
118
webapp/frontend/src/composables/useNodeProcessor.js
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { useConfigStore } from '@/stores/configStore';
|
||||||
|
import { icons } from '@/map';
|
||||||
|
import { hasNodeUplinkedToMqttRecently, isValidCoordinates } from '@/utils';
|
||||||
|
|
||||||
|
export function useNodeProcessor() {
|
||||||
|
const mapStore = useMapStore();
|
||||||
|
const config = useConfigStore();
|
||||||
|
|
||||||
|
// This function processes new node data
|
||||||
|
const processNewNodes = (newNodes) => {
|
||||||
|
const now = moment();
|
||||||
|
const processedNodes = [];
|
||||||
|
const processedMarkers = {};
|
||||||
|
|
||||||
|
for (const node of newNodes) {
|
||||||
|
// Skip nodes older than configured node max age
|
||||||
|
if (config.nodesMaxAge !== null) {
|
||||||
|
const lastUpdatedAgeInMillis = now.diff(moment(node.updated_at));
|
||||||
|
if (lastUpdatedAgeInMillis > config.nodesMaxAge * 1000) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute background/text colors beforehand
|
||||||
|
node.backgroundColor = getNodeColor(node.node_id) || '#888'; // Default to '#888' if undefined
|
||||||
|
node.textColor = getNodeTextColor(node.node_id) || '#FFFFFF'; // Default to white if undefined
|
||||||
|
|
||||||
|
// Add node to the processed list regardless of its position
|
||||||
|
processedNodes.push(node);
|
||||||
|
|
||||||
|
// Skip nodes with invalid or missing position
|
||||||
|
if (!node.latitude || !node.longitude || isNaN(node.latitude) || isNaN(node.longitude)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix latitude and longitude
|
||||||
|
node.latitude = node.latitude / 10000000;
|
||||||
|
node.longitude = node.longitude / 10000000;
|
||||||
|
|
||||||
|
// Icon based on MQTT connection state
|
||||||
|
let icon = icons.mqttDisconnected;
|
||||||
|
|
||||||
|
// Use offline icon for nodes older than configured node offline age
|
||||||
|
if (config.nodesOfflineAge !== null) {
|
||||||
|
const lastUpdatedAgeInMillis = now.diff(moment(node.updated_at));
|
||||||
|
if (lastUpdatedAgeInMillis > config.nodesOfflineAge * 1000) {
|
||||||
|
icon = icons.offline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if node has uplinked to MQTT recently
|
||||||
|
if (hasNodeUplinkedToMqttRecently(node)) {
|
||||||
|
icon = icons.mqttDisconnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter invalid coordinates
|
||||||
|
if (!isValidCoordinates(node.latitude, node.longitude)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare marker data
|
||||||
|
const marker = {
|
||||||
|
type: 'Feature',
|
||||||
|
properties: {
|
||||||
|
id: node.node_id,
|
||||||
|
role: node.role_name,
|
||||||
|
layer: 'nodes',
|
||||||
|
color: icon,
|
||||||
|
},
|
||||||
|
geometry: {
|
||||||
|
type: 'Point',
|
||||||
|
coordinates: [node.longitude, node.latitude],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add the marker to the processed markers dictionary (using node_id as the key)
|
||||||
|
processedMarkers[node.node_id] = marker;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return processed data (nodes and markers)
|
||||||
|
return { processedNodes, processedMarkers };
|
||||||
|
};
|
||||||
|
|
||||||
|
// Process new data and store it (bulk processing)
|
||||||
|
const parseNodesResponse = (newNodes) => {
|
||||||
|
const { processedNodes, processedMarkers } = processNewNodes(newNodes);
|
||||||
|
|
||||||
|
// Clear old data and update in bulk
|
||||||
|
mapStore.clearNodes();
|
||||||
|
mapStore.setNodes(processedNodes);
|
||||||
|
mapStore.setNodeMarkers(processedMarkers);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
parseNodesResponse,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// convert node id to a hex colour
|
||||||
|
function getNodeColor(nodeId) {
|
||||||
|
return "#" + (nodeId & 0x00FFFFFF).toString(16).padStart(6, '0');
|
||||||
|
};
|
||||||
|
|
||||||
|
function getNodeTextColor(nodeId) {
|
||||||
|
// extract rgb components
|
||||||
|
const r = (nodeId & 0xFF0000) >> 16;
|
||||||
|
const g = (nodeId & 0x00FF00) >> 8;
|
||||||
|
const b = nodeId & 0x0000FF;
|
||||||
|
|
||||||
|
// calculate brightness
|
||||||
|
const brightness = ((r * 0.299) + (g * 0.587) + (b * 0.114)) / 255;
|
||||||
|
|
||||||
|
// determine text color based on brightness
|
||||||
|
return brightness > 0.5 ? "#000000" : "#FFFFFF";
|
||||||
|
};
|
||||||
51
webapp/frontend/src/composables/useSearchedNodes.js
Normal file
51
webapp/frontend/src/composables/useSearchedNodes.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import { computed, ref, watch } from 'vue';
|
||||||
|
import { useUIStore } from '@/stores/uiStore';
|
||||||
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
|
export const useSearchedNodes = () => {
|
||||||
|
const uiStore = useUIStore();
|
||||||
|
const mapStore = useMapStore();
|
||||||
|
|
||||||
|
const searchText = ref(uiStore.searchText);
|
||||||
|
|
||||||
|
// Use a debounced version of the search text to minimize re-computation
|
||||||
|
const debouncedSearchText = ref(searchText.value);
|
||||||
|
const updateSearchText = debounce((newSearchText) => {
|
||||||
|
debouncedSearchText.value = newSearchText;
|
||||||
|
}, 300); // Adjust debounce time (300ms is just an example)
|
||||||
|
|
||||||
|
// Watch for changes to the search text and apply debouncing
|
||||||
|
watch(() => uiStore.searchText, (newSearchText) => {
|
||||||
|
updateSearchText(newSearchText);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Computed property for searched nodes
|
||||||
|
const searchedNodes = computed(() => {
|
||||||
|
const nodes = mapStore.nodes;
|
||||||
|
const query = debouncedSearchText.value.toLowerCase();
|
||||||
|
|
||||||
|
// Filter nodes based on search query, only once per update
|
||||||
|
const filteredNodes = nodes.filter((node) => {
|
||||||
|
const matchesId = node.node_id?.toLowerCase()?.includes(query);
|
||||||
|
const matchesHexId = node.node_id_hex?.toLowerCase()?.includes(query);
|
||||||
|
const matchesLongName = node.long_name?.toLowerCase()?.includes(query);
|
||||||
|
const matchesShortName = node.short_name?.toLowerCase()?.includes(query);
|
||||||
|
return matchesId || matchesHexId || matchesLongName || matchesShortName;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sort alphabetically by long name
|
||||||
|
const sortedNodes = filteredNodes.sort((nodeA, nodeB) => {
|
||||||
|
const nodeALongName = nodeA.long_name || "";
|
||||||
|
const nodeBLongName = nodeB.long_name || "";
|
||||||
|
return nodeALongName.localeCompare(nodeBLongName);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Only return the first 500 results to avoid UI lag
|
||||||
|
return sortedNodes.slice(0, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
searchedNodes,
|
||||||
|
};
|
||||||
|
};
|
||||||
84
webapp/frontend/src/composables/useWaypointProcessor.js
Normal file
84
webapp/frontend/src/composables/useWaypointProcessor.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import moment from 'moment';
|
||||||
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
|
import { useConfigStore } from '@/stores/configStore';
|
||||||
|
import { isValidCoordinates } from '@/utils';
|
||||||
|
|
||||||
|
export function useWaypointProcessor() {
|
||||||
|
const mapStore = useMapStore();
|
||||||
|
const config = useConfigStore();
|
||||||
|
|
||||||
|
// This function processes new waypoint data
|
||||||
|
const processNewWaypoints = (newWaypoints) => {
|
||||||
|
const now = moment();
|
||||||
|
const processedWaypoints = [];
|
||||||
|
const processedMarkers = [];
|
||||||
|
for (const waypoint of newWaypoints) {
|
||||||
|
// skip waypoints older than configured waypoint max age
|
||||||
|
if (config.waypointsMaxAge !== null) {
|
||||||
|
const lastUpdatedAgeInMillis = now.diff(moment(waypoint.updated_at));
|
||||||
|
if (lastUpdatedAgeInMillis > config.waypointsMaxAge * 1000) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip expired waypoints
|
||||||
|
if (waypoint.expire < Date.now() / 1000) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip waypoints without position
|
||||||
|
if (!waypoint.latitude || !waypoint.longitude) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip nodes with invalid position
|
||||||
|
if (isNaN(waypoint.latitude) || isNaN(waypoint.longitude)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fix lat long
|
||||||
|
waypoint.latitude = waypoint.latitude / 10000000;
|
||||||
|
waypoint.longitude = waypoint.longitude / 10000000;
|
||||||
|
|
||||||
|
// TODO: determine emoji to show as marker icon
|
||||||
|
const emoji = waypoint.icon === 0 ? 128205 : waypoint.icon;
|
||||||
|
const emojiText = String.fromCodePoint(emoji);
|
||||||
|
|
||||||
|
if (!isValidCoordinates(waypoint.latitude, waypoint.longitude)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create waypoint marker
|
||||||
|
const marker = {
|
||||||
|
type: 'Feature',
|
||||||
|
properties: {
|
||||||
|
layer: 'waypoints',
|
||||||
|
},
|
||||||
|
geometry: {
|
||||||
|
type: 'Point',
|
||||||
|
coordinates: [waypoint.longitude, waypoint.latitude]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// add waypoint & marker to cache
|
||||||
|
processedWaypoints.push(waypoint);
|
||||||
|
processedMarkers.push(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return processed data (waypoints and markers)
|
||||||
|
return { processedWaypoints, processedMarkers };
|
||||||
|
};
|
||||||
|
|
||||||
|
// Process new data and store it (bulk processing)
|
||||||
|
const parseWaypointsResponse = (newWaypoints) => {
|
||||||
|
const { processedWaypoints, processedMarkers } = processNewWaypoints(newWaypoints);
|
||||||
|
|
||||||
|
// Clear old data and update in bulk
|
||||||
|
mapStore.clearWaypoints();
|
||||||
|
mapStore.setWaypoints(processedWaypoints);
|
||||||
|
mapStore.setWaypointMarkers(processedMarkers);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
parseWaypointsResponse,
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -1,29 +1,3 @@
|
|||||||
import { useStorage } from '@vueuse/core';
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
export const CURRENT_ANNOUNCEMENT_ID = 1;
|
export const CURRENT_ANNOUNCEMENT_ID = 1;
|
||||||
export const BASE_PATH = '';
|
export const BASE_PATH = 'http://localhost:9090';
|
||||||
|
|
||||||
// string
|
|
||||||
export const temperatureFormat = useStorage('temperature-display', 'fahrenheit');
|
|
||||||
// boolean
|
|
||||||
export const autoUpdatePositionInUrl = useStorage('auto-update-url', true);
|
|
||||||
export const enableMapAnimations = useStorage('map-animations', true);
|
|
||||||
export const hasSeenInfoModal = useStorage('seen-info-modal', false);
|
|
||||||
// time in seconds
|
|
||||||
export const nodesMaxAge = useStorage('nodes-max-age', null);
|
|
||||||
export const nodesDisconnectedAge = useStorage('nodes-max-disconnected-age', 604800);
|
|
||||||
export const nodesOfflineAge = useStorage('nodes-offline-age', null);
|
|
||||||
export const waypointsMaxAge = useStorage('waypoints-max-age', 604800);
|
|
||||||
// number
|
|
||||||
export const goToNodeZoomLevel = useStorage('zoom-to-node', 15);
|
|
||||||
export const lastSeenAnnouncementId = useStorage('last-seen-announcement-id', 1);
|
|
||||||
// distance in meters
|
|
||||||
export const neighboursMaxDistance = useStorage('neighbors-distance', null);
|
|
||||||
// device info ranges
|
|
||||||
export const deviceMetricsTimeRange = useStorage('device-metrics-range', '3d');
|
|
||||||
export const powerMetricsTimeRange = useStorage('power-metrics-range', '3d');
|
|
||||||
export const environmentMetricsTimeRange = useStorage('environment-metrics-range', '3d');
|
|
||||||
// map config
|
|
||||||
export const enabledOverlayLayers = useStorage('enabled-overlay-layers', ['Legend', 'Position History']);
|
|
||||||
export const selectedTileLayerName = useStorage('selected-tile-layer', 'OpenStreetMap');
|
|
||||||
14
webapp/frontend/src/directives/v-click-outside.js
Normal file
14
webapp/frontend/src/directives/v-click-outside.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
export default {
|
||||||
|
mounted(el, binding) {
|
||||||
|
el._clickOutsideHandler = (event) => {
|
||||||
|
if (!(el === event.target || el.contains(event.target))) {
|
||||||
|
binding.value(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('click', el._clickOutsideHandler);
|
||||||
|
},
|
||||||
|
unmounted(el) {
|
||||||
|
document.removeEventListener('click', el._clickOutsideHandler);
|
||||||
|
el._clickOutsideHandler = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
5
webapp/frontend/src/icons/DeviceIcon.vue
Normal file
5
webapp/frontend/src/icons/DeviceIcon.vue
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 1.5H8.25A2.25 2.25 0 0 0 6 3.75v16.5a2.25 2.25 0 0 0 2.25 2.25h7.5A2.25 2.25 0 0 0 18 20.25V3.75a2.25 2.25 0 0 0-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
5
webapp/frontend/src/icons/InfoIcon.vue
Normal file
5
webapp/frontend/src/icons/InfoIcon.vue
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
5
webapp/frontend/src/icons/MobileCloseIcon.vue
Normal file
5
webapp/frontend/src/icons/MobileCloseIcon.vue
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
9
webapp/frontend/src/icons/RandomIcon.vue
Normal file
9
webapp/frontend/src/icons/RandomIcon.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M18 4l3 3l-3 3"></path>
|
||||||
|
<path d="M18 20l3 -3l-3 -3"></path>
|
||||||
|
<path d="M3 7h3a5 5 0 0 1 5 5a5 5 0 0 0 5 5h5"></path>
|
||||||
|
<path d="M21 7h-5a4.978 4.978 0 0 0 -3 1m-4 8a4.984 4.984 0 0 1 -3 1h-3"></path>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
7
webapp/frontend/src/icons/ReloadIcon.vue
Normal file
7
webapp/frontend/src/icons/ReloadIcon.vue
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<template>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747"></path>
|
||||||
|
<path d="M20 4v5h-5"></path>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
7
webapp/frontend/src/icons/SearchIcon.vue
Normal file
7
webapp/frontend/src/icons/SearchIcon.vue
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<template>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"></path>
|
||||||
|
<path d="M21 21l-6 -6"></path>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
6
webapp/frontend/src/icons/SettingsIcon.vue
Normal file
6
webapp/frontend/src/icons/SettingsIcon.vue
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<template>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z" />
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
@ -1,11 +1,19 @@
|
|||||||
import './assets/main.css'
|
import '@/assets/main.css';
|
||||||
|
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue';
|
||||||
import App from './App.vue'
|
import { createPinia } from 'pinia';
|
||||||
import router from './router'
|
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
|
||||||
|
import App from '@/App.vue';
|
||||||
|
import router from '@/router';
|
||||||
|
import vClickOutside from '@/directives/v-click-outside';
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App);
|
||||||
|
|
||||||
app.use(router)
|
const pinia = createPinia();
|
||||||
|
pinia.use(piniaPluginPersistedstate);
|
||||||
|
|
||||||
app.mount('#app')
|
app.directive('click-outside', vClickOutside);
|
||||||
|
app.use(pinia);
|
||||||
|
app.use(router);
|
||||||
|
|
||||||
|
app.mount('#app');
|
||||||
|
|||||||
@ -1,17 +1,7 @@
|
|||||||
import moment from 'moment';
|
|
||||||
import L from 'leaflet/dist/leaflet.js';
|
|
||||||
import 'leaflet.markercluster/dist/leaflet.markercluster.js';
|
|
||||||
import 'leaflet-groupedlayercontrol/dist/leaflet.groupedlayercontrol.min.js';
|
|
||||||
import {
|
|
||||||
escapeString,
|
|
||||||
findNodeById,
|
|
||||||
getRegionFrequencyRange,
|
|
||||||
hasNodeUplinkedToMqttRecently,
|
|
||||||
formatPositionPrecision,
|
|
||||||
getTerrainProfileImage,
|
|
||||||
} from './utils.js';
|
|
||||||
import { state } from './store.js';
|
|
||||||
import { markRaw } from 'vue';
|
import { markRaw } from 'vue';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { hasNodeUplinkedToMqttRecently, getRegionFrequencyRange, escapeString, formatPositionPrecision } from '@/utils';
|
||||||
|
import { useMapStore } from '@/stores/mapStore';
|
||||||
|
|
||||||
// state/config
|
// state/config
|
||||||
let instance = null;
|
let instance = null;
|
||||||
@ -21,74 +11,71 @@ export function setMap(map) {
|
|||||||
export function getMap() {
|
export function getMap() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
export function unsetMap() {
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
export const layerGroups = {
|
export const layerGroups = {
|
||||||
nodes: new L.LayerGroup(),
|
nodes: {},
|
||||||
neighbors: new L.LayerGroup(),
|
neighbors: {},
|
||||||
waypoints: new L.LayerGroup(),
|
waypoints: {},
|
||||||
nodePositionHistory: new L.LayerGroup(),
|
nodePositionHistory: {},
|
||||||
nodeNeighbors: new L.LayerGroup(),
|
nodeNeighbors: {},
|
||||||
nodesRouter: L.markerClusterGroup({
|
nodesRouter: {},
|
||||||
showCoverageOnHover: false,
|
nodesClustered: {},
|
||||||
disableClusteringAtZoom: 10, // zoom level where node clustering is disabled
|
legend: {},
|
||||||
}),
|
none: {},
|
||||||
nodesClustered: L.markerClusterGroup({
|
|
||||||
showCoverageOnHover: false,
|
|
||||||
disableClusteringAtZoom: 10, // zoom level where node clustering is disabled
|
|
||||||
}),
|
|
||||||
legend: new L.LayerGroup(),
|
|
||||||
none: new L.LayerGroup(),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const tileLayers = {
|
|
||||||
"OpenStreetMap": L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
||||||
maxZoom: 22, // increase from 18 to 22
|
|
||||||
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
|
||||||
}),
|
|
||||||
"OpenTopoMap": L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
|
||||||
maxZoom: 17, // open topo map doesn't have tiles closer than this
|
|
||||||
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
||||||
}),
|
|
||||||
"Esri Satellite": L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
|
||||||
maxZoom: 21, // esri doesn't have tiles closer than this
|
|
||||||
attribution: 'Tiles © <a href="https://developers.arcgis.com/documentation/mapping-apis-and-services/deployment/basemap-attribution/">Esri</a> | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>'
|
|
||||||
}),
|
|
||||||
"Google Satellite": L.tileLayer('https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
|
|
||||||
maxZoom: 21,
|
|
||||||
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
|
|
||||||
attribution: 'Tiles © Google | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>'
|
|
||||||
}),
|
|
||||||
"Google Hybrid": L.tileLayer('https://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}', {
|
|
||||||
maxZoom: 21,
|
|
||||||
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
|
|
||||||
attribution: 'Tiles © Google | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>'
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const icons = {
|
|
||||||
mqttConnected: L.divIcon({
|
|
||||||
className: 'icon-mqtt-connected',
|
|
||||||
iconSize: [16, 16], // increase from 12px to 16px to make hover easier
|
|
||||||
}),
|
|
||||||
mqttDisconnected: L.divIcon({
|
|
||||||
className: 'icon-mqtt-disconnected',
|
|
||||||
iconSize: [16, 16], // increase from 12px to 16px to make hover easier
|
|
||||||
}),
|
|
||||||
offline: L.divIcon({
|
|
||||||
className: 'icon-offline',
|
|
||||||
iconSize: [16, 16], // increase from 12px to 16px to make hover easier
|
|
||||||
}),
|
|
||||||
positionHistory: L.divIcon({
|
|
||||||
className: 'icon-position-history',
|
|
||||||
iconSize: [16, 16], // increase from 12px to 16px to make hover easier
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const tileLayers = [
|
||||||
|
{
|
||||||
|
id: 'OpenStreetMap',
|
||||||
|
display: 'Open Street Map',
|
||||||
|
tiles: ['https://tile.openstreetmap.org/{z}/{x}/{y}.png'],
|
||||||
|
sourceExtraParams: {
|
||||||
|
tileSize: 256,
|
||||||
|
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
|
maxzoom: 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'OpenTopoMap',
|
||||||
|
display: 'Open Topo Map',
|
||||||
|
tiles: ['https://tile.opentopomap.org/{z}/{x}/{y}.png'],
|
||||||
|
sourceExtraParams: {
|
||||||
|
tileSize: 256,
|
||||||
|
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>"',
|
||||||
|
maxzoom: 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'esriSatellite',
|
||||||
|
display: 'ESRI Satellite',
|
||||||
|
tiles: ['https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'],
|
||||||
|
sourceExtraParams: {
|
||||||
|
tileSize: 256,
|
||||||
|
attribution: 'Tiles © <a href="https://developers.arcgis.com/documentation/mapping-apis-and-services/deployment/basemap-attribution/">Esri</a> | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
|
maxzoom: 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'googleSatellite',
|
||||||
|
display: 'Google Satellite',
|
||||||
|
tiles: ['https://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}'],
|
||||||
|
sourceExtraParams: {
|
||||||
|
tileSize: 256,
|
||||||
|
attribution: 'Tiles © Google | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
|
maxzoom: 21
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
export const icons = {mqttConnected: '#16a34a', mqttDisconnected: '#2563eb', offline: '#dc2626', positionHistory: '#a855f7'};
|
||||||
// tooltips
|
// tooltips
|
||||||
|
|
||||||
export function getTooltipContentForWaypoint(waypoint) {
|
export function getTooltipContentForWaypoint(waypoint) {
|
||||||
// get from node name
|
// get from node name
|
||||||
var fromNode = findNodeById(waypoint.from);
|
const mapData = useMapStore();
|
||||||
|
var fromNode = mapData.findNodeById(waypoint.from);
|
||||||
|
|
||||||
var tooltip = `<b>${escapeString(waypoint.name)}</b>` +
|
var tooltip = `<b>${escapeString(waypoint.name)}</b>` +
|
||||||
(waypoint.description ? `<br/>${escapeString(waypoint.description)}` : '') +
|
(waypoint.description ? `<br/>${escapeString(waypoint.description)}` : '') +
|
||||||
@ -111,179 +98,48 @@ export function getTooltipContentForWaypoint(waypoint) {
|
|||||||
return tooltip;
|
return tooltip;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getTooltipContentForNode(node) {
|
|
||||||
// determine if node was recently heard uplinking packets to mqtt
|
|
||||||
const nodeHasUplinkedToMqttRecently = hasNodeUplinkedToMqttRecently(node);
|
|
||||||
var mqttStatus = `<span class="text-blue-700">Disconnected</span>`;
|
|
||||||
if(node.mqtt_connection_state_updated_at){
|
|
||||||
var mqttStatusUpdatedAt = moment(new Date(node.mqtt_connection_state_updated_at)).fromNow();
|
|
||||||
if(nodeHasUplinkedToMqttRecently){
|
|
||||||
mqttStatus = `<span><span class="text-green-700">Connected</span> (${mqttStatusUpdatedAt})</span>`;
|
|
||||||
} else {
|
|
||||||
mqttStatus = `<span><span class="text-blue-700">Disconnected</span> (${mqttStatusUpdatedAt})</span>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var loraFrequencyRange = getRegionFrequencyRange(node.region_name);
|
|
||||||
|
|
||||||
var tooltip = `<img class="mb-4 w-40 mx-auto" src="/images/devices/${node.hardware_model_name}.png" onerror="this.classList.add('hidden')"/>` +
|
|
||||||
`<b>${escapeString(node.long_name)}</b>` +
|
|
||||||
`<br/>Short Name: ${escapeString(node.short_name)}` +
|
|
||||||
`<br/>MQTT: ${mqttStatus}` +
|
|
||||||
(node.num_online_local_nodes != null ? `<br/>Local Nodes Online: ${node.num_online_local_nodes}` : '') +
|
|
||||||
(node.position_precision != null && node.position_precision !== 32 ? `<br/>Position Precision: ${formatPositionPrecision(node.position_precision)}` : '') +
|
|
||||||
`<br/><br/>Role: ${node.role_name}` +
|
|
||||||
`<br/>Hardware: ${node.hardware_model_name}` +
|
|
||||||
(node.firmware_version != null ? `<br/>Firmware: ${node.firmware_version}` : '') +
|
|
||||||
(node.region_name != null ? `<br/>LoRa Region: ${node.region_name} (${loraFrequencyRange})` : '') +
|
|
||||||
(node.modem_preset_name != null ? `<br/>Modem Preset: ${node.modem_preset_name}` : '') +
|
|
||||||
(node.has_default_channel != null ? `<br/>Has Default Channel: ${node.has_default_channel ? "Yes" : "No"}` : '');
|
|
||||||
|
|
||||||
if(node.battery_level){
|
|
||||||
if(node.battery_level > 100){
|
|
||||||
tooltip += `<br/>Battery: ${node.battery_level > 100 ? 'Plugged In' : node.battery_level}`;
|
|
||||||
} else {
|
|
||||||
tooltip += `<br/>Battery: ${node.battery_level}%`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(node.voltage){
|
|
||||||
tooltip += `<br/>Voltage: ${Number(node.voltage).toFixed(2)}V`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(node.channel_utilization){
|
|
||||||
tooltip += `<br/>Ch Util: ${Number(node.channel_utilization).toFixed(2)}%`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(node.air_util_tx){
|
|
||||||
tooltip += `<br/>Air Util: ${Number(node.air_util_tx).toFixed(2)}%`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore alt above 42949000 due to https://github.com/meshtastic/firmware/issues/3109
|
|
||||||
if(node.altitude && node.altitude < 42949000){
|
|
||||||
tooltip += `<br/>Altitude: ${node.altitude}m`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bottom info
|
|
||||||
tooltip += `<br/><br/>ID: ${node.node_id}`;
|
|
||||||
tooltip += `<br/>Hex ID: ${node.node_id_hex}`;
|
|
||||||
tooltip += `<br/>Updated: ${moment(new Date(node.updated_at)).fromNow()}`;
|
|
||||||
tooltip += (node.neighbours_updated_at ? `<br/>Neighbours Updated: ${moment(new Date(node.neighbours_updated_at)).fromNow()}` : '');
|
|
||||||
tooltip += (node.position_updated_at ? `<br/>Position Updated: ${moment(new Date(node.position_updated_at)).fromNow()}` : '');
|
|
||||||
|
|
||||||
// show details button
|
|
||||||
tooltip += `<br/><br/><button onclick="showNodeDetails(${node.node_id});" class="border border-gray-300 bg-gray-100 p-1 w-full rounded hover:bg-gray-200 mb-1">Show Full Details</button>`;
|
|
||||||
tooltip += `<br/><button onclick="window.showNodeNeighboursThatHeardUs(${node.node_id});" class="border border-gray-300 bg-gray-100 p-1 w-full rounded hover:bg-gray-200 mb-1">Show Neighbours (Heard Us)</button>`;
|
|
||||||
tooltip += `<br/><button onclick="window.showNodeNeighboursThatWeHeard(${node.node_id});" class="border border-gray-300 bg-gray-100 p-1 w-full rounded hover:bg-gray-200">Show Neighbours (We Heard)</button>`;
|
|
||||||
tooltip += `</div>`;
|
|
||||||
|
|
||||||
return tooltip;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getNeighbourTooltipContent(type, node, neighbourNode, distanceInMeters, snr) {
|
export function getNeighbourTooltipContent(type, node, neighbourNode, distanceInMeters, snr) {
|
||||||
// default to showing distance in meters
|
return '';
|
||||||
let distance = `${distanceInMeters} meters`;
|
|
||||||
|
|
||||||
// scale to distance in kms
|
|
||||||
if (distanceInMeters >= 1000) {
|
|
||||||
const distanceInKilometers = (distanceInMeters / 1000).toFixed(2);
|
|
||||||
distance = `${distanceInKilometers} kilometers`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const terrainImageUrl = type === 'weHeard' ? getTerrainProfileImage(node, neighbourNode) : getTerrainProfileImage(neighbourNode, node);
|
|
||||||
|
|
||||||
const templates = {
|
|
||||||
'weHeard': `<b>[${escapeString(node.short_name)}] ${escapeString(node.long_name)}</b> heard <b>[${escapeString(neighbourNode.short_name)}] ${escapeString(neighbourNode.long_name)}</b>`
|
|
||||||
+ `<br/>SNR: ${snr}dB`
|
|
||||||
+ `<br/>Distance: ${distance}`
|
|
||||||
+ `<br/><br/>ID: ${node.node_id} heard ${neighbourNode.node_id}`
|
|
||||||
+ `<br/>Hex ID: ${node.node_id_hex} heard ${neighbourNode.node_id_hex}`
|
|
||||||
+ (node.neighbours_updated_at ? `<br/>Updated: ${moment(new Date(node.neighbours_updated_at)).fromNow()}` : '')
|
|
||||||
+ `<br/><br/>Terrain images from <a href="http://www.heywhatsthat.com" target="_blank">HeyWhatsThat.com</a>`
|
|
||||||
+ `<br/><a href="${terrainImageUrl}" target="_blank"><img src="${terrainImageUrl}" width="100%"></a>`,
|
|
||||||
'theyHeard': `<b>[${escapeString(neighbourNode.short_name)}] ${escapeString(neighbourNode.long_name)}</b> heard <b>[${escapeString(node.short_name)}] ${escapeString(node.long_name)}</b>`
|
|
||||||
+ `<br/>SNR: ${snr}dB`
|
|
||||||
+ `<br/>Distance: ${distance}`
|
|
||||||
+ `<br/><br/>ID: ${neighbourNode.node_id} heard ${node.node_id}`
|
|
||||||
+ `<br/>Hex ID: ${neighbourNode.node_id_hex} heard ${node.node_id_hex}`
|
|
||||||
+ (neighbourNode.neighbours_updated_at ? `<br/>Updated: ${moment(new Date(neighbourNode.neighbours_updated_at)).fromNow()}` : '')
|
|
||||||
+ `<br/><br/>Terrain images from <a href="http://www.heywhatsthat.com" target="_blank">HeyWhatsThat.com</a>`
|
|
||||||
+ `<br/><a href="${terrainImageUrl}" target="_blank"><img src="${terrainImageUrl}" width="100%"></a>`,
|
|
||||||
}
|
|
||||||
|
|
||||||
return templates[type];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
||||||
export function clearAllNodes() {
|
export function clearAllNodes() {
|
||||||
layerGroups.nodes.clearLayers();
|
|
||||||
layerGroups.nodesClustered.clearLayers();
|
|
||||||
layerGroups.nodesRouter.clearLayers();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function clearAllNeighbors() {
|
export function clearAllNeighbors() {
|
||||||
layerGroups.neighbors.clearLayers();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function clearAllWaypoints() {
|
export function clearAllWaypoints() {
|
||||||
layerGroups.waypoints.clearLayers();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function clearAllPositionHistory() {
|
export function clearAllPositionHistory() {
|
||||||
layerGroups.nodePositionHistory.clearLayers();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function cleanUpPositionHistory() {
|
export function cleanUpPositionHistory() {
|
||||||
// close tooltips and popups
|
|
||||||
closeAllPopups();
|
|
||||||
closeAllTooltips();
|
|
||||||
|
|
||||||
// setup node neighbours layer
|
|
||||||
layerGroups.nodePositionHistory.clearLayers();
|
|
||||||
layerGroups.nodePositionHistory.removeFrom(getMap());
|
|
||||||
layerGroups.nodePositionHistory.addTo(getMap());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function closeAllTooltips() {
|
export function closeAllTooltips() {
|
||||||
getMap().eachLayer(function(layer) {
|
|
||||||
if (layer.options.pane === 'tooltipPane') {
|
|
||||||
layer.removeFrom(getMap());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function closeAllPopups() {
|
export function closeAllPopups() {
|
||||||
getMap().eachLayer(function(layer) {
|
|
||||||
if (layer.options.pane === 'popupPane') {
|
|
||||||
layer.removeFrom(getMap());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function cleanUpNodeNeighbors() {
|
export function cleanUpNodeNeighbors() {
|
||||||
// close tooltips and popups
|
|
||||||
closeAllPopups();
|
|
||||||
closeAllTooltips();
|
|
||||||
// setup node neighbours layer
|
|
||||||
layerGroups.nodeNeighbors.clearLayers();
|
|
||||||
layerGroups.nodeNeighbors.removeFrom(getMap());
|
|
||||||
layerGroups.nodeNeighbors.addTo(getMap());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function clearNodeOutline() {
|
export function clearNodeOutline() {
|
||||||
if (state.selectedNodeOutlineCircle) {
|
getMap().getSource('node-outlines').setData({});
|
||||||
state.selectedNodeOutlineCircle.removeFrom(getMap());
|
|
||||||
state.selectedNodeOutlineCircle = null;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function clearMap() {
|
export function clearMap() {
|
||||||
closeAllPopups();
|
|
||||||
closeAllTooltips();
|
|
||||||
clearAllNodes();
|
|
||||||
clearAllNeighbors();
|
|
||||||
clearAllWaypoints();
|
|
||||||
clearNodeOutline();
|
|
||||||
cleanUpNodeNeighbors();
|
|
||||||
};
|
};
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
import HomeView from '../views/HomeView.vue'
|
import HomeView from '@/views/HomeView.vue'
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
|
|||||||
@ -1,60 +1,19 @@
|
|||||||
import { reactive, computed } from 'vue';
|
import { reactive } from 'vue';
|
||||||
|
|
||||||
export const state = reactive({
|
export const state = reactive({
|
||||||
// caches
|
|
||||||
nodes: [],
|
|
||||||
waypoints: [],
|
|
||||||
nodeMarkers: {},
|
|
||||||
|
|
||||||
// state
|
// state
|
||||||
searchText: '',
|
searchText: '', // moved to ui store, maybe should not be there though?
|
||||||
selectedNodeOutlineCircle: null,
|
selectedNodeOutlineCircle: null,
|
||||||
selectedNodeMqttMetrics: [],
|
|
||||||
selectedNodeTraceroutes: [],
|
// new selected node/data stuff
|
||||||
selectedNodeDeviceMetrics: [],
|
positionHistoryNode: null,
|
||||||
selectedNodePowerMetrics: [],
|
neighborsNode: null,
|
||||||
selectedNodeEnvironmentMetrics: [],
|
traceRouteData: null,
|
||||||
selectedNodeToShowNeighbours: null,
|
|
||||||
selectedNodeToShowNeighbours: null,
|
// new modal specific stuff
|
||||||
selectedNodeToShowNeighboursType: null,
|
neighborsModalType: null,
|
||||||
|
|
||||||
// position history
|
// position history
|
||||||
selectedNodeToShowPositionHistory: null,
|
|
||||||
positionHistoryDateTimeTo: null,
|
positionHistoryDateTimeTo: null,
|
||||||
positionHistoryDateTimeFrom: null,
|
positionHistoryDateTimeFrom: null,
|
||||||
|
|
||||||
// ui
|
|
||||||
loading: false,
|
|
||||||
settingsVisible: false,
|
|
||||||
hardwareStatsVisible: false,
|
|
||||||
infoModalVisible: false,
|
|
||||||
mobileSearchVisible: false,
|
|
||||||
positionHistoryModalExpanded: false,
|
|
||||||
announcementVisible: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const searchedNodes = computed(() => {
|
|
||||||
// search nodes
|
|
||||||
const nodes = state.nodes.filter((node) => {
|
|
||||||
const matchesId = node.node_id?.toLowerCase()?.includes(state.searchText.toLowerCase());
|
|
||||||
const matchesHexId = node.node_id_hex?.toLowerCase()?.includes(state.searchText.toLowerCase());
|
|
||||||
const matchesLongName = node.long_name?.toLowerCase()?.includes(state.searchText.toLowerCase());
|
|
||||||
const matchesShortName = node.short_name?.toLowerCase()?.includes(state.searchText.toLowerCase());
|
|
||||||
return matchesId || matchesHexId || matchesLongName || matchesShortName;
|
|
||||||
});
|
|
||||||
|
|
||||||
// order alphabetically by long name
|
|
||||||
nodes.sort((nodeA, nodeB) => {
|
|
||||||
const nodeALongName = nodeA.long_name || "";
|
|
||||||
const nodeBLongName = nodeB.long_name || "";
|
|
||||||
return nodeALongName.localeCompare(nodeBLongName);
|
|
||||||
});
|
|
||||||
|
|
||||||
// only return the first 500 results to avoid ui lag...
|
|
||||||
return nodes.slice(0, 500);
|
|
||||||
});
|
|
||||||
|
|
||||||
export const selectedNodeLatestPowerMetric = computed(() => {
|
|
||||||
const [ latestPowerMetric ] = state.selectedNodePowerMetrics.slice(-1);
|
|
||||||
return latestPowerMetric;
|
|
||||||
});
|
});
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user