MeshCoreSession
Defined in: src/session/session.ts:140
The protocol session core: owns the inbound-frame ingest, the reply- correlation FIFOs (ack + typed), the handshake, the liveness poll, and the transport-state lifecycle. Feature modules receive a FeatureContext bound to this session and own their own wire codes via the registry.
Ported verbatim from the donor ProtocolSession; the ~60 user-facing command
methods are layered on in a later task.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MeshCoreSession(opts): MeshCoreSession;Defined in: src/session/session.ts:210
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | MeshCoreSessionOptions |
Returns
Section titled “Returns”MeshCoreSession
Properties
Section titled “Properties”readonly admin: AdminSessionStore;Defined in: src/session/session.ts:150
Repeater admin auth + pending-request store.
events
Section titled “events”readonly events: Events;Defined in: src/session/session.ts:146
Typed event bus the session and consumers subscribe to.
readonly log: Logger;Defined in: src/session/session.ts:152
Structured logger (defaults to no-op).
readonly rt: SessionRuntime;Defined in: src/session/session.ts:154
Per-session mutable feature state.
readonly state: SessionState;Defined in: src/session/session.ts:148
In-memory session model.
Methods
Section titled “Methods”addContactToRadio()
Section titled “addContactToRadio()”addContactToRadio(publicKeyHex): Promise<void>;Defined in: src/session/session.ts:913
Commit a discovered contact to the radio’s store (CMD_ADD_UPDATE_CONTACT). Awaits the radio’s RESP_OK/ERR before marking the contact on-radio.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
publicKeyHex | string |
Returns
Section titled “Returns”Promise<void>
clearDefaultFloodScope()
Section titled “clearDefaultFloodScope()”clearDefaultFloodScope(): Promise<void>;Defined in: src/session/session.ts:1417
Clear the persisted default flood scope.
Returns
Section titled “Returns”Promise<void>
deriveSecret()
Section titled “deriveSecret()”deriveSecret(name): string;Defined in: src/session/session.ts:1129
Derive the 16-byte secret for a public/hashtag channel by name. Callers supplying their own secret (e.g. private channel imported from a share link) should pass it directly to setChannel instead.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
Returns
Section titled “Returns”string
exportContact()
Section titled “exportContact()”exportContact(destPublicKeyHex?): Promise<string | null>;Defined in: src/session/session.ts:1512
Export an advert blob for the device (no arg) or a known contact, or null when the contact isn’t found.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
destPublicKeyHex? | string |
Returns
Section titled “Returns”Promise<string | null>
exportPrivateKey()
Section titled “exportPrivateKey()”exportPrivateKey(): Promise<string>;Defined in: src/session/session.ts:1440
Export the device’s 64-byte private key (hex). Rejects FeatureDisabledError on a firmware build with private-key export compiled out.
Returns
Section titled “Returns”Promise<string>
factoryReset()
Section titled “factoryReset()”factoryReset(): Promise<void>;Defined in: src/session/session.ts:1457
Wipe the device to factory state. The link drops mid-reset, so there is no reply to await (like reboot()).
Returns
Section titled “Returns”Promise<void>
findChannelByName()
Section titled “findChannelByName()”findChannelByName(name): | Channel | null;Defined in: src/session/session.ts:1043
Find a channel in current session state by exact name, or null.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
Returns
Section titled “Returns”| Channel
| null
findChannelBySecret()
Section titled “findChannelBySecret()”findChannelBySecret(secretHex): | Channel | null;Defined in: src/session/session.ts:1049
Find a channel by its secret (hex, case-insensitive exact match). A mismatched-length input simply returns null (no validation).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
secretHex | string |
Returns
Section titled “Returns”| Channel
| null
findContactByName()
Section titled “findContactByName()”findContactByName(name): | Contact | null;Defined in: src/session/session.ts:1030
Find a contact in current session state by exact display name, or null.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
Returns
Section titled “Returns”| Contact
| null
findContactByPublicKeyPrefix()
Section titled “findContactByPublicKeyPrefix()”findContactByPublicKeyPrefix(prefixHex): | Contact | null;Defined in: src/session/session.ts:1036
Find a contact whose public key starts with the given hex prefix (case-insensitive), or null.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
prefixHex | string |
Returns
Section titled “Returns”| Contact
| null
getAdvertPath()
Section titled “getAdvertPath()”getAdvertPath(contactKey): Promise< | AdvertPath| null>;Defined in: src/session/session.ts:1477
The device’s cached advert path for a contact, or null when none is cached.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<
| AdvertPath
| null>
getAllowedRepeatFreq()
Section titled “getAllowedRepeatFreq()”getAllowedRepeatFreq(): Promise<RepeatFreqRange[]>;Defined in: src/session/session.ts:1432
The frequency ranges the radio is allowed to repeat on (region-dependent).
Returns
Section titled “Returns”Promise<RepeatFreqRange[]>
getChannel()
Section titled “getChannel()”getChannel(idx): Promise< | Channel| null>;Defined in: src/session/session.ts:1094
Actively re-query a single channel slot. Intended for use while connected; on a dead link it resolves only after the watchdog/request timeout.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
idx | number |
Returns
Section titled “Returns”Promise<
| Channel
| null>
getChannels()
Section titled “getChannels()”getChannels(): Promise<Channel[]>;Defined in: src/session/session.ts:1083
Actively re-enumerate channel slots (GET_CHANNEL 0..N-1) and resolve the fresh list. Intended for use while connected; on a dead link it resolves only after the watchdog/request timeout.
Returns
Section titled “Returns”Promise<Channel[]>
getContactByKey()
Section titled “getContactByKey()”getContactByKey(destPublicKeyHex): Promise< | ContactRecord| null>;Defined in: src/session/session.ts:1025
Look up a single contact on the radio by public key, or null if absent.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
destPublicKeyHex | string |
Returns
Section titled “Returns”Promise<
| ContactRecord
| null>
getContacts()
Section titled “getContacts()”getContacts(): Promise<Contact[]>;Defined in: src/session/session.ts:1069
Actively re-enumerate the radio’s contact store (GET_CONTACTS) and resolve the fresh list. Reuses the handshake’s contact-stream waiters. Intended for use while connected; on a dead link it resolves only after the watchdog/request timeout.
Returns
Section titled “Returns”Promise<Contact[]>
getDefaultFloodScope()
Section titled “getDefaultFloodScope()”getDefaultFloodScope(): Promise< | DefaultFloodScope| null>;Defined in: src/session/session.ts:1422
Read the persisted default flood scope, or null when none is set.
Returns
Section titled “Returns”Promise<
| DefaultFloodScope
| null>
getDevicePresence()
Section titled “getDevicePresence()”getDevicePresence(): string[];Defined in: src/session/session.ts:581
Snapshot of channel keys currently present on the radio. Empty when the transport is disconnected.
Returns
Section titled “Returns”string[]
getDeviceTime()
Section titled “getDeviceTime()”getDeviceTime(): Promise<number>;Defined in: src/session/session.ts:1372
Read the radio’s RTC clock (unix seconds).
Returns
Section titled “Returns”Promise<number>
getSelfInfo()
Section titled “getSelfInfo()”getSelfInfo(): Promise<SelfInfo>;Defined in: src/session/session.ts:1057
Actively re-query the radio’s self-info (APP_START → RESP_SELF_INFO), publish it as the Owner, and return it. Intended for use while connected; on a dead link it resolves only after the watchdog/request timeout.
Returns
Section titled “Returns”Promise<SelfInfo>
getSyncProgress()
Section titled “getSyncProgress()”getSyncProgress(): SyncProgress;Defined in: src/session/session.ts:586
Snapshot of handshake progress.
Returns
Section titled “Returns”getTransportState()
Section titled “getTransportState()”getTransportState(): TransportState;Defined in: src/session/session.ts:276
Current transport connection state.
Returns
Section titled “Returns”getTuningParams()
Section titled “getTuningParams()”getTuningParams(): Promise<TuningParams>;Defined in: src/session/session.ts:1390
Read the radio airtime/backoff tuning params (CMD_GET_TUNING_PARAMS).
Returns
Section titled “Returns”Promise<TuningParams>
hasConnection()
Section titled “hasConnection()”hasConnection(destPublicKeyHex): Promise<boolean>;Defined in: src/session/session.ts:1427
Whether the radio reports an active connection to a node.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
destPublicKeyHex | string |
Returns
Section titled “Returns”Promise<boolean>
importContact()
Section titled “importContact()”importContact(blobHex): Promise<void>;Defined in: src/session/session.ts:1517
Import a contact from a serialized advert blob (CMD_IMPORT_CONTACT).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
blobHex | string |
Returns
Section titled “Returns”Promise<void>
importPrivateKey()
Section titled “importPrivateKey()”importPrivateKey(privKeyHex): Promise<void>;Defined in: src/session/session.ts:1446
Import a 64-byte private key (hex), replacing the device identity. Rejects ProtocolError on a bad key / FS error.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
privKeyHex | string |
Returns
Section titled “Returns”Promise<void>
markChannelAbsent()
Section titled “markChannelAbsent()”markChannelAbsent(idx): void;Defined in: src/session/session.ts:1117
Mark a slot as no longer on the device (paired with a zero-key write). Frees the slot for pickFreeSlot and clears the presence flag.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
idx | number |
Returns
Section titled “Returns”void
markChannelPresent()
Section titled “markChannelPresent()”markChannelPresent(channel): void;Defined in: src/session/session.ts:1111
Mark a channel as present on the device. Call after a successful SET_CHANNEL ack — the firmware doesn’t echo CHANNEL_INFO back, so without this the new channel would stay grayed-out in the UI until the next full re-enumeration.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
channel | Channel |
Returns
Section titled “Returns”void
pickFreeSlot()
Section titled “pickFreeSlot()”pickFreeSlot(): number | null;Defined in: src/session/session.ts:1122
Lowest unused slot index in 0..15, or null if all 16 are taken.
Returns
Section titled “Returns”number | null
reboot()
Section titled “reboot()”reboot(): Promise<{ error?: string; ok: boolean;}>;Defined in: src/session/session.ts:1317
Reboot the connected device. The link drops within a few hundred ms; the transport state machine will reflect that via its own state push.
Returns
Section titled “Returns”Promise<{
error?: string;
ok: boolean;
}>
registerChannelSend()
Section titled “registerChannelSend()”registerChannelSend(params): void;Defined in: src/session/session.ts:805
Track an outgoing channel send so heard repeater relays (0x88) are
attributed back to it (emits ‘messagePathHeard’). Call after sendChannelText
returns, passing your message id along with the channelHash and
timestampUnix it handed back.
Passing timestampUnix is strongly recommended: the firmware encrypts it
into the packet, so it identifies the exact send a relay belongs to.
Without it, attribution falls back to a heuristic that cannot reliably
tell two sends on the same channel apart.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { channelHash: number; messageId: string; sentAt?: number; timestampUnix?: number; } |
params.channelHash | number |
params.messageId | string |
params.sentAt? | number |
params.timestampUnix? | number |
Returns
Section titled “Returns”void
removeContactFromRadio()
Section titled “removeContactFromRadio()”removeContactFromRadio(publicKeyHex): Promise<void>;Defined in: src/session/session.ts:966
Delete a contact from the radio’s store (CMD_REMOVE_CONTACT). Keeps it in the discovered pool, flagged off-radio.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
publicKeyHex | string |
Returns
Section titled “Returns”Promise<void>
repeaterGetLocalStats()
Section titled “repeaterGetLocalStats()”repeaterGetLocalStats(subtype): Promise<LocalStats>;Defined in: src/session/session.ts:1615
CMD_GET_STATS — local stats for the directly-connected device.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
subtype | "CORE" | "RADIO" | "PACKETS" |
Returns
Section titled “Returns”Promise<LocalStats>
repeaterLogin()
Section titled “repeaterLogin()”repeaterLogin(contactKey, password): Promise<LoginSuccess & object>;Defined in: src/session/session.ts:1538
Login to a repeater via CMD_SEND_LOGIN — the radio routes it (direct when
the contact’s out_path is known, flood otherwise). An empty password is a
guest login. Returns the effective mode so the UI can label the toast
(Direct / Flood / N-hop).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
password | string |
Returns
Section titled “Returns”Promise<LoginSuccess & object>
repeaterLogout()
Section titled “repeaterLogout()”repeaterLogout(contactKey): Promise<void>;Defined in: src/session/session.ts:1545
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<void>
repeaterRequestAcl()
Section titled “repeaterRequestAcl()”repeaterRequestAcl(contactKey): Promise<AclEntry[]>;Defined in: src/session/session.ts:1550
Request the ACL list. Admin-only (firmware returns nothing if guest).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<AclEntry[]>
repeaterRequestAvgMinMax()
Section titled “repeaterRequestAvgMinMax()”repeaterRequestAvgMinMax(contactKey, opts): Promise<AvgMinMaxResult>;Defined in: src/session/session.ts:1592
Request a min/max/avg series window from a sensor contact.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
opts | { endSecsAgo: number; startSecsAgo: number; } |
opts.endSecsAgo | number |
opts.startSecsAgo | number |
Returns
Section titled “Returns”Promise<AvgMinMaxResult>
repeaterRequestClock()
Section titled “repeaterRequestClock()”repeaterRequestClock(contactKey): Promise<number>;Defined in: src/session/session.ts:1580
Public anon CLOCK request — the repeater’s RTC clock (unix seconds).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<number>
repeaterRequestNeighbours()
Section titled “repeaterRequestNeighbours()”repeaterRequestNeighbours(contactKey, opts?): Promise<NeighboursPage>;Defined in: src/session/session.ts:1554
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
opts | { count?: number; offset?: number; orderBy?: number; prefixLen?: number; } |
opts.count? | number |
opts.offset? | number |
opts.orderBy? | number |
opts.prefixLen? | number |
Returns
Section titled “Returns”Promise<NeighboursPage>
repeaterRequestOwnerInfo()
Section titled “repeaterRequestOwnerInfo()”repeaterRequestOwnerInfo(contactKey): Promise< | OwnerInfo| null>;Defined in: src/session/session.ts:1563
Fetch a repeater’s owner info via the PUBLIC anon OWNER request (works without a login). Returns null if the response can’t be parsed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<
| OwnerInfo
| null>
repeaterRequestRegions()
Section titled “repeaterRequestRegions()”repeaterRequestRegions(contactKey): Promise<string>;Defined in: src/session/session.ts:1575
Public anon REGIONS request — the repeater’s region-name listing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<string>
repeaterSendCli()
Section titled “repeaterSendCli()”repeaterSendCli( contactKey, command,opts?): Promise<string>;Defined in: src/session/session.ts:1605
Send a remote CLI command; the reply is routed back by sender prefix.
Pass { expectReply: false } for the commands the firmware never answers
(reboot, poweroff, clkreboot, start ota) — those resolve '' as
soon as the radio confirms the send. timeoutMs and signal bound the
wait; the defaults are Models.CLI_REPLY_TIMEOUT_MS and
Models.ADMIN_SENT_TIMEOUT_MS.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
command | string |
opts | RepeaterCliOptions |
Returns
Section titled “Returns”Promise<string>
repeaterTracePath()
Section titled “repeaterTracePath()”repeaterTracePath(opts): Promise<TraceData>;Defined in: src/session/session.ts:1610
CMD_SEND_TRACE_PATH — diagnostic trace along a known path.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | { authCode: number; flags?: number; pathHex: string; tag: number; } |
opts.authCode | number |
opts.flags? | number |
opts.pathHex | string |
opts.tag | number |
Returns
Section titled “Returns”Promise<TraceData>
requestAutoAddConfig()
Section titled “requestAutoAddConfig()”requestAutoAddConfig(): Promise<void>;Defined in: src/session/session.ts:1280
Ask the radio for its current auto-add flags. RESP_AUTOADD_CONFIG lands in the feature handler → updates state + emits.
Returns
Section titled “Returns”Promise<void>
requestBattAndStorage()
Section titled “requestBattAndStorage()”requestBattAndStorage(): Promise<void>;Defined in: src/session/session.ts:1328
Query battery + storage. Replies land in onPacket and update DeviceInfo.
Returns
Section titled “Returns”Promise<void>
requestCustomVars()
Section titled “requestCustomVars()”requestCustomVars(key?): Promise<void>;Defined in: src/session/session.ts:1349
Query the firmware’s custom-var store (“gps”, “gps_interval”, etc.). Empty key requests all known keys. Reply: RESP_CUSTOM_VARS.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
key | string | '' |
Returns
Section titled “Returns”Promise<void>
requestDeviceInfo()
Section titled “requestDeviceInfo()”requestDeviceInfo(): Promise<void>;Defined in: src/session/session.ts:1338
Re-issue DEVICE_QUERY to refresh DeviceInfo + capabilities.
Returns
Section titled “Returns”Promise<void>
resetContactPath()
Section titled “resetContactPath()”resetContactPath(contactKey): Promise<void>;Defined in: src/session/session.ts:893
Drop a contact’s path back to flood. Mirrors CMD_RESET_PATH.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<void>
sendAnonReq()
Section titled “sendAnonReq()”sendAnonReq(contactKey, anonType): Promise<Buffer<ArrayBufferLike>>;Defined in: src/session/session.ts:1570
Low-level public anon request (CMD_SEND_ANON_REQ). anonType is one of
Protocol.ANON_REQ_TYPE (REGIONS=1, OWNER=2, BASIC/CLOCK=3). Resolves the
tagged response body. Prefer the typed wrappers below where they exist.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
anonType | number |
Returns
Section titled “Returns”Promise<Buffer<ArrayBufferLike>>
sendBinaryRequest()
Section titled “sendBinaryRequest()”sendBinaryRequest( contactKey, reqData,opts?): Promise<Buffer<ArrayBufferLike>>;Defined in: src/session/session.ts:1587
Send a generic binary request to a contact and resolve the raw response
body. reqData is [REQ_TYPE byte, …params]. The ACL/neighbours/owner/
avg-min-max helpers are thin wrappers over this.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
reqData | Buffer |
opts | { timeoutMs?: number; } |
opts.timeoutMs? | number |
Returns
Section titled “Returns”Promise<Buffer<ArrayBufferLike>>
sendChannelData()
Section titled “sendChannelData()”sendChannelData(opts): Promise<void>;Defined in: src/session/session.ts:1494
Broadcast a group-channel datagram (CMD_SEND_CHANNEL_DATA, flood).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | { channelIdx: number; dataType: number; payload: Buffer; } |
opts.channelIdx | number |
opts.dataType | number |
opts.payload | Buffer |
Returns
Section titled “Returns”Promise<void>
sendChannelText()
Section titled “sendChannelText()”sendChannelText(channelKey, text): Promise<{ channelHash?: number; error?: string; ok: boolean; timestampUnix?: number;}>;Defined in: src/session/session.ts:822
Returns ok on transport-level write success. When ok, channelHash is
the byte the firmware tags GRP_TXT packets with on this channel and
timestampUnix is the timestamp encrypted into the outgoing packet.
Pass both to registerChannelSend so subsequent PUSH_CODE_LOG_RX_DATA
observations can be attributed back to this message (repeater relays we
hear over the air).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
channelKey | string |
text | string |
Returns
Section titled “Returns”Promise<{
channelHash?: number;
error?: string;
ok: boolean;
timestampUnix?: number;
}>
sendControlData()
Section titled “sendControlData()”sendControlData(payload): Promise<void>;Defined in: src/session/session.ts:1489
Send a zero-hop control datagram (CMD_SEND_CONTROL_DATA).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
payload | Buffer |
Returns
Section titled “Returns”Promise<void>
sendDmText()
Section titled “sendDmText()”sendDmText( contactKey, text, messageId, opts?): Promise<{ error?: string; ok: boolean;}>;Defined in: src/session/session.ts:832
Send a DM to a contact. Returns ok on transport-level write success; the message state machine continues asynchronously: RESP_SENT flips ‘sending’ → ‘sent’, PUSH_SEND_CONFIRMED flips ‘sent’ → ‘ack’.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
text | string |
messageId | string |
opts | { attempt?: number; } |
opts.attempt? | number |
Returns
Section titled “Returns”Promise<{
error?: string;
ok: boolean;
}>
sendDmTextWithRetry()
Section titled “sendDmTextWithRetry()”sendDmTextWithRetry( contactKey, text, messageId): Promise<{ error?: string; ok: boolean;}>;Defined in: src/session/session.ts:843
Send a DM with retry + flood fallback, mirroring the official client’s behavior.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
text | string |
messageId | string |
Returns
Section titled “Returns”Promise<{
error?: string;
ok: boolean;
}>
sendPathDiscoveryReq()
Section titled “sendPathDiscoveryReq()”sendPathDiscoveryReq(contactKey): Promise<DiscoveredPath>;Defined in: src/session/session.ts:1472
Discover the round-trip mesh path to a contact (floods a request, then awaits PUSH_PATH_DISCOVERY_RESPONSE). Rejects on dispatch error/timeout.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<DiscoveredPath>
sendRawData()
Section titled “sendRawData()”sendRawData(opts): Promise<void>;Defined in: src/session/session.ts:1484
Send raw bytes DIRECT along a known path (CMD_SEND_RAW_DATA).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | { pathHex: string; payload: Buffer; } |
opts.pathHex | string |
opts.payload | Buffer |
Returns
Section titled “Returns”Promise<void>
sendRawPacket()
Section titled “sendRawPacket()”sendRawPacket(opts): Promise<void>;Defined in: src/session/session.ts:1499
Transmit a fully-formed mesh packet (CMD_SEND_RAW_PACKET).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | { packetHex: string; priority: number; } |
opts.packetHex | string |
opts.priority | number |
Returns
Section titled “Returns”Promise<void>
sendSelfAdvert()
Section titled “sendSelfAdvert()”sendSelfAdvert(flood?): Promise<{ error?: string; ok: boolean;}>;Defined in: src/session/session.ts:1360
Send a self-advert. flood=true propagates many hops (so DM-able by
distant peers); flood=false is zero-hop (cheap, only direct neighbors).
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
flood | boolean | true |
Returns
Section titled “Returns”Promise<{
error?: string;
ok: boolean;
}>
sendStatusReq()
Section titled “sendStatusReq()”sendStatusReq(contactKey): Promise<{ error?: string; ok: boolean;}>;Defined in: src/session/session.ts:1525
Request a status snapshot from a repeater/room/contact. The actual snapshot arrives later via PUSH_STATUS_RESPONSE → emit.repeaterStatus().
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<{
error?: string;
ok: boolean;
}>
sendTelemetryReq()
Section titled “sendTelemetryReq()”sendTelemetryReq(contactKey): Promise<{ error?: string; ok: boolean;}>;Defined in: src/session/session.ts:1530
Request a CayenneLPP telemetry blob from a contact. See sendStatusReq.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
Returns
Section titled “Returns”Promise<{
error?: string;
ok: boolean;
}>
setAdvertLatLon()
Section titled “setAdvertLatLon()”setAdvertLatLon( lat, lon,alt?): Promise<boolean>;Defined in: src/session/session.ts:1219
Push device GPS coords used in self-adverts.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
lat | number |
lon | number |
alt? | number |
Returns
Section titled “Returns”Promise<boolean>
setAdvertName()
Section titled “setAdvertName()”setAdvertName(name): Promise<boolean>;Defined in: src/session/session.ts:1194
Push the device’s advertised display name.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
Returns
Section titled “Returns”Promise<boolean>
setAutoAddConfig()
Section titled “setAutoAddConfig()”setAutoAddConfig(flags): Promise<boolean>;Defined in: src/session/session.ts:1273
Push the auto-add flags byte. App-side mode/maxHops/pullToRefresh/
showPublicKeys are stored locally and don’t go on the wire.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
flags | AutoAddFlagsInput |
Returns
Section titled “Returns”Promise<boolean>
setChannel()
Section titled “setChannel()”setChannel( idx, name,secretHex): Promise<boolean>;Defined in: src/session/session.ts:1103
Write a channel slot (add / edit / delete). Delete = empty name + zero
key, which our enumerator filters as empty. Returns true if the radio
acked, false on RESP_ERR / timeout / disconnect.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
idx | number |
name | string |
secretHex | string |
Returns
Section titled “Returns”Promise<boolean>
setContactFavourite()
Section titled “setContactFavourite()”setContactFavourite(publicKeyHex, favourite): Promise<void>;Defined in: src/session/session.ts:976
Toggle the favourite flag (contact flags bit 0). For on-radio contacts, round-trips CMD_ADD_UPDATE_CONTACT so the firmware persists the flag (protects from overwrite-oldest). Discovered-only contacts update locally.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
publicKeyHex | string |
favourite | boolean |
Returns
Section titled “Returns”Promise<void>
setContactPath()
Section titled “setContactPath()”setContactPath( contactKey, outPathHex,opts?): Promise<void>;Defined in: src/session/session.ts:853
Write a contact’s out_path back to the radio so the firmware uses it for
future source-routed sends. Round-trips the contact’s current type/flags/
name (firmware replaces on update, not merges). On RESP_OK, updates
local state with the new path + pathManual.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
outPathHex | string |
opts | { manual: boolean; preferDirect?: boolean; } |
opts.manual | boolean |
opts.preferDirect? | boolean |
Returns
Section titled “Returns”Promise<void>
setContactPreferDirect()
Section titled “setContactPreferDirect()”setContactPreferDirect(contactKey, preferDirect): void;Defined in: src/session/session.ts:1007
Toggle the per-contact “always use direct (companion-side) login” flag. Local-only; no firmware write.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contactKey | string |
preferDirect | boolean |
Returns
Section titled “Returns”void
setDefaultFloodScope()
Section titled “setDefaultFloodScope()”setDefaultFloodScope(name, keyHex): Promise<void>;Defined in: src/session/session.ts:1412
Persist the default flood scope (CMD_SET_DEFAULT_FLOOD_SCOPE).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
keyHex | string |
Returns
Section titled “Returns”Promise<void>
setDevicePin()
Section titled “setDevicePin()”setDevicePin(pin): Promise<void>;Defined in: src/session/session.ts:1451
Set the BLE pairing PIN (0 disables it; otherwise a 6-digit number).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
pin | number |
Returns
Section titled “Returns”Promise<void>
setDeviceTime()
Section titled “setDeviceTime()”setDeviceTime(epochSecs): Promise<void>;Defined in: src/session/session.ts:1378
Set the radio’s RTC clock (unix seconds). Rejects ProtocolError if the radio returns RESP_ERR (e.g. a clock earlier than its own → ILLEGAL_ARG).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
epochSecs | number |
Returns
Section titled “Returns”Promise<void>
setFloodScopeKey()
Section titled “setFloodScopeKey()”setFloodScopeKey(input): Promise<void>;Defined in: src/session/session.ts:1400
Override the send-scope key for outgoing flood packets (set / clear / unscoped).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input | FloodScopeInput |
Returns
Section titled “Returns”Promise<void>
setFloodScopeRegion()
Section titled “setFloodScopeRegion()”setFloodScopeRegion(region): Promise<void>;Defined in: src/session/session.ts:1407
Derive the 16-byte scope key for a public hashtag region (SHA-256(“#name”)[:16])
and set it as the send-scope override. Equivalent to
setFloodScopeKey({ keyHex: deriveFloodScopeKey(region) }).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
region | string |
Returns
Section titled “Returns”Promise<void>
setGpsConfig()
Section titled “setGpsConfig()”setGpsConfig(cfg): Promise<boolean>;Defined in: src/session/session.ts:1287
Toggle the GPS module / change interval via custom-var KV. The firmware ignores intervals outside [60, 86399]; we clamp client-side too.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cfg | { enabled: boolean; intervalSec: number; } |
cfg.enabled | boolean |
cfg.intervalSec | number |
Returns
Section titled “Returns”Promise<boolean>
setOtherParams()
Section titled “setOtherParams()”setOtherParams(policy, sharePositionInAdvert): Promise<boolean>;Defined in: src/session/session.ts:1240
Push telemetry policy + multi-acks + advert-location-policy as one frame.
The advert-location-policy flag mirrors DeviceIdentity.sharePositionInAdvert
and TelemetryPolicy fields drive the rest.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
policy | { base: 0 | 1 | 2; env: 0 | 1 | 2; loc: 0 | 1 | 2; multiAcks: number; } |
policy.base | 0 | 1 | 2 |
policy.env | 0 | 1 | 2 |
policy.loc | 0 | 1 | 2 |
policy.multiAcks | number |
sharePositionInAdvert | boolean |
Returns
Section titled “Returns”Promise<boolean>
setPathHashMode()
Section titled “setPathHashMode()”setPathHashMode(size): Promise<void>;Defined in: src/session/session.ts:1016
Set the radio’s global path-hash mode (bytes per hop). Persists on the radio and updates local RadioSettings on RESP_OK.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
size | 1 | 2 | 3 |
Returns
Section titled “Returns”Promise<void>
setRadioParams()
Section titled “setRadioParams()”setRadioParams(opts): Promise<boolean>;Defined in: src/session/session.ts:1139
Push LoRa modulation params (freq/bw/sf/cr) and TX power to the radio.
Sent as two separate frames since the firmware splits them. Includes the
trailing clientRepeat byte only when the connected firmware supports it
(ver_code ≥ 9 — surfaced via DeviceCapabilities.repeatMode).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | { bandwidthHz: number; codingRate: number; frequencyHz: number; repeatMode: boolean; spreadingFactor: number; txPowerDbm: number; } |
opts.bandwidthHz | number |
opts.codingRate | number |
opts.frequencyHz | number |
opts.repeatMode | boolean |
opts.spreadingFactor | number |
opts.txPowerDbm | number |
Returns
Section titled “Returns”Promise<boolean>
setTuningParams()
Section titled “setTuningParams()”setTuningParams(params): Promise<void>;Defined in: src/session/session.ts:1395
Write the radio airtime/backoff tuning params (CMD_SET_TUNING_PARAMS).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | TuningParams |
Returns
Section titled “Returns”Promise<void>
shareContact()
Section titled “shareContact()”shareContact(destPublicKeyHex): Promise<void>;Defined in: src/session/session.ts:1506
Re-broadcast a known contact’s advert zero-hop (CMD_SHARE_CONTACT).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
destPublicKeyHex | string |
Returns
Section titled “Returns”Promise<void>
signData()
Section titled “signData()”signData(data): Promise<string>;Defined in: src/session/session.ts:1464
Sign arbitrary bytes with the device’s ed25519 identity. Drives the CMD_SIGN_START → CMD_SIGN_DATA× → CMD_SIGN_FINISH state machine and returns the 64-byte signature (hex).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | Buffer |
Returns
Section titled “Returns”Promise<string>
start()
Section titled “start()”start(): void;Defined in: src/session/session.ts:230
Returns
Section titled “Returns”void
stop()
Section titled “stop()”stop(): void;Defined in: src/session/session.ts:260
Returns
Section titled “Returns”void
syncDeviceTime()
Section titled “syncDeviceTime()”syncDeviceTime(): Promise<void>;Defined in: src/session/session.ts:1383
Push the host’s current time to the radio.
Returns
Section titled “Returns”Promise<void>