Commands for managing the device's contact list.
A contact is a map with the keys the device reports in :contacts and
:next_contact events: :public_key (hex), :type, :flags,
:out_path_len, :out_path_hash_mode, :out_path (hex), :adv_name,
:last_advert, :adv_lat, :adv_lon, :lastmod.
Summary
Functions
Alias for update_contact/3 with no changes: adds contact to the device.
Changes a contact's flags.
Changes a contact's out path. See update_contact/3 for the path format.
Exports a contact (or, with nil, this node) as a meshcore:// URI
(:contact_uri).
Reads the last known advert path of a contact (:advert_path).
Reads the auto-add configuration (:autoadd_config).
Fetches a single contact by its 32 byte public key (:next_contact), or an
error if it is unknown.
Fetches the contact list and waits for the :contacts event, whose payload
is a map public_key_hex => contact.
Asks for the contact list without waiting (the :contacts event follows).
Imports a contact card (raw bytes, as found after meshcore://).
Removes a contact.
Resets the stored path of a contact (it will be reached by flooding).
Sets the auto-add configuration bit field.
Shares a contact with the mesh.
Writes a contact to the device (add or update).
Types
@type contact() :: map()
@type mc() :: GenServer.server()
@type result() :: {:ok, Meshcore.Event.t()} | {:error, Meshcore.Event.t()}
Functions
Alias for update_contact/3 with no changes: adds contact to the device.
@spec change_contact_flags(mc(), contact(), non_neg_integer()) :: result()
Changes a contact's flags.
Changes a contact's out path. See update_contact/3 for the path format.
@spec export_contact(mc(), Meshcore.Util.destination() | nil) :: result()
Exports a contact (or, with nil, this node) as a meshcore:// URI
(:contact_uri).
@spec get_advert_path(mc(), Meshcore.Util.destination()) :: result()
Reads the last known advert path of a contact (:advert_path).
Reads the auto-add configuration (:autoadd_config).
Fetches a single contact by its 32 byte public key (:next_contact), or an
error if it is unknown.
Fetches the contact list and waits for the :contacts event, whose payload
is a map public_key_hex => contact.
The timeout restarts every time another contact arrives, so large lists don't
time out. Options: :lastmod (only contacts changed since, default 0),
:timeout (ms of silence tolerated, default 5_000).
@spec get_contacts_async(mc(), non_neg_integer()) :: result()
Asks for the contact list without waiting (the :contacts event follows).
Imports a contact card (raw bytes, as found after meshcore://).
@spec remove_contact(mc(), Meshcore.Util.destination()) :: result()
Removes a contact.
@spec reset_path(mc(), Meshcore.Util.destination()) :: result()
Resets the stored path of a contact (it will be reached by flooding).
Sets the auto-add configuration bit field.
Writes a contact to the device (add or update).
Options:
:path– new out path as a hex string, optionally suffixed with":" <> mode("aabbcc:1");""makes it a zero-hop path:path_hash_mode– hash mode for:path; when neither it nor a suffix is given the device's current mode is queried:flags– new contact flags
The stored copy of the contact in the client is updated on success.