@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -74,3 +74,3 @@ import { Types } from "./index.js"; | ||
if (!navigator.bluetooth) { | ||
this.log.warn(Types.EmitterScope.iBleConnection, Types.Emitter.connect, `⚠️ This browser doesn't support the WebBluetooth API`); | ||
this.log.warn(Types.Emitter[Types.Emitter.connect], `⚠️ This browser doesn't support the WebBluetooth API`); | ||
} | ||
@@ -85,3 +85,3 @@ /** Set device state to connecting */ | ||
this.device.addEventListener("gattserverdisconnected", () => { | ||
this.log.info(Types.EmitterScope.iBleConnection, Types.Emitter.connect, "Device disconnected"); | ||
this.log.info(Types.Emitter[Types.Emitter.connect], "Device disconnected"); | ||
this.updateDeviceStatus({ | ||
@@ -96,15 +96,15 @@ status: Types.DeviceStatusEnum.DEVICE_DISCONNECTED | ||
.then((server) => { | ||
this.log.info(Types.EmitterScope.iBleConnection, Types.Emitter.connect, `✅ Got GATT Server for device: ${server.device.id}`); | ||
this.log.info(Types.Emitter[Types.Emitter.connect], `✅ Got GATT Server for device: ${server.device.id}`); | ||
this.GATTServer = server; | ||
}) | ||
.catch((e) => { | ||
this.log.error(Types.EmitterScope.iBleConnection, Types.Emitter.connect, `❌ Failed to connect: ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.connect], `❌ Failed to connect: ${e.message}`); | ||
}); | ||
await this.GATTServer?.getPrimaryService(serviceUUID) | ||
.then((service) => { | ||
this.log.info(Types.EmitterScope.iBleConnection, Types.Emitter.connect, `✅ Got GATT Service for device: ${service.device.id}`); | ||
this.log.info(Types.Emitter[Types.Emitter.connect], `✅ Got GATT Service for device: ${service.device.id}`); | ||
this.service = service; | ||
}) | ||
.catch((e) => { | ||
this.log.error(Types.EmitterScope.iBleConnection, Types.Emitter.connect, `❌ Failed to get primary service: q${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.connect], `❌ Failed to get primary service: q${e.message}`); | ||
}); | ||
@@ -115,3 +115,3 @@ [toRadioUUID, fromRadioUUID, fromNumUUID].map(async (uuid) => { | ||
.then((characteristic) => { | ||
this.log.info(Types.EmitterScope.iBleConnection, Types.Emitter.connect, `✅ Got Characteristic ${characteristic.uuid} for device: ${characteristic.uuid}`); | ||
this.log.info(Types.Emitter[Types.Emitter.connect], `✅ Got Characteristic ${characteristic.uuid} for device: ${characteristic.uuid}`); | ||
switch (uuid) { | ||
@@ -130,3 +130,3 @@ case toRadioUUID: | ||
.catch((e) => { | ||
this.log.error(Types.EmitterScope.iBleConnection, Types.Emitter.connect, `❌ Failed to get toRadio characteristic: q${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.connect], `❌ Failed to get toRadio characteristic: q${e.message}`); | ||
}); | ||
@@ -183,3 +183,3 @@ }); | ||
readBuffer = new ArrayBuffer(0); | ||
this.log.error(Types.EmitterScope.iBleConnection, Types.Emitter.readFromRadio, `❌ ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.readFromRadio], `❌ ${e.message}`); | ||
}); | ||
@@ -186,0 +186,0 @@ } |
@@ -46,7 +46,7 @@ import { Types } from "./index.js"; | ||
(await this.ping())) { | ||
this.log.debug(Types.EmitterScope.iHttpConnection, Types.Emitter.connect, `Ping succeeded, starting configuration and request timer.`); | ||
this.log.debug(Types.Emitter[Types.Emitter.connect], `Ping succeeded, starting configuration and request timer.`); | ||
this.configure(); | ||
this.readLoop = setInterval(() => { | ||
this.readFromRadio().catch((e) => { | ||
this.log.error(Types.EmitterScope.iHttpConnection, Types.Emitter.connect, `❌ ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.connect], `❌ ${e.message}`); | ||
}); | ||
@@ -81,3 +81,3 @@ }, fetchInterval); | ||
async ping() { | ||
this.log.debug(Types.EmitterScope.iHttpConnection, Types.Emitter.ping, `Attempting device ping.`); | ||
this.log.debug(Types.Emitter[Types.Emitter.ping], `Attempting device ping.`); | ||
const { signal } = this.abortController; | ||
@@ -94,3 +94,3 @@ let pingSuccessful = false; | ||
pingSuccessful = false; | ||
this.log.error(Types.EmitterScope.iHttpConnection, Types.Emitter.ping, `❌ ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.ping], `❌ ${e.message}`); | ||
this.updateDeviceStatus({ | ||
@@ -132,3 +132,3 @@ status: Types.DeviceStatusEnum.DEVICE_RECONNECTING | ||
this.peningRequest = false; | ||
this.log.error(Types.EmitterScope.iHttpConnection, Types.Emitter.readFromRadio, `❌ ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.readFromRadio], `❌ ${e.message}`); | ||
this.updateDeviceStatus({ | ||
@@ -160,7 +160,7 @@ status: Types.DeviceStatusEnum.DEVICE_RECONNECTING | ||
await this.readFromRadio().catch((e) => { | ||
this.log.error(Types.EmitterScope.iHttpConnection, Types.Emitter.writeToRadio, `❌ ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.writeToRadio], `❌ ${e.message}`); | ||
}); | ||
}) | ||
.catch((e) => { | ||
this.log.error(Types.EmitterScope.iHttpConnection, Types.Emitter.writeToRadio, `❌ ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.writeToRadio], `❌ ${e.message}`); | ||
this.updateDeviceStatus({ | ||
@@ -167,0 +167,0 @@ status: Types.DeviceStatusEnum.DEVICE_RECONNECTING |
@@ -216,2 +216,8 @@ import { SubEvent } from "sub-events"; | ||
/** | ||
* Outputs status of pending settings changes | ||
* | ||
* @event pendingSettingsChange | ||
*/ | ||
readonly onPendingSettingsChange: SubEvent<boolean>; | ||
/** | ||
* Sends a text over the radio | ||
@@ -218,0 +224,0 @@ * |
@@ -43,2 +43,5 @@ import { SubEvent } from "sub-events"; | ||
}); | ||
this.onPendingSettingsChange.subscribe((state) => { | ||
this.pendingSettingsChanges = state; | ||
}); | ||
} | ||
@@ -225,2 +228,8 @@ /** | ||
/** | ||
* Outputs status of pending settings changes | ||
* | ||
* @event pendingSettingsChange | ||
*/ | ||
onPendingSettingsChange = new SubEvent(); | ||
/** | ||
* Sends a text over the radio | ||
@@ -239,3 +248,3 @@ * | ||
sendText({ text, destination, wantAck, channel, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.sendText, `📤 Sending message to ${destination ?? "broadcast"} on channel ${channel?.toString() ?? 0}`); | ||
this.log.debug(Types.Emitter[Types.Emitter.sendText], `📤 Sending message to ${destination ?? "broadcast"} on channel ${channel?.toString() ?? 0}`); | ||
const enc = new TextEncoder(); | ||
@@ -265,3 +274,3 @@ return this.sendPacket({ | ||
sendWaypoint({ waypoint, destination, channel, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.sendWaypoint, `📤 Sending waypoint to ${destination} on channel ${channel?.toString() ?? 0}`); | ||
this.log.debug(Types.Emitter[Types.Emitter.sendWaypoint], `📤 Sending waypoint to ${destination} on channel ${channel?.toString() ?? 0}`); | ||
return this.sendPacket({ | ||
@@ -297,3 +306,3 @@ byteData: Protobuf.Waypoint.toBinary(waypoint), | ||
async sendPacket({ byteData, portNum, destination, wantAck = false, channel = Types.ChannelNumber.PRIMARY, wantResponse = false, echoResponse = false, callback, emoji = 0, replyId = 0 }) { | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.sendPacket, `📤 Sending ${Protobuf.PortNum[portNum]} to ${destination}`); | ||
this.log.trace(Types.Emitter[Types.Emitter.sendPacket], `📤 Sending ${Protobuf.PortNum[portNum]} to ${destination}`); | ||
const meshPacket = Protobuf.MeshPacket.create({ | ||
@@ -344,3 +353,3 @@ payloadVariant: { | ||
if (toRadio.length > 512) { | ||
this.log.warn(Types.EmitterScope.iMeshDevice, Types.Emitter.sendRaw, `Message longer than 512 bytes, it will not be sent!`); | ||
this.log.warn(Types.Emitter[Types.Emitter.sendRaw], `Message longer than 512 bytes, it will not be sent!`); | ||
} | ||
@@ -370,3 +379,3 @@ else { | ||
async setConfig({ config, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.setConfig, `Setting config ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.setConfig], `Setting config ${callback ? "with" : "without"} callback`); | ||
let configType; | ||
@@ -422,3 +431,3 @@ switch (config.payloadVariant.oneofKind) { | ||
async setModuleConfig({ moduleConfig, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.setModuleConfig, `Setting module config ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.setModuleConfig], `Setting module config ${callback ? "with" : "without"} callback`); | ||
let moduleConfigType; | ||
@@ -479,3 +488,3 @@ switch (moduleConfig.payloadVariant.oneofKind) { | ||
async setOwner({ owner, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.setOwner, `Setting owner ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.setOwner], `Setting owner ${callback ? "with" : "without"} callback`); | ||
const setOwner = Protobuf.AdminMessage.toBinary({ | ||
@@ -507,3 +516,3 @@ payloadVariant: { | ||
async setChannel({ channel, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.setChannel, `📻 Setting Channel: ${channel.index} ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.setChannel], `📻 Setting Channel: ${channel.index} ${callback ? "with" : "without"} callback`); | ||
const setChannel = Protobuf.AdminMessage.toBinary({ | ||
@@ -545,3 +554,3 @@ payloadVariant: { | ||
async getChannel({ index, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.getChannel, `📻 Requesting Channel: ${index} ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.getChannel], `📻 Requesting Channel: ${index} ${callback ? "with" : "without"} callback`); | ||
const getChannelRequest = Protobuf.AdminMessage.toBinary({ | ||
@@ -571,3 +580,3 @@ payloadVariant: { | ||
async getConfig({ configType, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.getConfig, `Requesting config ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.getConfig], `Requesting config ${callback ? "with" : "without"} callback`); | ||
const getRadioRequest = Protobuf.AdminMessage.toBinary({ | ||
@@ -597,3 +606,3 @@ payloadVariant: { | ||
async getModuleConfig({ moduleConfigType, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.getModuleConfig, `Requesting module config ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.getModuleConfig], `Requesting module config ${callback ? "with" : "without"} callback`); | ||
const getRadioRequest = Protobuf.AdminMessage.toBinary({ | ||
@@ -621,3 +630,3 @@ payloadVariant: { | ||
async getOwner({ callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.getOwner, `Requesting owner ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.getOwner], `Requesting owner ${callback ? "with" : "without"} callback`); | ||
const getOwnerRequest = Protobuf.AdminMessage.toBinary({ | ||
@@ -646,3 +655,3 @@ payloadVariant: { | ||
async getMetadata({ nodeNum, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.getMetadata, `Requesting metadata from ${nodeNum} ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.getMetadata], `Requesting metadata from ${nodeNum} ${callback ? "with" : "without"} callback`); | ||
const getDeviceMetricsRequest = Protobuf.AdminMessage.toBinary({ | ||
@@ -672,3 +681,3 @@ payloadVariant: { | ||
async clearChannel({ index, callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.clearChannel, `📻 Clearing Channel ${index} ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.clearChannel], `📻 Clearing Channel ${index} ${callback ? "with" : "without"} callback`); | ||
const channel = Protobuf.Channel.create({ | ||
@@ -704,3 +713,3 @@ index, | ||
async confirmSetChannel({ callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.confirmSetChannel, `📻 Confirming Channel config ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.confirmSetChannel], `📻 Confirming Channel config ${callback ? "with" : "without"} callback`); | ||
const confirmSetChannel = Protobuf.AdminMessage.toBinary({ | ||
@@ -722,3 +731,3 @@ payloadVariant: { | ||
async beginEditSettings() { | ||
this.pendingSettingsChanges = true; | ||
this.onPendingSettingsChange.emit(true); | ||
const beginEditSettings = Protobuf.AdminMessage.toBinary({ | ||
@@ -748,3 +757,3 @@ payloadVariant: { | ||
}); | ||
this.pendingSettingsChanges = false; | ||
this.onPendingSettingsChange.emit(false); | ||
} | ||
@@ -759,3 +768,3 @@ /** | ||
async confirmSetConfig({ callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.confirmSetConfig, `Confirming config ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.confirmSetConfig], `Confirming config ${callback ? "with" : "without"} callback`); | ||
if (!this.pendingSettingsChanges) { | ||
@@ -787,3 +796,3 @@ await this.beginEditSettings(); | ||
async resetPeers({ callback }) { | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.resetPeers, `📻 Resetting Peers ${callback ? "with" : "without"} callback`); | ||
this.log.debug(Types.Emitter[Types.Emitter.resetPeers], `📻 Resetting Peers ${callback ? "with" : "without"} callback`); | ||
const resetPeers = Protobuf.AdminMessage.toBinary({ | ||
@@ -809,3 +818,3 @@ payloadVariant: { | ||
// TODO: this not always logged | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.configure, `⚙️ Requesting device configuration`); | ||
this.log.debug(Types.Emitter[Types.Emitter.configure], `⚙️ Requesting device configuration`); | ||
this.updateDeviceStatus({ | ||
@@ -859,9 +868,9 @@ status: Types.DeviceStatusEnum.DEVICE_CONFIGURING | ||
minFwVer) { | ||
this.log.fatal(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `Device firmware outdated. Min supported: ${minFwVer} got : ${decodedMessage.payloadVariant.myInfo.firmwareVersion}`); | ||
this.log.fatal(Types.Emitter[Types.Emitter.handleFromRadio], `Device firmware outdated. Min supported: ${minFwVer} got : ${decodedMessage.payloadVariant.myInfo.firmwareVersion}`); | ||
} | ||
this.onMyNodeInfo.emit(decodedMessage.payloadVariant.myInfo); | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, "📱 Received Node info for this device"); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], "📱 Received Node info for this device"); | ||
break; | ||
case "nodeInfo": | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `📱 Received Node Info packet for node: ${decodedMessage.payloadVariant.nodeInfo.num}`); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], `📱 Received Node Info packet for node: ${decodedMessage.payloadVariant.nodeInfo.num}`); | ||
this.onNodeInfoPacket.emit({ | ||
@@ -894,6 +903,6 @@ packet: Protobuf.MeshPacket.create({ | ||
if (decodedMessage.payloadVariant.config.payloadVariant.oneofKind) { | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `💾 Received Config packet of variant: ${decodedMessage.payloadVariant.config.payloadVariant.oneofKind}`); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], `💾 Received Config packet of variant: ${decodedMessage.payloadVariant.config.payloadVariant.oneofKind}`); | ||
} | ||
else { | ||
this.log.warn(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `⚠️ Received Config packet of variant: ${"UNK"}`); | ||
this.log.warn(Types.Emitter[Types.Emitter.handleFromRadio], `⚠️ Received Config packet of variant: ${"UNK"}`); | ||
} | ||
@@ -908,3 +917,3 @@ this.onConfigPacket.emit({ | ||
case "logRecord": | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, "Received onLogRecord"); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], "Received onLogRecord"); | ||
this.onLogRecord.emit(decodedMessage.payloadVariant.logRecord); | ||
@@ -914,5 +923,5 @@ break; | ||
if (decodedMessage.payloadVariant.configCompleteId !== this.configId) { | ||
this.log.error(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `❌ Invalid config id reveived from device, exptected ${this.configId} but received ${decodedMessage.payloadVariant.configCompleteId}`); | ||
this.log.error(Types.Emitter[Types.Emitter.handleFromRadio], `❌ Invalid config id reveived from device, exptected ${this.configId} but received ${decodedMessage.payloadVariant.configCompleteId}`); | ||
} | ||
this.log.info(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `⚙️ Valid config id reveived from device: ${this.configId}`); | ||
this.log.info(Types.Emitter[Types.Emitter.handleFromRadio], `⚙️ Valid config id reveived from device: ${this.configId}`); | ||
this.updateDeviceStatus({ | ||
@@ -927,6 +936,6 @@ status: Types.DeviceStatusEnum.DEVICE_CONFIGURED | ||
if (decodedMessage.payloadVariant.moduleConfig.payloadVariant.oneofKind) { | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `💾 Received Module Config packet of variant: ${decodedMessage.payloadVariant.moduleConfig.payloadVariant.oneofKind}`); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], `💾 Received Module Config packet of variant: ${decodedMessage.payloadVariant.moduleConfig.payloadVariant.oneofKind}`); | ||
} | ||
else { | ||
this.log.warn(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, "⚠️ Received Module Config packet of variant: UNK"); | ||
this.log.warn(Types.Emitter[Types.Emitter.handleFromRadio], "⚠️ Received Module Config packet of variant: UNK"); | ||
} | ||
@@ -941,3 +950,3 @@ this.onModuleConfigPacket.emit({ | ||
case "channel": | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `🔐 Received Channel: ${decodedMessage.payloadVariant.channel.index}`); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleFromRadio], `🔐 Received Channel: ${decodedMessage.payloadVariant.channel.index}`); | ||
this.onChannelPacket.emit({ | ||
@@ -1003,3 +1012,3 @@ packet: Protobuf.MeshPacket.create({ | ||
case "encrypted": | ||
this.log.debug(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "Device received encrypted data packet, ignoring."); | ||
this.log.debug(Types.Emitter[Types.Emitter.handleMeshPacket], "Device received encrypted data packet, ignoring."); | ||
break; | ||
@@ -1012,3 +1021,3 @@ } | ||
case Protobuf.PortNum.TEXT_MESSAGE_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received TEXT_MESSAGE_APP packet", new TextDecoder().decode(dataPacket.payload)); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received TEXT_MESSAGE_APP packet", new TextDecoder().decode(dataPacket.payload)); | ||
this.onMessagePacket.emit({ | ||
@@ -1020,3 +1029,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.REMOTE_HARDWARE_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received REMOTE_HARDWARE_APP packet", Protobuf.HardwareMessage.fromBinary(dataPacket.payload)); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received REMOTE_HARDWARE_APP packet", Protobuf.HardwareMessage.fromBinary(dataPacket.payload)); | ||
this.onRemoteHardwarePacket.emit({ | ||
@@ -1028,3 +1037,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.POSITION_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received POSITION_APP packet", Protobuf.Position.fromBinary(dataPacket.payload)); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received POSITION_APP packet", Protobuf.Position.fromBinary(dataPacket.payload)); | ||
this.onPositionPacket.emit({ | ||
@@ -1040,3 +1049,3 @@ packet: meshPacket, | ||
*/ | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received NODEINFO_APP packet", Protobuf.User.fromBinary(dataPacket.payload)); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received NODEINFO_APP packet", Protobuf.User.fromBinary(dataPacket.payload)); | ||
this.onUserPacket.emit({ | ||
@@ -1048,3 +1057,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.ROUTING_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received ROUTING_APP packet", Protobuf.Routing.fromBinary(dataPacket.payload)); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received ROUTING_APP packet", Protobuf.Routing.fromBinary(dataPacket.payload)); | ||
this.onRoutingPacket.emit({ | ||
@@ -1057,3 +1066,3 @@ packet: meshPacket, | ||
adminMessage = Protobuf.AdminMessage.fromBinary(dataPacket.payload); | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, `📦 Received ADMIN_APP packet of variant ${ | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], `📦 Received ADMIN_APP packet of variant ${ | ||
//change | ||
@@ -1093,10 +1102,10 @@ adminMessage.payloadVariant.oneofKind ?? "UNK"}`, adminMessage); | ||
default: | ||
this.log.warn(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, `⚠️ Received unhandled AdminMessage, type ${adminMessage.payloadVariant.oneofKind ?? "undefined"}`, dataPacket.payload); | ||
this.log.warn(Types.Emitter[Types.Emitter.handleMeshPacket], `⚠️ Received unhandled AdminMessage, type ${adminMessage.payloadVariant.oneofKind ?? "undefined"}`, dataPacket.payload); | ||
} | ||
break; | ||
case Protobuf.PortNum.TEXT_MESSAGE_COMPRESSED_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received TEXT_MESSAGE_COMPRESSED_APP packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received TEXT_MESSAGE_COMPRESSED_APP packet", dataPacket.payload); | ||
break; | ||
case Protobuf.PortNum.WAYPOINT_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received WAYPOINT_APP packet", Protobuf.Waypoint.fromBinary(dataPacket.payload)); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received WAYPOINT_APP packet", Protobuf.Waypoint.fromBinary(dataPacket.payload)); | ||
this.onWaypointPacket.emit({ | ||
@@ -1108,3 +1117,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.REPLY_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received REPLY_APP packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received REPLY_APP packet", dataPacket.payload); | ||
this.onPingPacket.emit({ | ||
@@ -1116,3 +1125,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.IP_TUNNEL_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received IP_TUNNEL_APP packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received IP_TUNNEL_APP packet", dataPacket.payload); | ||
this.onIpTunnelPacket.emit({ | ||
@@ -1124,3 +1133,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.SERIAL_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received SERIAL_APP packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received SERIAL_APP packet", dataPacket.payload); | ||
this.onSerialPacket.emit({ | ||
@@ -1132,3 +1141,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.STORE_FORWARD_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received STORE_FORWARD_APP packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received STORE_FORWARD_APP packet", dataPacket.payload); | ||
this.onStoreForwardPacket.emit({ | ||
@@ -1140,3 +1149,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.RANGE_TEST_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received RANGE_TEST_APP packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received RANGE_TEST_APP packet", dataPacket.payload); | ||
this.onRangeTestPacket.emit({ | ||
@@ -1148,3 +1157,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.TELEMETRY_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received TELEMETRY_APP packet", Protobuf.Telemetry.fromBinary(dataPacket.payload)); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received TELEMETRY_APP packet", Protobuf.Telemetry.fromBinary(dataPacket.payload)); | ||
this.onTelemetryPacket.emit({ | ||
@@ -1156,3 +1165,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.PRIVATE_APP: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received PRIVATE_APP packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received PRIVATE_APP packet", dataPacket.payload); | ||
this.onPrivatePacket.emit({ | ||
@@ -1164,3 +1173,3 @@ packet: meshPacket, | ||
case Protobuf.PortNum.ATAK_FORWARDER: | ||
this.log.trace(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, "📦 Received ATAK_FORWARDER packet", dataPacket.payload); | ||
this.log.trace(Types.Emitter[Types.Emitter.handleMeshPacket], "📦 Received ATAK_FORWARDER packet", dataPacket.payload); | ||
this.onAtakPacket.emit({ | ||
@@ -1172,3 +1181,3 @@ packet: meshPacket, | ||
default: | ||
this.log.warn(Types.EmitterScope.iMeshDevice, Types.Emitter.handleMeshPacket, `⚠️ Received unhandled PortNum: ${Protobuf.PortNum[dataPacket.portnum]}`, dataPacket.payload); | ||
this.log.warn(Types.Emitter[Types.Emitter.handleMeshPacket], `⚠️ Received unhandled PortNum: ${Protobuf.PortNum[dataPacket.portnum]}`, dataPacket.payload); | ||
break; | ||
@@ -1175,0 +1184,0 @@ } |
@@ -49,3 +49,3 @@ import { SubEvent } from "sub-events"; | ||
void this.handleFromRadio({ fromRadio: value }).catch((e) => { | ||
this.log.info(Types.EmitterScope.iSerialConnection, Types.Emitter.readFromRadio, `Device errored or disconnected: ${e.message}`); | ||
this.log.info(Types.Emitter[Types.Emitter.readFromRadio], `Device errored or disconnected: ${e.message}`); | ||
}); | ||
@@ -55,3 +55,3 @@ } | ||
.catch(() => { | ||
this.log.debug(Types.EmitterScope.iSerialConnection, Types.Emitter.readFromRadio, `Releasing reader`); | ||
this.log.debug(Types.Emitter[Types.Emitter.readFromRadio], `Releasing reader`); | ||
}); | ||
@@ -89,3 +89,3 @@ } | ||
if (!navigator.serial) { | ||
this.log.warn(Types.EmitterScope.iSerialConnection, Types.Emitter.connect, `⚠️ This browser doesn't support the WebSerial API`); | ||
this.log.warn(Types.Emitter[Types.Emitter.connect], `⚠️ This browser doesn't support the WebSerial API`); | ||
} | ||
@@ -100,3 +100,3 @@ /** Set device state to connecting */ | ||
this.port.addEventListener("disconnect", () => { | ||
this.log.info(Types.EmitterScope.iSerialConnection, Types.Emitter.connect, "Device disconnected"); | ||
this.log.info(Types.Emitter[Types.Emitter.connect], "Device disconnected"); | ||
this.updateDeviceStatus({ | ||
@@ -127,3 +127,3 @@ status: Types.DeviceStatusEnum.DEVICE_DISCONNECTED | ||
.catch((e) => { | ||
this.log.error(Types.EmitterScope.iSerialConnection, Types.Emitter.connect, `❌ ${e.message}`); | ||
this.log.error(Types.Emitter[Types.Emitter.connect], `❌ ${e.message}`); | ||
}); | ||
@@ -130,0 +130,0 @@ } |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"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
11551
552237