@meshtastic/meshtasticjs
Advanced tools
Comparing version 0.3.6 to 0.4.0
import { NodeDB } from "./nodedb"; | ||
import { FromRadio, MeshPacket, MyNodeInfo, RadioConfig, TypeEnum, User } from "./protobuf"; | ||
import { FromRadio, MeshPacket, MyNodeInfo, RadioConfig, PortNumEnum, User } from "./protobuf"; | ||
import { IEmitOptions, SubEvent } from "sub-events"; | ||
@@ -122,3 +122,3 @@ /** | ||
*/ | ||
sendData(byteData: Uint8Array, dataType: TypeEnum, destinationNum?: number, wantAck?: boolean, wantResponse?: boolean): Promise<void>; | ||
sendData(byteData: Uint8Array, dataType: PortNumEnum, destinationNum?: number, wantAck?: boolean, wantResponse?: boolean): Promise<void>; | ||
/** | ||
@@ -125,0 +125,0 @@ * Sends position over the radio |
import { NodeDB } from "./nodedb"; | ||
import { ChannelSettings, Data, FromRadio, MeshPacket, Position, SubPacket, ToRadio, TypeEnum, UserPreferences, } from "./protobuf"; | ||
import { ChannelSettings, Data, FromRadio, MeshPacket, Position, SubPacket, ToRadio, PortNumEnum, UserPreferences, } from "./protobuf"; | ||
import { debugLog } from "./utils"; | ||
@@ -80,3 +80,3 @@ import { DebugLevelEnum } from "./settingsmanager"; | ||
const enc = new TextEncoder(); | ||
return this.sendData(enc.encode(text), TypeEnum.CLEAR_TEXT, destinationNum, wantAck, wantResponse); | ||
return this.sendData(enc.encode(text), PortNumEnum.TEXT_MESSAGE_APP, destinationNum, wantAck, wantResponse); | ||
} | ||
@@ -96,3 +96,3 @@ /** | ||
payload: byteData, | ||
typ: dataType, | ||
portnum: dataType, | ||
}), | ||
@@ -294,8 +294,7 @@ wantResponse, | ||
if (meshPacket.decoded.hasOwnProperty("data")) { | ||
if (!meshPacket.decoded.data.hasOwnProperty("typ")) { | ||
meshPacket.decoded.data.typ = TypeEnum.OPAQUE; | ||
if (!meshPacket.decoded.data.hasOwnProperty("portnum")) { | ||
meshPacket.decoded.data.portnum = PortNumEnum.UNKNOWN_APP; | ||
} | ||
let pckDat = meshPacket.decoded.data; | ||
if (pckDat.typ === TypeEnum.CLEAR_TEXT || | ||
pckDat.typ === TypeEnum.CLEAR_READACK) { | ||
if (pckDat.portnum === PortNumEnum.TEXT_MESSAGE_APP) { | ||
pckDat.payload = new TextDecoder().decode(pckDat.payload); | ||
@@ -302,0 +301,0 @@ } |
@@ -0,6 +1,14 @@ | ||
/** | ||
* Current as of Meshtastic-protobufs #8729bad7f6cfa461be02e3ea65fbde29435b3fe3 | ||
*/ | ||
import { Message } from "protobufjs/light"; | ||
export declare enum TypeEnum { | ||
OPAQUE = 0, | ||
CLEAR_TEXT = 1, | ||
CLEAR_READACK = 2 | ||
export declare enum PortNumEnum { | ||
UNKNOWN_APP = 0, | ||
TEXT_MESSAGE_APP = 1, | ||
REMOTE_HARDWARE_APP = 2, | ||
POSITION_APP = 3, | ||
NODEINFO_APP = 4, | ||
REPLY_APP = 32, | ||
PRIVATE_APP = 256, | ||
IP_TUNNEL_APP = 1024 | ||
} | ||
@@ -14,3 +22,4 @@ export declare enum RouteErrorEnum { | ||
export declare enum ConstantsEnum { | ||
Unused = 0 | ||
Unused = 0, | ||
DATA_PAYLOAD_LEN = 240 | ||
} | ||
@@ -59,3 +68,3 @@ export declare enum ModemConfigEnum { | ||
export declare class Data extends Message<Data> { | ||
typ: TypeEnum; | ||
portnum: PortNumEnum; | ||
payload: Uint8Array | string; | ||
@@ -85,4 +94,10 @@ } | ||
ack: number; | ||
/** | ||
* @deprecated | ||
*/ | ||
position: Position; | ||
data: Data; | ||
/** | ||
* @deprecated | ||
*/ | ||
user: User; | ||
@@ -152,3 +167,5 @@ routeRequest: RouteDiscovery; | ||
isLowPower: boolean; | ||
fixedPosition: boolean; | ||
factoryReset: boolean; | ||
debugLogEnabled: boolean; | ||
locationShare: LocationSharingEnum; | ||
@@ -155,0 +172,0 @@ gpsOperation: GpsOperationEnum; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Current as of Meshtastic-protobufs #8729bad7f6cfa461be02e3ea65fbde29435b3fe3 | ||
*/ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -8,8 +11,13 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
import { Message, Field, OneOf, Type } from "protobufjs/light"; | ||
export var TypeEnum; | ||
(function (TypeEnum) { | ||
TypeEnum[TypeEnum["OPAQUE"] = 0] = "OPAQUE"; | ||
TypeEnum[TypeEnum["CLEAR_TEXT"] = 1] = "CLEAR_TEXT"; | ||
TypeEnum[TypeEnum["CLEAR_READACK"] = 2] = "CLEAR_READACK"; | ||
})(TypeEnum || (TypeEnum = {})); | ||
export var PortNumEnum; | ||
(function (PortNumEnum) { | ||
PortNumEnum[PortNumEnum["UNKNOWN_APP"] = 0] = "UNKNOWN_APP"; | ||
PortNumEnum[PortNumEnum["TEXT_MESSAGE_APP"] = 1] = "TEXT_MESSAGE_APP"; | ||
PortNumEnum[PortNumEnum["REMOTE_HARDWARE_APP"] = 2] = "REMOTE_HARDWARE_APP"; | ||
PortNumEnum[PortNumEnum["POSITION_APP"] = 3] = "POSITION_APP"; | ||
PortNumEnum[PortNumEnum["NODEINFO_APP"] = 4] = "NODEINFO_APP"; | ||
PortNumEnum[PortNumEnum["REPLY_APP"] = 32] = "REPLY_APP"; | ||
PortNumEnum[PortNumEnum["PRIVATE_APP"] = 256] = "PRIVATE_APP"; | ||
PortNumEnum[PortNumEnum["IP_TUNNEL_APP"] = 1024] = "IP_TUNNEL_APP"; | ||
})(PortNumEnum || (PortNumEnum = {})); | ||
export var RouteErrorEnum; | ||
@@ -25,2 +33,3 @@ (function (RouteErrorEnum) { | ||
ConstantsEnum[ConstantsEnum["Unused"] = 0] = "Unused"; | ||
ConstantsEnum[ConstantsEnum["DATA_PAYLOAD_LEN"] = 240] = "DATA_PAYLOAD_LEN"; | ||
})(ConstantsEnum || (ConstantsEnum = {})); | ||
@@ -89,4 +98,4 @@ export var ModemConfigEnum; | ||
__decorate([ | ||
Field.d(1, TypeEnum) | ||
], Data.prototype, "typ", void 0); | ||
Field.d(1, PortNumEnum) | ||
], Data.prototype, "portnum", void 0); | ||
__decorate([ | ||
@@ -319,5 +328,11 @@ Field.d(2, "bytes") | ||
__decorate([ | ||
Field.d(39, "bool") | ||
], UserPreferences.prototype, "fixedPosition", void 0); | ||
__decorate([ | ||
Field.d(100, "bool") | ||
], UserPreferences.prototype, "factoryReset", void 0); | ||
__decorate([ | ||
Field.d(101, "bool") | ||
], UserPreferences.prototype, "debugLogEnabled", void 0); | ||
__decorate([ | ||
Field.d(32, LocationSharingEnum) | ||
@@ -324,0 +339,0 @@ ], UserPreferences.prototype, "locationShare", void 0); |
{ | ||
"name": "@meshtastic/meshtasticjs", | ||
"version": "0.3.6", | ||
"version": "0.4.0", | ||
"description": "browser library for interfacing with meshtastic devices", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
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
157354
2416