@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.6.81 to 0.6.82
@@ -25,2 +25,2 @@ /** | ||
*/ | ||
export declare const MIN_FW_VERSION = 1.2; | ||
export declare const MIN_FW_VERSION = 1.3; |
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
export const MIN_FW_VERSION = 1.2; | ||
export const MIN_FW_VERSION = 1.3; | ||
//# sourceMappingURL=constants.js.map |
import { Types } from "./index.js"; | ||
import { IMeshDevice } from "./iMeshDevice.js"; | ||
import { LogRecord_Level } from "./generated/mesh.js"; | ||
import { transformHandler } from "./utils/transformHandler.js"; | ||
/** | ||
@@ -74,4 +75,4 @@ * Allows to connect to a Meshtastic device over WebSerial | ||
this.port = parameters.port ? parameters.port : await this.getPort(); | ||
this.port.addEventListener("disconnect", (e) => { | ||
this.log(Types.EmitterScope.iSerialConnection, Types.Emitter.connect, `Device disconnected: ${e}`, LogRecord_Level.INFO); | ||
this.port.addEventListener("disconnect", () => { | ||
this.log(Types.EmitterScope.iSerialConnection, Types.Emitter.connect, "Device disconnected", LogRecord_Level.INFO); | ||
this.updateDeviceStatus(Types.DeviceStatusEnum.DEVICE_DISCONNECTED); | ||
@@ -84,18 +85,8 @@ this.complete(); | ||
}); | ||
let byteBuffer = new Uint8Array([]); | ||
if (this.port.readable && this.port.writable) { | ||
const transformer = new TransformStream({ | ||
transform(chunk, controller) { | ||
byteBuffer = new Uint8Array([...byteBuffer, ...chunk]); | ||
if (byteBuffer.includes(0x94)) { | ||
const index = byteBuffer.findIndex((byte) => byte === 0x94); | ||
const startBit2 = byteBuffer[index + 1]; | ||
const msb = byteBuffer[index + 2] ?? 0; | ||
const lsb = byteBuffer[index + 3] ?? 0; | ||
const len = index + 4 + lsb + msb; | ||
if (startBit2 === 0xc3 && byteBuffer.length >= len) { | ||
controller.enqueue(byteBuffer.subarray(index + 4, len)); | ||
byteBuffer = byteBuffer.slice(len); | ||
} | ||
} | ||
transformHandler(new Uint8Array([]), chunk, (buffer) => { | ||
controller.enqueue(buffer); | ||
}); | ||
} | ||
@@ -102,0 +93,0 @@ }); |
@@ -125,5 +125,6 @@ /// <reference types="web-bluetooth" /> | ||
"iSerialConnection" = 1, | ||
"iBleConnection" = 2, | ||
"iHttpConnection" = 3, | ||
"SettingsManager" = 4 | ||
"iNodeSerialConnection" = 2, | ||
"iBleConnection" = 3, | ||
"iHttpConnection" = 4, | ||
"SettingsManager" = 5 | ||
} | ||
@@ -130,0 +131,0 @@ export declare enum Emitter { |
@@ -15,5 +15,6 @@ export var DeviceStatusEnum; | ||
EmitterScope[EmitterScope["iSerialConnection"] = 1] = "iSerialConnection"; | ||
EmitterScope[EmitterScope["iBleConnection"] = 2] = "iBleConnection"; | ||
EmitterScope[EmitterScope["iHttpConnection"] = 3] = "iHttpConnection"; | ||
EmitterScope[EmitterScope["SettingsManager"] = 4] = "SettingsManager"; | ||
EmitterScope[EmitterScope["iNodeSerialConnection"] = 2] = "iNodeSerialConnection"; | ||
EmitterScope[EmitterScope["iBleConnection"] = 3] = "iBleConnection"; | ||
EmitterScope[EmitterScope["iHttpConnection"] = 4] = "iHttpConnection"; | ||
EmitterScope[EmitterScope["SettingsManager"] = 5] = "SettingsManager"; | ||
})(EmitterScope || (EmitterScope = {})); | ||
@@ -20,0 +21,0 @@ export var Emitter; |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.6.81", | ||
"version": "0.6.82", | ||
"description": "Browser library for interfacing with meshtastic devices", | ||
@@ -13,2 +13,6 @@ "license": "GPL-3.0-only", | ||
"types": "./types/index.d.ts" | ||
}, | ||
"./node": { | ||
"import": "./dist/node/index.js", | ||
"types": "./types/node/index.d.ts" | ||
} | ||
@@ -30,3 +34,5 @@ }, | ||
"@protobuf-ts/runtime": "^2.7.0", | ||
"@serialport/stream": "^10.3.0", | ||
"prettier": "^2.7.1", | ||
"serialport": "^10.4.0", | ||
"sub-events": "^1.8.9" | ||
@@ -37,5 +43,5 @@ }, | ||
"@types/w3c-web-serial": "^1.0.2", | ||
"@types/web-bluetooth": "^0.0.14", | ||
"@types/web-bluetooth": "^0.0.15", | ||
"node-protoc": "^1.0.3", | ||
"typedoc": "^0.23.8", | ||
"typedoc": "^0.23.9", | ||
"typescript": "^4.7.4" | ||
@@ -42,0 +48,0 @@ }, |
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
515683
93
10622
6
+ Added@serialport/stream@^10.3.0
+ Addedserialport@^10.4.0
+ Added@serialport/binding-mock@10.2.2(transitive)
+ Added@serialport/bindings-cpp@10.8.0(transitive)
+ Added@serialport/bindings-interface@1.2.2(transitive)
+ Added@serialport/parser-byte-length@10.5.0(transitive)
+ Added@serialport/parser-cctalk@10.5.0(transitive)
+ Added@serialport/parser-delimiter@10.5.0(transitive)
+ Added@serialport/parser-inter-byte-timeout@10.5.0(transitive)
+ Added@serialport/parser-packet-length@10.5.0(transitive)
+ Added@serialport/parser-readline@10.5.0(transitive)
+ Added@serialport/parser-ready@10.5.0(transitive)
+ Added@serialport/parser-regex@10.5.0(transitive)
+ Added@serialport/parser-slip-encoder@10.5.0(transitive)
+ Added@serialport/parser-spacepacket@10.5.0(transitive)
+ Added@serialport/stream@10.5.0(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)
+ Addednode-addon-api@5.1.0(transitive)
+ Addednode-gyp-build@4.8.2(transitive)
+ Addedserialport@10.5.0(transitive)