@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.6.55 to 0.6.56
@@ -549,8 +549,25 @@ import { MessageType } from "@protobuf-ts/runtime"; | ||
/** | ||
* | ||
* TODO: REPLACE | ||
* | ||
* @generated from protobuf field: bytes payload = 2; | ||
* @generated from protobuf oneof: payloadVariant | ||
*/ | ||
payload: Uint8Array; | ||
payloadVariant: { | ||
oneofKind: "payload"; | ||
/** | ||
* | ||
* TODO: REPLACE | ||
* | ||
* @generated from protobuf field: bytes payload = 2; | ||
*/ | ||
payload: Uint8Array; | ||
} | { | ||
oneofKind: "payloadCompressed"; | ||
/** | ||
* | ||
* TODO: REPLACE | ||
* | ||
* @generated from protobuf field: bytes payload_compressed = 10; | ||
*/ | ||
payloadCompressed: Uint8Array; | ||
} | { | ||
oneofKind: undefined; | ||
}; | ||
/** | ||
@@ -557,0 +574,0 @@ * |
@@ -857,3 +857,4 @@ // @generated by protobuf-ts 2.4.0 with parameter long_type_string,// @generated from protobuf file "mesh.proto" (syntax proto3),// tslint:disable | ||
{ no: 1, name: "portnum", kind: "enum", T: () => ["PortNum", PortNum] }, | ||
{ no: 2, name: "payload", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, | ||
{ no: 2, name: "payload", kind: "scalar", oneof: "payloadVariant", T: 12 /*ScalarType.BYTES*/ }, | ||
{ no: 10, name: "payload_compressed", kind: "scalar", oneof: "payloadVariant", T: 12 /*ScalarType.BYTES*/ }, | ||
{ no: 3, name: "want_response", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, | ||
@@ -860,0 +861,0 @@ { no: 4, name: "dest", kind: "scalar", T: 7 /*ScalarType.FIXED32*/ }, |
@@ -75,11 +75,2 @@ import { MessageType } from "@protobuf-ts/runtime"; | ||
* | ||
* @generated from protobuf field: uint32 phone_sds_timeout_sec = 7; | ||
*/ | ||
phoneSdsTimeoutSec: number; | ||
/** | ||
* | ||
* Power management state machine option. | ||
* See [power management](/docs/software/other/power) for details. | ||
* 0 for default of two hours, MAXUINT for disabled | ||
* | ||
* @generated from protobuf field: uint32 mesh_sds_timeout_secs = 8; | ||
@@ -86,0 +77,0 @@ */ |
@@ -671,3 +671,2 @@ // @generated by protobuf-ts 2.4.0 with parameter long_type_string,// @generated from protobuf file "radioconfig.proto" (syntax proto3),// tslint:disable | ||
{ no: 6, name: "phone_timeout_secs", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, | ||
{ no: 7, name: "phone_sds_timeout_sec", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, | ||
{ no: 8, name: "mesh_sds_timeout_secs", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, | ||
@@ -674,0 +673,0 @@ { no: 9, name: "sds_secs", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, |
@@ -284,2 +284,3 @@ import { SubEvent } from "sub-events"; | ||
private handleMeshPacket; | ||
private handleDataPacket; | ||
} |
@@ -232,3 +232,6 @@ import { SubEvent } from "sub-events"; | ||
decoded: { | ||
payload: byteData, | ||
payloadVariant: { | ||
oneofKind: "payload", | ||
payload: byteData | ||
}, | ||
portnum: portNum, | ||
@@ -586,113 +589,125 @@ wantResponse, | ||
} | ||
if (meshPacket.payloadVariant.oneofKind === "decoded") { | ||
await this.responseQueue.process(meshPacket.payloadVariant.decoded.requestId); | ||
switch (meshPacket.payloadVariant.decoded.portnum) { | ||
case PortNum.TEXT_MESSAGE_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onTextPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onTextPacket.emit({ | ||
packet: meshPacket, | ||
data: new TextDecoder().decode(meshPacket.payloadVariant.decoded.payload) | ||
}); | ||
break; | ||
case PortNum.REMOTE_HARDWARE_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onRemoteHardwarePacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onRemoteHardwarePacket.emit({ | ||
packet: meshPacket, | ||
data: Protobuf.HardwareMessage.fromBinary(meshPacket.payloadVariant.decoded.payload) | ||
}); | ||
break; | ||
case PortNum.POSITION_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onPositionPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onPositionPacket.emit({ | ||
packet: meshPacket, | ||
data: Position.fromBinary(meshPacket.payloadVariant.decoded.payload) | ||
}); | ||
break; | ||
case PortNum.NODEINFO_APP: | ||
/** | ||
* @todo, workaround for NODEINFO_APP plugin sending a User protobuf instead of a NodeInfo protobuf | ||
*/ | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onUserPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onUserPacket.emit({ | ||
packet: meshPacket, | ||
data: User.fromBinary(meshPacket.payloadVariant.decoded.payload) | ||
}); | ||
break; | ||
case PortNum.ROUTING_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onRoutingPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onRoutingPacket.emit({ | ||
packet: meshPacket, | ||
data: Routing.fromBinary(meshPacket.payloadVariant.decoded.payload) | ||
}); | ||
break; | ||
case PortNum.ADMIN_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onAdminPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onAdminPacket.emit({ | ||
packet: meshPacket, | ||
data: AdminMessage.fromBinary(meshPacket.payloadVariant.decoded.payload) | ||
}); | ||
break; | ||
case PortNum.REPLY_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onPingPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onPingPacket.emit({ | ||
packet: meshPacket, | ||
data: meshPacket.payloadVariant.decoded.payload | ||
}); | ||
break; | ||
case PortNum.IP_TUNNEL_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onIpTunnelPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onIpTunnelPacket.emit({ | ||
packet: meshPacket, | ||
data: meshPacket.payloadVariant.decoded.payload | ||
}); | ||
break; | ||
case PortNum.SERIAL_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onSerialPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onSerialPacket.emit({ | ||
packet: meshPacket, | ||
data: meshPacket.payloadVariant.decoded.payload | ||
}); | ||
break; | ||
case PortNum.STORE_FORWARD_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onStoreForwardPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onStoreForwardPacket.emit({ | ||
packet: meshPacket, | ||
data: meshPacket.payloadVariant.decoded.payload | ||
}); | ||
break; | ||
case PortNum.RANGE_TEST_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onRangeTestPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onRangeTestPacket.emit({ | ||
packet: meshPacket, | ||
data: meshPacket.payloadVariant.decoded.payload | ||
}); | ||
break; | ||
case PortNum.TELEMETRY_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onTelemetryPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onTelemetryPacket.emit({ | ||
packet: meshPacket, | ||
data: Protobuf.Telemetry.fromBinary(meshPacket.payloadVariant.decoded.payload) | ||
}); | ||
break; | ||
case PortNum.PRIVATE_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onPrivatePacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onPrivatePacket.emit({ | ||
packet: meshPacket, | ||
data: meshPacket.payloadVariant.decoded.payload | ||
}); | ||
break; | ||
case PortNum.ATAK_FORWARDER: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onAtakPacket", LogRecord_Level.TRACE, meshPacket.payloadVariant.decoded.payload); | ||
this.onAtakPacket.emit({ | ||
packet: meshPacket, | ||
data: meshPacket.payloadVariant.decoded.payload | ||
}); | ||
break; | ||
default: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, `Unhandled PortNum: ${PortNum[meshPacket.payloadVariant.decoded.portnum] ?? "Unknown"}`, LogRecord_Level.WARNING, meshPacket.payloadVariant.decoded.payload); | ||
break; | ||
} | ||
switch (meshPacket.payloadVariant.oneofKind) { | ||
case "decoded": | ||
await this.responseQueue.process(meshPacket.payloadVariant.decoded.requestId); | ||
this.handleDataPacket(meshPacket.payloadVariant.decoded, meshPacket); | ||
break; | ||
case "encrypted": | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Device received encrypted data packet, ignoring.", LogRecord_Level.DEBUG); | ||
break; | ||
} | ||
else { | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Device received encrypted or empty data packet, ignoring.", LogRecord_Level.DEBUG); | ||
} | ||
handleDataPacket(dataPacket, meshPacket) { | ||
switch (dataPacket.payloadVariant.oneofKind) { | ||
case "payload": | ||
switch (dataPacket.portnum) { | ||
case PortNum.TEXT_MESSAGE_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onTextPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onTextPacket.emit({ | ||
packet: meshPacket, | ||
data: new TextDecoder().decode(dataPacket.payloadVariant.payload) | ||
}); | ||
break; | ||
case PortNum.REMOTE_HARDWARE_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onRemoteHardwarePacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onRemoteHardwarePacket.emit({ | ||
packet: meshPacket, | ||
data: Protobuf.HardwareMessage.fromBinary(dataPacket.payloadVariant.payload) | ||
}); | ||
break; | ||
case PortNum.POSITION_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onPositionPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onPositionPacket.emit({ | ||
packet: meshPacket, | ||
data: Position.fromBinary(dataPacket.payloadVariant.payload) | ||
}); | ||
break; | ||
case PortNum.NODEINFO_APP: | ||
/** | ||
* @todo, workaround for NODEINFO_APP plugin sending a User protobuf instead of a NodeInfo protobuf | ||
*/ | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onUserPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onUserPacket.emit({ | ||
packet: meshPacket, | ||
data: User.fromBinary(dataPacket.payloadVariant.payload) | ||
}); | ||
break; | ||
case PortNum.ROUTING_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onRoutingPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onRoutingPacket.emit({ | ||
packet: meshPacket, | ||
data: Routing.fromBinary(dataPacket.payloadVariant.payload) | ||
}); | ||
break; | ||
case PortNum.ADMIN_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onAdminPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onAdminPacket.emit({ | ||
packet: meshPacket, | ||
data: AdminMessage.fromBinary(dataPacket.payloadVariant.payload) | ||
}); | ||
break; | ||
case PortNum.REPLY_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onPingPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onPingPacket.emit({ | ||
packet: meshPacket, | ||
data: dataPacket.payloadVariant.payload | ||
}); | ||
break; | ||
case PortNum.IP_TUNNEL_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onIpTunnelPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onIpTunnelPacket.emit({ | ||
packet: meshPacket, | ||
data: dataPacket.payloadVariant.payload | ||
}); | ||
break; | ||
case PortNum.SERIAL_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onSerialPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onSerialPacket.emit({ | ||
packet: meshPacket, | ||
data: dataPacket.payloadVariant.payload | ||
}); | ||
break; | ||
case PortNum.STORE_FORWARD_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onStoreForwardPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onStoreForwardPacket.emit({ | ||
packet: meshPacket, | ||
data: dataPacket.payloadVariant.payload | ||
}); | ||
break; | ||
case PortNum.RANGE_TEST_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onRangeTestPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onRangeTestPacket.emit({ | ||
packet: meshPacket, | ||
data: dataPacket.payloadVariant.payload | ||
}); | ||
break; | ||
case PortNum.TELEMETRY_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onTelemetryPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onTelemetryPacket.emit({ | ||
packet: meshPacket, | ||
data: Protobuf.Telemetry.fromBinary(dataPacket.payloadVariant.payload) | ||
}); | ||
break; | ||
case PortNum.PRIVATE_APP: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onPrivatePacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onPrivatePacket.emit({ | ||
packet: meshPacket, | ||
data: dataPacket.payloadVariant.payload | ||
}); | ||
break; | ||
case PortNum.ATAK_FORWARDER: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Received onAtakPacket", LogRecord_Level.TRACE, dataPacket.payloadVariant.payload); | ||
this.onAtakPacket.emit({ | ||
packet: meshPacket, | ||
data: dataPacket.payloadVariant.payload | ||
}); | ||
break; | ||
default: | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, `Unhandled PortNum: ${PortNum[dataPacket.portnum] ?? "Unknown"}`, LogRecord_Level.WARNING, dataPacket.payloadVariant.payload); | ||
break; | ||
} | ||
break; | ||
case "payloadCompressed": | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Device received compressed data packet, ignoring.", LogRecord_Level.DEBUG); | ||
break; | ||
} | ||
@@ -699,0 +714,0 @@ } |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.6.55", | ||
"version": "0.6.56", | ||
"description": "Browser library for interfacing with meshtastic devices", | ||
@@ -27,3 +27,3 @@ "license": "GPL-3.0-only", | ||
"dependencies": { | ||
"@meshtastic/eslint-config": "^1.0.7", | ||
"@meshtastic/eslint-config": "^1.0.8", | ||
"@protobuf-ts/runtime": "^2.4.0", | ||
@@ -38,3 +38,3 @@ "prettier": "^2.6.2", | ||
"node-protoc": "^1.0.3", | ||
"typedoc": "^0.22.14", | ||
"typedoc": "^0.22.15", | ||
"typescript": "^4.6.3" | ||
@@ -41,0 +41,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
454585
9405