@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.6.13 to 0.6.14
@@ -121,31 +121,11 @@ import { Types } from "./"; | ||
}); | ||
this.device.addEventListener("gattserverdisconnected", () => { | ||
this.onDeviceStatusEvent.next(Types.DeviceStatusEnum.DEVICE_DISCONNECTED); | ||
if (!this.userInitiatedDisconnect) { | ||
if (this.deviceStatus !== Types.DeviceStatusEnum.DEVICE_RECONNECTING) { | ||
this.onDeviceStatusEvent.next(Types.DeviceStatusEnum.DEVICE_RECONNECTING); | ||
} | ||
} | ||
}); | ||
} | ||
// if ( | ||
// this.device && | ||
// this.deviceStatus > Types.DeviceStatusEnum.DEVICE_RECONNECTING | ||
// ) { | ||
// /** | ||
// * @todo look into the `advertisementreceived` event | ||
// */ | ||
// this.device.addEventListener("gattserverdisconnected", () => { | ||
// this.onDeviceStatusEvent.next( | ||
// Types.DeviceStatusEnum.DEVICE_DISCONNECTED | ||
// ); | ||
// if (!this.userInitiatedDisconnect) { | ||
// if ( | ||
// this.deviceStatus !== Types.DeviceStatusEnum.DEVICE_RECONNECTING | ||
// ) { | ||
// this.onDeviceStatusEvent.next( | ||
// Types.DeviceStatusEnum.DEVICE_RECONNECTING | ||
// ); | ||
// } | ||
// /** | ||
// * @replace with setInterval or setTimeout | ||
// */ | ||
// // setTimeout(() => { | ||
// // await this.connect(requestDeviceFilterParams); | ||
// // }, 10000); | ||
// } | ||
// }); | ||
// } | ||
} | ||
@@ -161,2 +141,3 @@ /** | ||
this.onDeviceStatusEvent.next(Types.DeviceStatusEnum.DEVICE_DISCONNECTED); | ||
this.complete(); | ||
} | ||
@@ -163,0 +144,0 @@ /** |
@@ -57,2 +57,3 @@ import { Types } from "./"; | ||
this.onDeviceStatusEvent.next(Types.DeviceStatusEnum.DEVICE_DISCONNECTED); | ||
this.complete(); | ||
} | ||
@@ -82,2 +83,19 @@ /** | ||
async readFromRadio() { | ||
// const response = ajax | ||
// .get<ArrayBuffer>( | ||
// `${this.url}/api/v1/fromradio?all=${this.receiveBatchRequests}`, | ||
// { | ||
// Accept: "application/x-protobuf" | ||
// } | ||
// ) | ||
// .pipe( | ||
// takeWhile((buffer) => buffer.response.byteLength > 0), | ||
// map((buffer) => { | ||
// this.onDeviceStatusEvent.next( | ||
// Types.DeviceStatusEnum.DEVICE_CONNECTED | ||
// ); | ||
// this.handleFromRadio(new Uint8Array(buffer.response, 0)); | ||
// }) | ||
// ); | ||
// new Observable().pipe(takeUntil(response)); | ||
let readBuffer = new ArrayBuffer(1); | ||
@@ -84,0 +102,0 @@ while (readBuffer.byteLength > 0) { |
@@ -103,3 +103,3 @@ import { Subject } from "rxjs"; | ||
*/ | ||
readonly onMeshHeartbeat: Subject<number>; | ||
readonly onMeshHeartbeat: Subject<Date>; | ||
/** | ||
@@ -130,3 +130,2 @@ * Sends a text over the radio | ||
* @param owner | ||
* @todo what is `confirmSetOwner`? | ||
*/ | ||
@@ -137,3 +136,2 @@ setOwner(owner: User): Promise<void>; | ||
* @param channel | ||
* @todo what is `confirmSetChannel`? | ||
*/ | ||
@@ -155,2 +153,6 @@ setChannelSettings(channel: Channel): Promise<void>; | ||
/** | ||
* Completes all subjects | ||
*/ | ||
complete(): void; | ||
/** | ||
* Gets called when a MeshPacket is received from device | ||
@@ -157,0 +159,0 @@ * @param meshPacket |
@@ -190,3 +190,2 @@ import { Subject } from "rxjs"; | ||
* @param owner | ||
* @todo what is `confirmSetOwner`? | ||
*/ | ||
@@ -205,3 +204,2 @@ async setOwner(owner) { | ||
* @param channel | ||
* @todo what is `confirmSetChannel`? | ||
*/ | ||
@@ -283,2 +281,19 @@ async setChannelSettings(channel) { | ||
/** | ||
* Completes all subjects | ||
*/ | ||
complete() { | ||
this.onFromRadioEvent.complete(); | ||
this.onMeshPacketEvent.complete(); | ||
this.onMyNodeInfoEvent.complete(); | ||
this.onRadioConfigEvent.complete(); | ||
this.onNodeInfoPacketEvent.complete(); | ||
this.onAdminPacketEvent.complete(); | ||
this.onRoutingPacketEvent.complete(); | ||
this.onPositionPacketEvent.complete(); | ||
this.onTextPacketEvent.complete(); | ||
this.onDeviceStatusEvent.complete(); | ||
this.onLogRecordEvent.complete(); | ||
this.onMeshHeartbeat.complete(); | ||
} | ||
/** | ||
* Gets called when a MeshPacket is received from device | ||
@@ -293,3 +308,3 @@ * @param meshPacket | ||
*/ | ||
this.onMeshHeartbeat.next(Date.now()); | ||
this.onMeshHeartbeat.next(new Date()); | ||
} | ||
@@ -296,0 +311,0 @@ if (meshPacket.payloadVariant.oneofKind === "decoded") { |
@@ -92,2 +92,3 @@ import { Types } from "./"; | ||
this.onDeviceStatusEvent.next(Types.DeviceStatusEnum.DEVICE_DISCONNECTED); | ||
this.complete(); | ||
} | ||
@@ -94,0 +95,0 @@ /** |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.6.13", | ||
"version": "0.6.14", | ||
"description": "Browser library for interfacing with meshtastic devices", | ||
@@ -23,18 +23,18 @@ "license": "GPL-3.0-only", | ||
"dependencies": { | ||
"@protobuf-ts/runtime": "^2.0.0-alpha.25", | ||
"rxjs": "^7.1.0" | ||
"@protobuf-ts/runtime": "^1.0.13", | ||
"rxjs": "^7.2.0" | ||
}, | ||
"devDependencies": { | ||
"@protobuf-ts/plugin": "^1.0.13", | ||
"@types/w3c-web-serial": "^1.0.1", | ||
"@types/web-bluetooth": "0.0.9", | ||
"@typescript-eslint/eslint-plugin": "^4.25.0", | ||
"@typescript-eslint/parser": "^4.25.0", | ||
"eslint": "^7.27.0", | ||
"@types/w3c-web-serial": "^1.0.2", | ||
"@types/web-bluetooth": "^0.0.10", | ||
"@typescript-eslint/eslint-plugin": "^4.28.2", | ||
"@typescript-eslint/parser": "^4.28.1", | ||
"eslint": "^7.30.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "^2.3.0", | ||
"typedoc": "^0.20.36", | ||
"typescript": "^4.3.2" | ||
"prettier": "^2.3.2", | ||
"typedoc": "^0.21.2", | ||
"typescript": "^4.3.5" | ||
}, | ||
@@ -41,0 +41,0 @@ "scripts": { |
# Meshtastic.js | ||
![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) | ||
[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/meshtastic/meshtastic.js) ![NPM](https://badgen.net/npm/v/@meshtastic/meshtasticjs) ![Downloads](https://badgen.net/npm/dt/@meshtastic/meshtasticjs) | ||
@@ -24,2 +24,28 @@ ## Overview | ||
## Development & Building | ||
The [Meshtastic Protobufs submodule](https://github.com/meshtastic/meshtastic-protobufs/) must be pulled, this can be done via: | ||
```bash | ||
git submodule update --init | ||
``` | ||
Then the type definitions need to be generated: | ||
```bash | ||
yarn generate:protobufs | ||
``` | ||
Finally the project can be built: | ||
```bash | ||
yarn build | ||
``` | ||
Optionally the doccumentation can be built with: | ||
```bash | ||
yarn generate:docs | ||
``` | ||
### Compatibility | ||
@@ -26,0 +52,0 @@ |
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
488584
7844
56
+ Added@protobuf-ts/runtime@1.0.13(transitive)
- Removed@protobuf-ts/runtime@2.9.4(transitive)
Updated@protobuf-ts/runtime@^1.0.13
Updatedrxjs@^7.2.0