Commands that read or configure the companion device itself.
Summary
Functions
Step 2 of a factory reset. Returns {:error, :invalid_token} if token does
not match the pending one.
Exports the device's private key (:private_key, or :disabled).
Frequency ranges in which repeating is allowed.
Reads battery level (and storage use on newer firmware).
Reads channel channel_idx (:channel_info).
Reads the custom variables (:custom_vars, a map of strings).
Reads the active path hash mode. Returns the integer directly (0 when the
device does not report one), like the Python method.
Reads the device's own telemetry (:telemetry_response).
Core statistics (battery, uptime, errors, queue length).
Packet counters.
Radio statistics (noise floor, RSSI, SNR, airtime).
Reads the device clock.
Reads RX delay and airtime factor (:tuning_params).
Checks whether the device has an active connection (CMD 28).
Imports a 64 byte private key.
Reboots the device. Fire-and-forget, always returns {:ok, _} once sent.
Step 1 of a factory reset: returns a confirmation token.
Runs a CLI command on the device and returns its :cli_reply.
Sends a self advertisement, optionally flooded.
Sends CMD_APP_START, which initialises the session and returns the
device's :self_info. Options: :timeout.
Queries device info (:device_info: model, firmware, limits…).
Transmits a raw radio packet. data is raw bytes or {:hex, string}.
Sets the advert location policy, keeping other parameters.
Configures channel channel_idx.
Sets the advertised coordinates.
Sets one custom variable.
Sets the BLE pairing PIN.
Enables or disables manual contact adding, keeping other parameters.
Sets the multi-ack count, keeping other parameters.
Sets the advertised node name.
Legacy variant of set_other_params_from_infos/2 without multi_acks.
Writes the "other params" block from a map shaped like :self_info
(:manual_add_contacts, :telemetry_mode_base|loc|env, :adv_loc_policy,
:multi_acks).
Sets the path hash mode (0 = 1 byte hashes, 1 = 2 bytes, 2 = 3 bytes).
Sets the radio parameters: frequency (MHz), bandwidth (kHz), spreading
factor, coding rate and – on repeater-capable firmware – repeat.
Sets the base telemetry mode (0-3), keeping other parameters.
Sets the environment telemetry mode (0-3), keeping other parameters.
Sets the location telemetry mode (0-3), keeping other parameters.
Sets the device clock (Unix seconds).
Sets RX delay and airtime factor.
Sets the transmit power in dBm.
Signs data with the device key: sign_start/1, chunked sign_data/2,
sign_finish/2. Options: :chunk_size (default 120), :timeout.
Streams one chunk of data to sign.
Finishes the signing session and returns the :signature.
Starts a signing session; the reply carries max_length.
Types
@type mc() :: GenServer.server()
@type result() :: {:ok, Meshcore.Event.t()} | {:error, Meshcore.Event.t()}
Functions
Step 2 of a factory reset. Returns {:error, :invalid_token} if token does
not match the pending one.
Exports the device's private key (:private_key, or :disabled).
Frequency ranges in which repeating is allowed.
Reads battery level (and storage use on newer firmware).
Reads channel channel_idx (:channel_info).
Reads the custom variables (:custom_vars, a map of strings).
@spec get_path_hash_mode(mc()) :: non_neg_integer()
Reads the active path hash mode. Returns the integer directly (0 when the
device does not report one), like the Python method.
Reads the device's own telemetry (:telemetry_response).
Core statistics (battery, uptime, errors, queue length).
Packet counters.
Radio statistics (noise floor, RSSI, SNR, airtime).
Reads the device clock.
Reads RX delay and airtime factor (:tuning_params).
Checks whether the device has an active connection (CMD 28).
Imports a 64 byte private key.
Reboots the device. Fire-and-forget, always returns {:ok, _} once sent.
Step 1 of a factory reset: returns a confirmation token.
The two-step flow is a client-side safety net; the firmware itself performs
no token check. Pass the token to confirm_factory_reset/2.
Runs a CLI command on the device and returns its :cli_reply.
Sends a self advertisement, optionally flooded.
Sends CMD_APP_START, which initialises the session and returns the
device's :self_info. Options: :timeout.
Queries device info (:device_info: model, firmware, limits…).
Transmits a raw radio packet. data is raw bytes or {:hex, string}.
Sets the advert location policy, keeping other parameters.
Configures channel channel_idx.
When channel_secret is nil – or the name starts with # – the 16 byte
secret is derived as the first half of SHA-256(name) (public hashtag
channels). Raises ArgumentError if an explicit secret is not 16 bytes.
Sets the advertised coordinates.
Sets one custom variable.
@spec set_devicepin(mc(), non_neg_integer()) :: result()
Sets the BLE pairing PIN.
Enables or disables manual contact adding, keeping other parameters.
Sets the multi-ack count, keeping other parameters.
Sets the advertised node name.
Legacy variant of set_other_params_from_infos/2 without multi_acks.
Writes the "other params" block from a map shaped like :self_info
(:manual_add_contacts, :telemetry_mode_base|loc|env, :adv_loc_policy,
:multi_acks).
Sets the path hash mode (0 = 1 byte hashes, 1 = 2 bytes, 2 = 3 bytes).
@spec set_radio( mc(), number(), number(), integer(), integer(), boolean() | integer() | nil ) :: result()
Sets the radio parameters: frequency (MHz), bandwidth (kHz), spreading
factor, coding rate and – on repeater-capable firmware – repeat.
Sets the base telemetry mode (0-3), keeping other parameters.
Sets the environment telemetry mode (0-3), keeping other parameters.
Sets the location telemetry mode (0-3), keeping other parameters.
@spec set_time(mc(), non_neg_integer()) :: result()
Sets the device clock (Unix seconds).
@spec set_tuning(mc(), non_neg_integer(), non_neg_integer()) :: result()
Sets RX delay and airtime factor.
@spec set_tx_power(mc(), non_neg_integer()) :: result()
Sets the transmit power in dBm.
Signs data with the device key: sign_start/1, chunked sign_data/2,
sign_finish/2. Options: :chunk_size (default 120), :timeout.
Returns the :signature event, or an error event (reason: :data_too_large
if data exceeds the device buffer).
Streams one chunk of data to sign.
A missing acknowledgement (timeout) is tolerated – the chunk was most likely
processed – and reported as {:ok, ok_event}, like the Python library.
Finishes the signing session and returns the :signature.
Options: :timeout (default max(3 × default_timeout, 15s) plus a bonus
growing with :data_size), :data_size.
Starts a signing session; the reply carries max_length.