@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.6.105 to 0.6.107
@@ -93,11 +93,2 @@ import { MessageType } from "@protobuf-ts/runtime"; | ||
} | { | ||
oneofKind: "getAllChannelRequest"; | ||
/** | ||
* | ||
* Send all channels in the response to this message | ||
* | ||
* @generated from protobuf field: bool get_all_channel_request = 9; | ||
*/ | ||
getAllChannelRequest: boolean; | ||
} | { | ||
oneofKind: "getCannedMessageModuleMessagesRequest"; | ||
@@ -126,5 +117,5 @@ /** | ||
* | ||
* @generated from protobuf field: uint32 get_device_metadata_request = 12; | ||
* @generated from protobuf field: bool get_device_metadata_request = 12; | ||
*/ | ||
getDeviceMetadataRequest: number; | ||
getDeviceMetadataRequest: boolean; | ||
} | { | ||
@@ -228,2 +219,12 @@ oneofKind: "getDeviceMetadataResponse"; | ||
} | { | ||
oneofKind: "rebootOtaSeconds"; | ||
/** | ||
* | ||
* 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. | ||
* | ||
* @generated from protobuf field: int32 reboot_ota_seconds = 95; | ||
*/ | ||
rebootOtaSeconds: number; | ||
} | { | ||
oneofKind: "exitSimulator"; | ||
@@ -230,0 +231,0 @@ /** |
@@ -138,6 +138,5 @@ // @generated by protobuf-ts 2.8.1 with parameter long_type_string | ||
{ no: 8, name: "get_module_config_response", kind: "message", oneof: "payloadVariant", T: () => ModuleConfig }, | ||
{ no: 9, name: "get_all_channel_request", kind: "scalar", oneof: "payloadVariant", T: 8 /*ScalarType.BOOL*/ }, | ||
{ no: 10, name: "get_canned_message_module_messages_request", kind: "scalar", oneof: "payloadVariant", T: 8 /*ScalarType.BOOL*/ }, | ||
{ no: 11, name: "get_canned_message_module_messages_response", kind: "scalar", oneof: "payloadVariant", T: 9 /*ScalarType.STRING*/ }, | ||
{ no: 12, name: "get_device_metadata_request", kind: "scalar", oneof: "payloadVariant", T: 13 /*ScalarType.UINT32*/ }, | ||
{ no: 12, name: "get_device_metadata_request", kind: "scalar", oneof: "payloadVariant", T: 8 /*ScalarType.BOOL*/ }, | ||
{ no: 13, name: "get_device_metadata_response", kind: "message", oneof: "payloadVariant", T: () => DeviceMetadata }, | ||
@@ -153,2 +152,3 @@ { no: 32, name: "set_owner", kind: "message", oneof: "payloadVariant", T: () => User }, | ||
{ no: 67, name: "confirm_set_radio", kind: "scalar", oneof: "payloadVariant", T: 8 /*ScalarType.BOOL*/ }, | ||
{ no: 95, name: "reboot_ota_seconds", kind: "scalar", oneof: "payloadVariant", T: 5 /*ScalarType.INT32*/ }, | ||
{ no: 96, name: "exit_simulator", kind: "scalar", oneof: "payloadVariant", T: 8 /*ScalarType.BOOL*/ }, | ||
@@ -155,0 +155,0 @@ { no: 97, name: "reboot_seconds", kind: "scalar", oneof: "payloadVariant", T: 5 /*ScalarType.INT32*/ }, |
import { MessageType } from "@protobuf-ts/runtime"; | ||
import { Channel } from "./channel"; | ||
import { ModuleConfig } from "./module_config"; | ||
@@ -1279,2 +1280,11 @@ import { Config } from "./config"; | ||
} | { | ||
oneofKind: "channel"; | ||
/** | ||
* | ||
* One packet is sent for each channel | ||
* | ||
* @generated from protobuf field: Channel channel = 10; | ||
*/ | ||
channel: Channel; | ||
} | { | ||
oneofKind: undefined; | ||
@@ -1281,0 +1291,0 @@ }; |
@@ -5,2 +5,3 @@ // @generated by protobuf-ts 2.8.1 with parameter long_type_string | ||
import { MessageType } from "@protobuf-ts/runtime"; | ||
import { Channel } from "./channel"; | ||
import { ModuleConfig } from "./module_config"; | ||
@@ -889,3 +890,4 @@ import { Config } from "./config"; | ||
{ no: 8, name: "rebooted", kind: "scalar", oneof: "payloadVariant", T: 8 /*ScalarType.BOOL*/ }, | ||
{ no: 9, name: "moduleConfig", kind: "message", oneof: "payloadVariant", T: () => ModuleConfig } | ||
{ no: 9, name: "moduleConfig", kind: "message", oneof: "payloadVariant", T: () => ModuleConfig }, | ||
{ no: 10, name: "channel", kind: "message", oneof: "payloadVariant", T: () => Channel } | ||
]); | ||
@@ -892,0 +894,0 @@ } |
@@ -189,3 +189,3 @@ import { SubEvent } from "sub-events"; | ||
/** | ||
* Fires when a new FromRadio message containing a Text packet has been | ||
* Fires when a new FromRadio message containing a LogRecord packet has been | ||
* received from device | ||
@@ -203,2 +203,8 @@ * | ||
/** | ||
* Outputs any debug log data (currently serial connections only) | ||
* | ||
* @event onDeviceDebugLog | ||
*/ | ||
readonly onDeviceDebugLog: SubEvent<Uint8Array>; | ||
/** | ||
* Fires when the device receives a Metadata packet | ||
@@ -336,9 +342,2 @@ * | ||
/** | ||
* Gets all of the devices channels | ||
* | ||
* @param {(id: number) => Promise<void>} [callback] If wantAck is true, | ||
* callback is called when the ack is received | ||
*/ | ||
getAllChannels(callback?: () => Promise<void>): Promise<void>; | ||
/** | ||
* Gets devices config | ||
@@ -345,0 +344,0 @@ * |
@@ -208,3 +208,3 @@ import { SubEvent } from "sub-events"; | ||
/** | ||
* Fires when a new FromRadio message containing a Text packet has been | ||
* Fires when a new FromRadio message containing a LogRecord packet has been | ||
* received from device | ||
@@ -222,2 +222,8 @@ * | ||
/** | ||
* Outputs any debug log data (currently serial connections only) | ||
* | ||
* @event onDeviceDebugLog | ||
*/ | ||
onDeviceDebugLog = new SubEvent(); | ||
/** | ||
* Fires when the device receives a Metadata packet | ||
@@ -553,21 +559,2 @@ * | ||
/** | ||
* Gets all of the devices channels | ||
* | ||
* @param {(id: number) => Promise<void>} [callback] If wantAck is true, | ||
* callback is called when the ack is received | ||
*/ | ||
async getAllChannels(callback) { | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.getAllChannels, `📻 Requesting all Channels ${callback ? "with" : "without"} callback`, Protobuf.LogRecord_Level.DEBUG); | ||
// TODO: Use device queue now. | ||
const queue = []; | ||
for (let i = 0; i <= this.myNodeInfo.maxChannels; i++) { | ||
queue.push(async () => { | ||
return await Promise.resolve(); | ||
}); | ||
await this.getChannel(i, queue[i]); | ||
} | ||
await Promise.all(queue); | ||
await callback?.(); | ||
} | ||
/** | ||
* Gets devices config | ||
@@ -635,3 +622,3 @@ * | ||
payloadVariant: { | ||
getDeviceMetadataRequest: 0, | ||
getDeviceMetadataRequest: true, | ||
oneofKind: "getDeviceMetadataRequest" | ||
@@ -766,5 +753,2 @@ } | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `⚙️ Valid config id reveived from device: ${this.configId}`, Protobuf.LogRecord_Level.INFO); | ||
await this.getAllChannels(async () => { | ||
await Promise.resolve(); | ||
}); | ||
await this.sendRaw(0, Protobuf.ToRadio.toBinary({ | ||
@@ -778,3 +762,5 @@ payloadVariant: { | ||
} | ||
})); | ||
}), async () => { | ||
//find out what this does | ||
}); | ||
this.updateDeviceStatus(Types.DeviceStatusEnum.DEVICE_CONFIGURED); | ||
@@ -799,2 +785,11 @@ break; | ||
break; | ||
case "channel": | ||
this.log(Types.EmitterScope.iMeshDevice, Types.Emitter.handleFromRadio, `🔐 Received Channel: ${decodedMessage.payloadVariant.channel.index}`, Protobuf.LogRecord_Level.TRACE); | ||
this.onChannelPacket.emit({ | ||
packet: Protobuf.MeshPacket.create({ | ||
id: decodedMessage.id | ||
}), | ||
data: decodedMessage.payloadVariant.channel | ||
}); | ||
break; | ||
} | ||
@@ -801,0 +796,0 @@ } |
@@ -36,4 +36,6 @@ /// <reference types="w3c-web-serial" /> | ||
* `115200`. Default is `115200` | ||
* @param {boolean} [parameters.concurrentLogOutput=false] Emit extra data on | ||
* serial port as debug log data. Default is `false` | ||
*/ | ||
connect({ port, baudRate }: Types.SerialConnectionParameters): Promise<void>; | ||
connect({ port, baudRate, concurrentLogOutput }: Types.SerialConnectionParameters): Promise<void>; | ||
/** Disconnects from the serial port */ | ||
@@ -40,0 +42,0 @@ disconnect(): Promise<void>; |
@@ -65,4 +65,6 @@ import { Protobuf, Types } from "./index.js"; | ||
* `115200`. Default is `115200` | ||
* @param {boolean} [parameters.concurrentLogOutput=false] Emit extra data on | ||
* serial port as debug log data. Default is `false` | ||
*/ | ||
async connect({ port, baudRate = 115200 }) { | ||
async connect({ port, baudRate = 115200, concurrentLogOutput = false }) { | ||
/** Check for API avaliability */ | ||
@@ -87,2 +89,3 @@ if (!navigator.serial) { | ||
let byteBuffer = new Uint8Array([]); | ||
const onDeviceDebugLog = this.onDeviceDebugLog; | ||
if (this.port.readable && this.port.writable) { | ||
@@ -99,5 +102,10 @@ const { log } = this; | ||
if (byteBuffer.subarray(0, framingIndex).length) { | ||
log(Types.EmitterScope.iSerialConnection, Types.Emitter.connect, `⚠️ Found unneccesary message padding, removing: ${byteBuffer | ||
.subarray(0, framingIndex) | ||
.toString()}`, Protobuf.LogRecord_Level.WARNING); | ||
if (concurrentLogOutput) { | ||
onDeviceDebugLog.emit(byteBuffer.subarray(0, framingIndex)); | ||
} | ||
else { | ||
log(Types.EmitterScope.iSerialConnection, Types.Emitter.connect, `⚠️ Found unneccesary message padding, removing: ${byteBuffer | ||
.subarray(0, framingIndex) | ||
.toString()}`, Protobuf.LogRecord_Level.WARNING); | ||
} | ||
byteBuffer = byteBuffer.subarray(framingIndex); | ||
@@ -104,0 +112,0 @@ } |
@@ -40,2 +40,3 @@ /// <reference types="web-bluetooth" /> | ||
port?: SerialPort; | ||
concurrentLogOutput: boolean; | ||
} | ||
@@ -42,0 +43,0 @@ export declare type LogEventPacket = LogEvent & { |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.6.105", | ||
"version": "0.6.107", | ||
"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
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
540397
10906