meshcore.js
ReferenceClasses

Radio

Defined in: packages/client/src/radio/radio.ts:77

client.radio: typed wrappers around the Companion commands (appStart, deviceQuery, getContacts, sendText, …), one request in flight at a time.

Extends

Constructors

Constructor

new Radio(transport, options?): Radio;

Defined in: packages/client/src/radio/radio.ts:84

Parameters

transport

Transport

Connected or not, the radio only writes frames

options?

RadioOptions = {}

timeoutMs per request. Default 5000

Returns

Radio

Overrides

TypedEmitter.constructor

Methods

appStart()

appStart(appName): Promise<SelfInfo>;

Defined in: packages/client/src/radio/radio.ts:106

Parameters

appName

string

Name announced to the radio

Returns

Promise<SelfInfo>


deviceQuery()

deviceQuery(): Promise<DeviceInfo>;

Defined in: packages/client/src/radio/radio.ts:114

Returns

Promise<DeviceInfo>


emit()

emit<K>(event, ...args): boolean;

Defined in: packages/transports/src/typed-emitter.ts:44

Type Parameters

K

K extends string

Parameters

event

K

Event name

args

...RadioEvents[K]

Event arguments

Returns

boolean

Inherited from

TypedEmitter.emit


exportSelfContact()

exportSelfContact(): Promise<{
  packet: Uint8Array;
  uri: string;
}>;

Defined in: packages/client/src/radio/radio.ts:209

Returns

Promise<{ packet: Uint8Array; uri: string; }>


getBattAndStorage()

getBattAndStorage(): Promise<BattAndStorageFrame>;

Defined in: packages/client/src/radio/radio.ts:201

Returns

Promise<BattAndStorageFrame>


getChannel()

getChannel(index): Promise<ChannelRecord | null>;

Defined in: packages/client/src/radio/radio.ts:175

Parameters

index

number

Channel slot

Returns

Promise<ChannelRecord | null>


getContactByKey()

getContactByKey(publicKey): Promise<ContactRecord | null>;

Defined in: packages/client/src/radio/radio.ts:151

Parameters

publicKey

string

Full public key in hex

Returns

Promise<ContactRecord | null>


getContacts()

getContacts(since?): Promise<ContactRecord[]>;

Defined in: packages/client/src/radio/radio.ts:133

Parameters

since?

number

Only contacts modified after this epoch

Returns

Promise<ContactRecord[]>


listenerCount()

listenerCount<K>(event): number;

Defined in: packages/transports/src/typed-emitter.ts:49

Type Parameters

K

K extends string

Parameters

event

K

Event name

Returns

number

Inherited from

TypedEmitter.listenerCount


off()

off<K>(event, listener): this;

Defined in: packages/transports/src/typed-emitter.ts:35

Type Parameters

K

K extends string

Parameters

event

K

Event name

listener

Listener<RadioEvents[K]>

Listener to remove

Returns

this

Inherited from

TypedEmitter.off


on()

on<K>(event, listener): this;

Defined in: packages/transports/src/typed-emitter.ts:17

Type Parameters

K

K extends string

Parameters

event

K

Event name

listener

Listener<RadioEvents[K]>

Called with the event arguments

Returns

this

Inherited from

TypedEmitter.on


once()

once<K>(event, listener): this;

Defined in: packages/transports/src/typed-emitter.ts:26

Type Parameters

K

K extends string

Parameters

event

K

Event name

listener

Listener<RadioEvents[K]>

Called once with the event arguments

Returns

this

Inherited from

TypedEmitter.once


removeAllListeners()

removeAllListeners<K>(event?): this;

Defined in: packages/transports/src/typed-emitter.ts:54

Type Parameters

K

K extends string

Parameters

event?

K

Event name, or every event when omitted

Returns

this

Inherited from

TypedEmitter.removeAllListeners


removeContact()

removeContact(publicKey): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:165

Parameters

publicKey

string

Full public key in hex

Returns

Promise<void>


reset()

reset(error): void;

Defined in: packages/client/src/radio/radio.ts:91

Parameters

error

Error

Rejects every pending request with it

Returns

void


resetPath()

resetPath(publicKey): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:170

Parameters

publicKey

string

Full public key in hex

Returns

Promise<void>


sendChannelText()

sendChannelText(params): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:233

Parameters

params

SendChannelTxtMsgParams

Channel slot, text and timestamp

Returns

Promise<void>


sendSelfAdvert()

sendSelfAdvert(flood): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:219

Parameters

flood

boolean

Flood the mesh instead of a zero-hop advert

Returns

Promise<void>


sendText()

sendText(params): Promise<SentFrame>;

Defined in: packages/client/src/radio/radio.ts:224

Parameters

params

SendTxtMsgParams

Recipient, text, timestamp and attempt

Returns

Promise<SentFrame>


setAdvertLatLon()

setAdvertLatLon(location): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:244

Parameters

location

Location

lat and lon in decimal degrees

Returns

Promise<void>


setAdvertName()

setAdvertName(name): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:238

Parameters

name

string

1 to 31 UTF-8 bytes

Returns

Promise<void>


setChannel()

setChannel(params): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:189

Parameters

params

SetChannelParams

Slot, name and secret

Returns

Promise<void>


setDeviceTime()

setDeviceTime(epochSeconds): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:123

Parameters

epochSeconds

number

Current time in seconds

Returns

Promise<void>


setRadioParams()

setRadioParams(params, options?): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:266

Parameters

params

RadioParams

frequency in MHz, bandwidth in kHz, spreadingFactor and codingRate

options?

repeat writes the repeater byte, firmware 9 and later

repeat?

boolean

Returns

Promise<void>


setTxPower()

setTxPower(dbm): Promise<void>;

Defined in: packages/client/src/radio/radio.ts:257

Parameters

dbm

number

9 to the radio maximum

Returns

Promise<void>


syncNextMessage()

syncNextMessage(): Promise<ContactMessageFrame | ChannelMessageFrame | null>;

Defined in: packages/client/src/radio/radio.ts:193

Returns

Promise<ContactMessageFrame | ChannelMessageFrame | null>

On this page