@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -23,8 +23,4 @@ /** | ||
/** | ||
* Is sent with device configuration request and is used for verification of config process | ||
*/ | ||
export declare const MY_CONFIG_ID = 42; | ||
/** | ||
* Minimum device firmware version supported by this version of the library. | ||
*/ | ||
export declare const MIN_FW_VERSION = 1.2; |
@@ -23,6 +23,2 @@ /** | ||
/** | ||
* Is sent with device configuration request and is used for verification of config process | ||
*/ | ||
export const MY_CONFIG_ID = 42; | ||
/** | ||
* Minimum device firmware version supported by this version of the library. | ||
@@ -29,0 +25,0 @@ */ |
@@ -1,2 +0,1 @@ | ||
import { Subject } from "rxjs"; | ||
import { Types } from "./"; | ||
@@ -16,8 +15,2 @@ import { IMeshDevice } from "./imeshdevice"; | ||
receiveBatchRequests: boolean; | ||
/** | ||
* Fires whenever a Fires at timed intervals | ||
* ? void or bool? ie. don't fire if device doesn't respond or true/false if it does/doesnt, or status code | ||
* @event | ||
*/ | ||
readonly onHeartbeatEvent: Subject<void>; | ||
constructor(); | ||
@@ -24,0 +17,0 @@ /** |
@@ -1,2 +0,1 @@ | ||
import { Subject } from "rxjs"; | ||
import { Protobuf, Types } from "./"; | ||
@@ -11,8 +10,2 @@ import { IMeshDevice } from "./imeshdevice"; | ||
super(); | ||
/** | ||
* Fires whenever a Fires at timed intervals | ||
* ? void or bool? ie. don't fire if device doesn't respond or true/false if it does/doesnt, or status code | ||
* @event | ||
*/ | ||
this.onHeartbeatEvent = new Subject(); | ||
this.url = undefined; | ||
@@ -19,0 +12,0 @@ this.consecutiveFailedRequests = 0; |
@@ -122,5 +122,5 @@ import { Subject } from "rxjs"; | ||
* Writes radio config to device | ||
* @param radioConfig | ||
* @param preferences Radio UserPreferences | ||
*/ | ||
setRadioConfig(radioConfig: Protobuf.RadioConfig): Promise<void>; | ||
setPreferences(preferences: Protobuf.UserPreferences): Promise<void>; | ||
/** | ||
@@ -127,0 +127,0 @@ * Sets devices owner data |
import { Subject } from "rxjs"; | ||
import { Protobuf, Types } from "./"; | ||
import { BROADCAST_NUM, MIN_FW_VERSION, MY_CONFIG_ID } from "./constants"; | ||
import { BROADCAST_NUM, MIN_FW_VERSION } from "./constants"; | ||
import { log } from "./utils"; | ||
@@ -124,16 +124,11 @@ /** | ||
* Writes radio config to device | ||
* @param radioConfig | ||
* @param preferences Radio UserPreferences | ||
*/ | ||
async setRadioConfig(radioConfig) { | ||
/** | ||
* @todo used to check if the radioConfig had bean read, should be verified by whatever clalls this function | ||
* ! @todo fix | ||
*/ | ||
await this.writeToRadio(Protobuf.ToRadio.encode(new Protobuf.ToRadio({ | ||
packet: new Protobuf.MeshPacket(new Protobuf.AdminMessage({ | ||
setRadio: new Protobuf.RadioConfig({ | ||
preferences: radioConfig.preferences | ||
}) | ||
})) | ||
})).finish()); | ||
async setPreferences(preferences) { | ||
const adminMessage = Protobuf.AdminMessage.encode(new Protobuf.AdminMessage({ | ||
setRadio: new Protobuf.RadioConfig({ | ||
preferences: preferences | ||
}) | ||
})).finish(); | ||
await this.sendPacket(adminMessage, Protobuf.PortNumEnum.ADMIN_APP, this.myNodeInfo.myNodeNum, true, true); | ||
} | ||
@@ -175,5 +170,6 @@ /** | ||
async configure() { | ||
log(`IMeshDevice.configure`, `Reading device configuration`, Protobuf.LogLevelEnum.DEBUG); | ||
this.onDeviceStatusEvent.next(Types.DeviceStatusEnum.DEVICE_CONFIGURING); | ||
await this.writeToRadio(Protobuf.ToRadio.encode(new Protobuf.ToRadio({ | ||
wantConfigId: MY_CONFIG_ID | ||
wantConfigId: this.configId | ||
})).finish()); | ||
@@ -184,3 +180,3 @@ await this.readFromRadio(); | ||
})).finish(); | ||
this.sendPacket(adminMessage, Protobuf.PortNumEnum.ADMIN_APP, this.myNodeInfo.myNodeNum, true, true); | ||
await this.sendPacket(adminMessage, Protobuf.PortNumEnum.ADMIN_APP, this.myNodeInfo.myNodeNum, true, true); | ||
await this.readFromRadio(); | ||
@@ -191,3 +187,3 @@ for (let index = 1; index <= this.myNodeInfo.maxChannels; index++) { | ||
})).finish(); | ||
this.sendPacket(channelRequest, Protobuf.PortNumEnum.ADMIN_APP, this.myNodeInfo.myNodeNum, true, true); | ||
await this.sendPacket(channelRequest, Protobuf.PortNumEnum.ADMIN_APP, this.myNodeInfo.myNodeNum, true, true); | ||
await this.readFromRadio(); | ||
@@ -247,3 +243,3 @@ } | ||
if (fromRadioObj.configCompleteId !== this.configId) { | ||
log(`IMeshDevice.handleFromRadio`, `Invalid config id reveived from device`, Protobuf.LogLevelEnum.ERROR); | ||
log(`IMeshDevice.handleFromRadio`, `Invalid config id reveived from device, exptected ${this.configId} but received ${fromRadioObj.configCompleteId}`, Protobuf.LogLevelEnum.ERROR); | ||
} | ||
@@ -250,0 +246,0 @@ break; |
@@ -58,3 +58,3 @@ import { Protobuf } from "./"; | ||
case Protobuf.LogLevelEnum.INFO: | ||
console.info(`%c[INFO]%c ${emitter}\n%c${message}`, "color:darkgrey", "color:white"); | ||
console.info(`%c[INFO]%c ${emitter}\n%c${message}`, "color:darkgrey", "color:cyan", "color:white"); | ||
break; | ||
@@ -61,0 +61,0 @@ case Protobuf.LogLevelEnum.WARNING: |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Browser library for interfacing with meshtastic devices", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
# Meshtastic.js | ||
![](https://badgen.net/npm/v/@meshtastic/meshtasticjs) ![](https://badgen.net/npm/dt/@meshtastic/meshtasticjs) ![](https://badgen.net/bundlephobia/minzip/@meshtastic/meshtasticjs) ![](https://badgen.net/bundlephobia/dependency-count/@meshtastic/meshtasticjs) ![](https://badgen.net/bundlephobia/tree-shaking/@meshtastic/meshtasticjs) | ||
![NPM](https://badgen.net/npm/v/@meshtastic/meshtasticjs) ![Downloads](https://badgen.net/npm/dt/@meshtastic/meshtasticjs) ![Min Zipped](https://badgen.net/bundlephobia/minzip/@meshtastic/meshtasticjs) ![Dependencies](https://badgen.net/bundlephobia/dependency-count/@meshtastic/meshtasticjs) ![Tree Shakeable](https://badgen.net/bundlephobia/tree-shaking/@meshtastic/meshtasticjs) | ||
@@ -23,3 +23,3 @@ ## Overview | ||
#### Usage | ||
### Usage | ||
@@ -106,2 +106,2 @@ The library has a built in connection manager that will handle multiple devices of different connection types. | ||
![](https://caniuse.bitsofco.de/image/web-bluetooth.png) | ||
![Bluetooth compatability matrix](https://caniuse.bitsofco.de/image/web-bluetooth.png) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9
192735
2974