@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.7.5 to 0.8.0
@@ -1,5 +0,5 @@ | ||
import { SubEvent } from "sub-events"; | ||
import { Logger } from "tslog"; | ||
import { Protobuf, Types } from "./index.js"; | ||
import { Types } from "./index.js"; | ||
import { clearChannelProps, confirmSetChannelProps, confirmSetConfigProps, factoryResetProps, getChannelProps, getConfigProps, getMetadataProps, getModuleConfigProps, getOwnerProps, handleFromRadioProps, rebootOTAProps, rebootProps, resetPeersProps, sendPacketProps, sendRawProps, sendTextProps, setChannelProps, setConfigProps, setModuleConfigProps, setOwnerProps, setPositionProps, shutdownProps, updateDeviceStatusProps } from "./types.js"; | ||
import { EventSystem } from "./utils/eventSystem.js"; | ||
import { Queue } from "./utils/queue.js"; | ||
@@ -27,2 +27,3 @@ /** Base class for connection methods to extend */ | ||
queue: Queue; | ||
events: EventSystem; | ||
constructor(configId?: number); | ||
@@ -38,187 +39,2 @@ /** Abstract method that writes data to the radio */ | ||
/** | ||
* Fires when a new FromRadio message has been received from the device | ||
* | ||
* @event onLogEvent | ||
*/ | ||
readonly onLogEvent: SubEvent<Types.LogEventPacket>; | ||
/** | ||
* Fires when a new FromRadio message has been received from the device | ||
* | ||
* @event onFromRadio | ||
*/ | ||
readonly onFromRadio: SubEvent<Protobuf.FromRadio>; | ||
/** | ||
* Fires when a new FromRadio message containing a Data packet has been | ||
* received from the device | ||
* | ||
* @event onMeshPacket | ||
*/ | ||
readonly onMeshPacket: SubEvent<Protobuf.MeshPacket>; | ||
/** | ||
* Fires when a new MyNodeInfo message has been received from the device | ||
* | ||
* @event onMyNodeInfo | ||
*/ | ||
readonly onMyNodeInfo: SubEvent<Protobuf.MyNodeInfo>; | ||
/** | ||
* Fires when a new MeshPacket message containing a NodeInfo packet has been | ||
* received from device | ||
* | ||
* @event onNodeInfoPacket | ||
*/ | ||
readonly onNodeInfoPacket: SubEvent<Types.NodeInfoPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a User packet has been | ||
* received from device | ||
* | ||
* @event onUserPacket | ||
*/ | ||
readonly onUserPacket: SubEvent<Types.UserPacket>; | ||
/** | ||
* Fires when a new Channel message is recieved | ||
* | ||
* @event onChannelPacket | ||
*/ | ||
readonly onChannelPacket: SubEvent<Types.ChannelPacket>; | ||
/** | ||
* Fires when a new Config message is recieved | ||
* | ||
* @event onConfigPacket | ||
*/ | ||
readonly onConfigPacket: SubEvent<Types.ConfigPacket>; | ||
/** | ||
* Fires when a new ModuleConfig message is recieved | ||
* | ||
* @event onModuleConfigPacket | ||
*/ | ||
readonly onModuleConfigPacket: SubEvent<Types.ModuleConfigPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Ping packet has been | ||
* received from device | ||
* | ||
* @event onPingPacket | ||
*/ | ||
readonly onPingPacket: SubEvent<Types.PingPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a IP Tunnel packet has been | ||
* received from device | ||
* | ||
* @event onIpTunnelPacket | ||
*/ | ||
readonly onIpTunnelPacket: SubEvent<Types.IpTunnelPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Serial packet has been | ||
* received from device | ||
* | ||
* @event onSerialPacket | ||
*/ | ||
readonly onSerialPacket: SubEvent<Types.SerialPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Store and Forward packet | ||
* has been received from device | ||
* | ||
* @event onStoreForwardPacket | ||
*/ | ||
readonly onStoreForwardPacket: SubEvent<Types.StoreForwardPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Store and Forward packet | ||
* has been received from device | ||
* | ||
* @event onRangeTestPacket | ||
*/ | ||
readonly onRangeTestPacket: SubEvent<Types.RangeTestPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Telemetry packet has been | ||
* received from device | ||
* | ||
* @event onTelemetryPacket | ||
*/ | ||
readonly onTelemetryPacket: SubEvent<Types.TelemetryPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Private packet has been | ||
* received from device | ||
* | ||
* @event onPrivatePacket | ||
*/ | ||
readonly onPrivatePacket: SubEvent<Types.PrivatePacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a ATAK packet has been | ||
* received from device | ||
* | ||
* @event onAtakPacket | ||
*/ | ||
readonly onAtakPacket: SubEvent<Types.AtakPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Routing packet has been | ||
* received from device | ||
* | ||
* @event onRoutingPacket | ||
*/ | ||
readonly onRoutingPacket: SubEvent<Types.RoutingPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Position packet has been | ||
* received from device | ||
* | ||
* @event onPositionPacket | ||
*/ | ||
readonly onPositionPacket: SubEvent<Types.PositionPacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Text packet has been | ||
* received from device | ||
* | ||
* @event onMessagePacket | ||
*/ | ||
readonly onMessagePacket: SubEvent<Types.MessagePacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Remote Hardware packet has | ||
* been received from device | ||
* | ||
* @event onRemoteHardwarePacket | ||
*/ | ||
readonly onRemoteHardwarePacket: SubEvent<Types.RemoteHardwarePacket>; | ||
/** | ||
* Fires when a new MeshPacket message containing a Waypoint packet has been | ||
* received from device | ||
* | ||
* @event onWaypointPacket | ||
*/ | ||
readonly onWaypointPacket: SubEvent<Types.WaypointPacket>; | ||
/** | ||
* Fires when the devices connection or configuration status changes | ||
* | ||
* @event onDeviceStatus | ||
*/ | ||
readonly onDeviceStatus: SubEvent<Types.DeviceStatusEnum>; | ||
/** | ||
* Fires when a new FromRadio message containing a LogRecord packet has been | ||
* received from device | ||
* | ||
* @event onLogRecord | ||
*/ | ||
readonly onLogRecord: SubEvent<Protobuf.LogRecord>; | ||
/** | ||
* Fires when the device receives a meshPacket, returns a timestamp | ||
* | ||
* @event onMeshHeartbeat | ||
*/ | ||
readonly onMeshHeartbeat: SubEvent<Date>; | ||
/** | ||
* Outputs any debug log data (currently serial connections only) | ||
* | ||
* @event onDeviceDebugLog | ||
*/ | ||
readonly onDeviceDebugLog: SubEvent<Uint8Array>; | ||
/** | ||
* Fires when the device receives a Metadata packet | ||
* | ||
* @event onDeviceMetadataPacket | ||
*/ | ||
readonly onDeviceMetadataPacket: SubEvent<Types.DeviceMetadataPacket>; | ||
/** | ||
* Outputs status of pending settings changes | ||
* | ||
* @event pendingSettingsChange | ||
*/ | ||
readonly onPendingSettingsChange: SubEvent<boolean>; | ||
/** | ||
* Sends a text over the radio | ||
@@ -225,0 +41,0 @@ * |
@@ -1,5 +0,5 @@ | ||
import { SubEvent } from "sub-events"; | ||
import { Logger } from "tslog"; | ||
import { broadCastNum, minFwVer } from "./constants.js"; | ||
import { Protobuf, Types } from "./index.js"; | ||
import { EventSystem } from "./utils/eventSystem.js"; | ||
import { Queue } from "./utils/queue.js"; | ||
@@ -25,2 +25,3 @@ /** Base class for connection methods to extend */ | ||
queue; | ||
events; | ||
constructor(configId) { | ||
@@ -34,3 +35,4 @@ this.log = new Logger({ name: "iMeshDevice" }); | ||
this.queue = new Queue(); | ||
this.onDeviceStatus.subscribe((status) => { | ||
this.events = new EventSystem(); | ||
this.events.onDeviceStatus.subscribe((status) => { | ||
this.deviceStatus = status; | ||
@@ -42,6 +44,6 @@ if (status === Types.DeviceStatusEnum.DEVICE_CONFIGURED) | ||
}); | ||
this.onMyNodeInfo.subscribe((myNodeInfo) => { | ||
this.events.onMyNodeInfo.subscribe((myNodeInfo) => { | ||
this.myNodeInfo = myNodeInfo; | ||
}); | ||
this.onPendingSettingsChange.subscribe((state) => { | ||
this.events.onPendingSettingsChange.subscribe((state) => { | ||
this.pendingSettingsChanges = state; | ||
@@ -51,187 +53,2 @@ }); | ||
/** | ||
* Fires when a new FromRadio message has been received from the device | ||
* | ||
* @event onLogEvent | ||
*/ | ||
onLogEvent = new SubEvent(); | ||
/** | ||
* Fires when a new FromRadio message has been received from the device | ||
* | ||
* @event onFromRadio | ||
*/ | ||
onFromRadio = new SubEvent(); | ||
/** | ||
* Fires when a new FromRadio message containing a Data packet has been | ||
* received from the device | ||
* | ||
* @event onMeshPacket | ||
*/ | ||
onMeshPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MyNodeInfo message has been received from the device | ||
* | ||
* @event onMyNodeInfo | ||
*/ | ||
onMyNodeInfo = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a NodeInfo packet has been | ||
* received from device | ||
* | ||
* @event onNodeInfoPacket | ||
*/ | ||
onNodeInfoPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a User packet has been | ||
* received from device | ||
* | ||
* @event onUserPacket | ||
*/ | ||
onUserPacket = new SubEvent(); | ||
/** | ||
* Fires when a new Channel message is recieved | ||
* | ||
* @event onChannelPacket | ||
*/ | ||
onChannelPacket = new SubEvent(); | ||
/** | ||
* Fires when a new Config message is recieved | ||
* | ||
* @event onConfigPacket | ||
*/ | ||
onConfigPacket = new SubEvent(); | ||
/** | ||
* Fires when a new ModuleConfig message is recieved | ||
* | ||
* @event onModuleConfigPacket | ||
*/ | ||
onModuleConfigPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Ping packet has been | ||
* received from device | ||
* | ||
* @event onPingPacket | ||
*/ | ||
onPingPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a IP Tunnel packet has been | ||
* received from device | ||
* | ||
* @event onIpTunnelPacket | ||
*/ | ||
onIpTunnelPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Serial packet has been | ||
* received from device | ||
* | ||
* @event onSerialPacket | ||
*/ | ||
onSerialPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Store and Forward packet | ||
* has been received from device | ||
* | ||
* @event onStoreForwardPacket | ||
*/ | ||
onStoreForwardPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Store and Forward packet | ||
* has been received from device | ||
* | ||
* @event onRangeTestPacket | ||
*/ | ||
onRangeTestPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Telemetry packet has been | ||
* received from device | ||
* | ||
* @event onTelemetryPacket | ||
*/ | ||
onTelemetryPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Private packet has been | ||
* received from device | ||
* | ||
* @event onPrivatePacket | ||
*/ | ||
onPrivatePacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a ATAK packet has been | ||
* received from device | ||
* | ||
* @event onAtakPacket | ||
*/ | ||
onAtakPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Routing packet has been | ||
* received from device | ||
* | ||
* @event onRoutingPacket | ||
*/ | ||
onRoutingPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Position packet has been | ||
* received from device | ||
* | ||
* @event onPositionPacket | ||
*/ | ||
onPositionPacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Text packet has been | ||
* received from device | ||
* | ||
* @event onMessagePacket | ||
*/ | ||
onMessagePacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Remote Hardware packet has | ||
* been received from device | ||
* | ||
* @event onRemoteHardwarePacket | ||
*/ | ||
onRemoteHardwarePacket = new SubEvent(); | ||
/** | ||
* Fires when a new MeshPacket message containing a Waypoint packet has been | ||
* received from device | ||
* | ||
* @event onWaypointPacket | ||
*/ | ||
onWaypointPacket = new SubEvent(); | ||
/** | ||
* Fires when the devices connection or configuration status changes | ||
* | ||
* @event onDeviceStatus | ||
*/ | ||
onDeviceStatus = new SubEvent(); | ||
/** | ||
* Fires when a new FromRadio message containing a LogRecord packet has been | ||
* received from device | ||
* | ||
* @event onLogRecord | ||
*/ | ||
onLogRecord = new SubEvent(); | ||
/** | ||
* Fires when the device receives a meshPacket, returns a timestamp | ||
* | ||
* @event onMeshHeartbeat | ||
*/ | ||
onMeshHeartbeat = new SubEvent(); | ||
/** | ||
* Outputs any debug log data (currently serial connections only) | ||
* | ||
* @event onDeviceDebugLog | ||
*/ | ||
onDeviceDebugLog = new SubEvent(); | ||
/** | ||
* Fires when the device receives a Metadata packet | ||
* | ||
* @event onDeviceMetadataPacket | ||
*/ | ||
onDeviceMetadataPacket = new SubEvent(); | ||
/** | ||
* Outputs status of pending settings changes | ||
* | ||
* @event pendingSettingsChange | ||
*/ | ||
onPendingSettingsChange = new SubEvent(); | ||
/** | ||
* Sends a text over the radio | ||
@@ -718,3 +535,3 @@ * | ||
async beginEditSettings() { | ||
this.onPendingSettingsChange.emit(true); | ||
this.events.onPendingSettingsChange.emit(true); | ||
const beginEditSettings = Protobuf.AdminMessage.toBinary({ | ||
@@ -744,3 +561,3 @@ payloadVariant: { | ||
}); | ||
this.onPendingSettingsChange.emit(false); | ||
this.events.onPendingSettingsChange.emit(false); | ||
} | ||
@@ -925,3 +742,3 @@ /** | ||
if (status !== this.deviceStatus) { | ||
this.onDeviceStatus.emit(status); | ||
this.events.onDeviceStatus.emit(status); | ||
} | ||
@@ -945,3 +762,3 @@ } | ||
const decodedMessage = Protobuf.FromRadio.fromBinary(fromRadio); | ||
this.onFromRadio.emit(decodedMessage); | ||
this.events.onFromRadio.emit(decodedMessage); | ||
/** @todo Add map here when `all=true` gets fixed. */ | ||
@@ -957,3 +774,3 @@ switch (decodedMessage.payloadVariant.oneofKind) { | ||
} | ||
this.onMyNodeInfo.emit(decodedMessage.payloadVariant.myInfo); | ||
this.events.onMyNodeInfo.emit(decodedMessage.payloadVariant.myInfo); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], "📱 Received Node info for this device"); | ||
@@ -963,3 +780,3 @@ break; | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], `📱 Received Node Info packet for node: ${decodedMessage.payloadVariant.nodeInfo.num}`); | ||
this.onNodeInfoPacket.emit({ | ||
this.events.onNodeInfoPacket.emit({ | ||
packet: Protobuf.MeshPacket.create({ | ||
@@ -971,3 +788,3 @@ id: decodedMessage.id | ||
if (decodedMessage.payloadVariant.nodeInfo.position) { | ||
this.onPositionPacket.emit({ | ||
this.events.onPositionPacket.emit({ | ||
packet: Protobuf.MeshPacket.create({ | ||
@@ -981,3 +798,3 @@ id: decodedMessage.id, | ||
if (decodedMessage.payloadVariant.nodeInfo.user) { | ||
this.onUserPacket.emit({ | ||
this.events.onUserPacket.emit({ | ||
packet: Protobuf.MeshPacket.create({ | ||
@@ -998,3 +815,3 @@ id: decodedMessage.id, | ||
} | ||
this.onConfigPacket.emit({ | ||
this.events.onConfigPacket.emit({ | ||
packet: Protobuf.MeshPacket.create({ | ||
@@ -1008,3 +825,3 @@ id: decodedMessage.id | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], "Received onLogRecord"); | ||
this.onLogRecord.emit(decodedMessage.payloadVariant.logRecord); | ||
this.events.onLogRecord.emit(decodedMessage.payloadVariant.logRecord); | ||
break; | ||
@@ -1030,3 +847,3 @@ case "configCompleteId": | ||
} | ||
this.onModuleConfigPacket.emit({ | ||
this.events.onModuleConfigPacket.emit({ | ||
packet: Protobuf.MeshPacket.create({ | ||
@@ -1040,3 +857,3 @@ id: decodedMessage.id | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], `🔐 Received Channel: ${decodedMessage.payloadVariant.channel.index}`); | ||
this.onChannelPacket.emit({ | ||
this.events.onChannelPacket.emit({ | ||
packet: Protobuf.MeshPacket.create({ | ||
@@ -1052,26 +869,26 @@ id: decodedMessage.id | ||
complete() { | ||
this.onLogEvent.cancelAll(); | ||
this.onFromRadio.cancelAll(); | ||
this.onMeshPacket.cancelAll(); | ||
this.onMyNodeInfo.cancelAll(); | ||
this.onNodeInfoPacket.cancelAll(); | ||
this.onUserPacket.cancelAll(); | ||
this.onChannelPacket.cancelAll(); | ||
this.onConfigPacket.cancelAll(); | ||
this.onModuleConfigPacket.cancelAll(); | ||
this.onPingPacket.cancelAll(); | ||
this.onIpTunnelPacket.cancelAll(); | ||
this.onSerialPacket.cancelAll(); | ||
this.onStoreForwardPacket.cancelAll(); | ||
this.onRangeTestPacket.cancelAll(); | ||
this.onTelemetryPacket.cancelAll(); | ||
this.onPrivatePacket.cancelAll(); | ||
this.onAtakPacket.cancelAll(); | ||
this.onRoutingPacket.cancelAll(); | ||
this.onPositionPacket.cancelAll(); | ||
this.onMessagePacket.cancelAll(); | ||
this.onRemoteHardwarePacket.cancelAll(); | ||
this.onDeviceStatus.cancelAll(); | ||
this.onLogRecord.cancelAll(); | ||
this.onMeshHeartbeat.cancelAll(); | ||
this.events.onLogEvent.cancelAll(); | ||
this.events.onFromRadio.cancelAll(); | ||
this.events.onMeshPacket.cancelAll(); | ||
this.events.onMyNodeInfo.cancelAll(); | ||
this.events.onNodeInfoPacket.cancelAll(); | ||
this.events.onUserPacket.cancelAll(); | ||
this.events.onChannelPacket.cancelAll(); | ||
this.events.onConfigPacket.cancelAll(); | ||
this.events.onModuleConfigPacket.cancelAll(); | ||
this.events.onPingPacket.cancelAll(); | ||
this.events.onIpTunnelPacket.cancelAll(); | ||
this.events.onSerialPacket.cancelAll(); | ||
this.events.onStoreForwardPacket.cancelAll(); | ||
this.events.onRangeTestPacket.cancelAll(); | ||
this.events.onTelemetryPacket.cancelAll(); | ||
this.events.onPrivatePacket.cancelAll(); | ||
this.events.onAtakPacket.cancelAll(); | ||
this.events.onRoutingPacket.cancelAll(); | ||
this.events.onPositionPacket.cancelAll(); | ||
this.events.onMessagePacket.cancelAll(); | ||
this.events.onRemoteHardwarePacket.cancelAll(); | ||
this.events.onDeviceStatus.cancelAll(); | ||
this.events.onLogRecord.cancelAll(); | ||
this.events.onMeshHeartbeat.cancelAll(); | ||
this.queue.clear(); | ||
@@ -1085,3 +902,3 @@ } | ||
async handleMeshPacket(meshPacket) { | ||
this.onMeshPacket.emit(meshPacket); | ||
this.events.onMeshPacket.emit(meshPacket); | ||
if (meshPacket.from !== this.myNodeInfo.myNodeNum) { | ||
@@ -1092,3 +909,3 @@ /** | ||
*/ | ||
this.onMeshHeartbeat.emit(new Date()); | ||
this.events.onMeshHeartbeat.emit(new Date()); | ||
} | ||
@@ -1113,3 +930,3 @@ switch (meshPacket.payloadVariant.oneofKind) { | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received TEXT_MESSAGE_APP packet", new TextDecoder().decode(dataPacket.payload)); | ||
this.onMessagePacket.emit({ | ||
this.events.onMessagePacket.emit({ | ||
packet: meshPacket, | ||
@@ -1121,3 +938,3 @@ text: new TextDecoder().decode(dataPacket.payload) | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received REMOTE_HARDWARE_APP packet", Protobuf.HardwareMessage.fromBinary(dataPacket.payload)); | ||
this.onRemoteHardwarePacket.emit({ | ||
this.events.onRemoteHardwarePacket.emit({ | ||
packet: meshPacket, | ||
@@ -1129,3 +946,3 @@ data: Protobuf.HardwareMessage.fromBinary(dataPacket.payload) | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received POSITION_APP packet", Protobuf.Position.fromBinary(dataPacket.payload)); | ||
this.onPositionPacket.emit({ | ||
this.events.onPositionPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1141,3 +958,3 @@ data: Protobuf.Position.fromBinary(dataPacket.payload) | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received NODEINFO_APP packet", Protobuf.User.fromBinary(dataPacket.payload)); | ||
this.onUserPacket.emit({ | ||
this.events.onUserPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1149,3 +966,3 @@ data: Protobuf.User.fromBinary(dataPacket.payload) | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received ROUTING_APP packet", Protobuf.Routing.fromBinary(dataPacket.payload)); | ||
this.onRoutingPacket.emit({ | ||
this.events.onRoutingPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1162,3 +979,3 @@ data: Protobuf.Routing.fromBinary(dataPacket.payload) | ||
case "getChannelResponse": | ||
this.onChannelPacket.emit({ | ||
this.events.onChannelPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1169,3 +986,3 @@ data: adminMessage.payloadVariant.getChannelResponse | ||
case "getOwnerResponse": | ||
this.onUserPacket.emit({ | ||
this.events.onUserPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1176,3 +993,3 @@ data: adminMessage.payloadVariant.getOwnerResponse | ||
case "getConfigResponse": | ||
this.onConfigPacket.emit({ | ||
this.events.onConfigPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1183,3 +1000,3 @@ data: adminMessage.payloadVariant.getConfigResponse | ||
case "getModuleConfigResponse": | ||
this.onModuleConfigPacket.emit({ | ||
this.events.onModuleConfigPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1190,3 +1007,3 @@ data: adminMessage.payloadVariant.getModuleConfigResponse | ||
case "getDeviceMetadataResponse": | ||
this.onDeviceMetadataPacket.emit({ | ||
this.events.onDeviceMetadataPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1205,3 +1022,3 @@ data: adminMessage.payloadVariant.getDeviceMetadataResponse | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received WAYPOINT_APP packet", Protobuf.Waypoint.fromBinary(dataPacket.payload)); | ||
this.onWaypointPacket.emit({ | ||
this.events.onWaypointPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1213,3 +1030,3 @@ data: Protobuf.Waypoint.fromBinary(dataPacket.payload) | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received REPLY_APP packet", dataPacket.payload); | ||
this.onPingPacket.emit({ | ||
this.events.onPingPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1221,3 +1038,3 @@ data: dataPacket.payload //TODO: decode | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received IP_TUNNEL_APP packet", dataPacket.payload); | ||
this.onIpTunnelPacket.emit({ | ||
this.events.onIpTunnelPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1229,3 +1046,3 @@ data: dataPacket.payload | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received SERIAL_APP packet", dataPacket.payload); | ||
this.onSerialPacket.emit({ | ||
this.events.onSerialPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1237,3 +1054,3 @@ data: dataPacket.payload | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received STORE_FORWARD_APP packet", dataPacket.payload); | ||
this.onStoreForwardPacket.emit({ | ||
this.events.onStoreForwardPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1245,3 +1062,3 @@ data: dataPacket.payload | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received RANGE_TEST_APP packet", dataPacket.payload); | ||
this.onRangeTestPacket.emit({ | ||
this.events.onRangeTestPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1253,3 +1070,3 @@ data: dataPacket.payload | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received TELEMETRY_APP packet", Protobuf.Telemetry.fromBinary(dataPacket.payload)); | ||
this.onTelemetryPacket.emit({ | ||
this.events.onTelemetryPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1261,3 +1078,3 @@ data: Protobuf.Telemetry.fromBinary(dataPacket.payload) | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received PRIVATE_APP packet", dataPacket.payload); | ||
this.onPrivatePacket.emit({ | ||
this.events.onPrivatePacket.emit({ | ||
packet: meshPacket, | ||
@@ -1269,3 +1086,3 @@ data: dataPacket.payload | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received ATAK_FORWARDER packet", dataPacket.payload); | ||
this.onAtakPacket.emit({ | ||
this.events.onAtakPacket.emit({ | ||
packet: meshPacket, | ||
@@ -1272,0 +1089,0 @@ data: dataPacket.payload |
@@ -111,3 +111,3 @@ import { SubEvent } from "sub-events"; | ||
if (this.port?.readable && this.port.writable) { | ||
this.transformer = transformHandler(this.log, this.onReleaseEvent, this.onDeviceDebugLog, concurrentLogOutput); | ||
this.transformer = transformHandler(this.log, this.onReleaseEvent, this.events.onDeviceDebugLog, concurrentLogOutput); | ||
const reader = this.port.readable.pipeThrough(this.transformer); | ||
@@ -114,0 +114,0 @@ void this.readFromRadio(reader.getReader()); |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.7.5", | ||
"version": "0.8.0", | ||
"description": "Browser library for interfacing with meshtastic devices", | ||
@@ -5,0 +5,0 @@ "license": "GPL-3.0-only", |
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
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
568500
87
11847