tm_mercury v0.3.0 TM.Mercury.Reader

Summary

Functions

Execute the reader’s bootloader

Execute the reader’s firmware from the bootloader

Clear the tag buffer

Return the antenna port configuration used by the reader

Return the identity of the program currently running on the device

Return the current value of an optional reader parameter with a given key

Set the power-consumption mode of the reader as a whole

Get the current TX power for reading tags in centi-dBm

Return the RF regulatory environment that the reader will operate within

Return the tags that have accumulated in the reader’s buffer while waiting on a synchronous read timeout to expire

Return the tag protocol used by the reader

Get the radio’s temperature

Return hardware, firmware, and bootloader version details

Catch-all handlers for op commands that don’t require any state binding or special handling

Start reading tags asynchronously using the current reader configuration Tags will be sent to the process provided as the callback until stop_read_async is called

Start reading tags asynchronously using a custom read plan Tags will be sent to the process provided as the callback until stop_read_async is called

Stop reading tags asynchronously

Read tags synchronously using the current reader configuration

Read tags synchronously using a custom read plan

Read tags synchronously using the current reader configuration, skipping preparation steps in prepare_read. Care should be taken that any necessary preparation is performed separately before calling this function

Reboot the reader

Disconnect the reader. The connection will be restarted

Set the antenna port configuration used by the reader

Set the reader’s serial baud rate. The host’s baud rate must be changed separately

Set the value of an optional reader parameter with a given key

Return the power-consumption mode of the reader as a whole

Change the read timeout used for synchronous tag reading

Set the current TX power for reading tags in centi-dBm

Set the RF regulatory environment that the reader will operate within

Set the tag protocol used by the reader

Start a process and open a connection with the reader over UART connected via TTL / USB

Return the reader’s transport connection status

Functions

boot_bootloader(pid)
boot_bootloader(pid) :: :ok | {:error, term}

Execute the reader’s bootloader.

boot_firmware(pid)
boot_firmware(pid) :: :ok | {:error, term}

Execute the reader’s firmware from the bootloader.

clear_tag_id_buffer(pid)
clear_tag_id_buffer(pid) :: :ok | {:error, term}

Clear the tag buffer.

get_antenna_port(pid)

Return the antenna port configuration used by the reader

get_current_program(pid)
get_current_program(pid) ::
  {:ok, :bootloader} |
  {:ok, :application} |
  {:error, term}

Return the identity of the program currently running on the device.

get_param(pid, key)
get_param(pid, atom) :: {:ok, term} | {:error, term}

Return the current value of an optional reader parameter with a given key.

get_power_mode(pid)

Set the power-consumption mode of the reader as a whole

get_read_tx_power(pid)

Get the current TX power for reading tags in centi-dBm.

Examples

iex> TM.Mercury.Reader.get_read_tx_power(pid)
{:ok, 2500} # 25 dBm
get_reader_stats(pid, option, flags)

TODO

get_region(pid)

Return the RF regulatory environment that the reader will operate within.

get_tag_id_buffer(pid, metadata_flags)
get_tag_id_buffer(pid, list) :: {:ok, term} | {:error, term}

Return the tags that have accumulated in the reader’s buffer while waiting on a synchronous read timeout to expire.

get_tag_protocol(pid)

Return the tag protocol used by the reader

get_temperature(pid)

Get the radio’s temperature

get_version(pid)
get_version(pid) :: {:ok, map}

Return hardware, firmware, and bootloader version details.

handle_call(msg, from, state)

Catch-all handlers for op commands that don’t require any state binding or special handling

read_async_start(pid, callback)
read_async_start(pid :: pid, callback :: pid) ::
  {:ok, term} |
  {:error, term}

Start reading tags asynchronously using the current reader configuration Tags will be sent to the process provided as the callback until stop_read_async is called.

read_async_start(pid, callback, rp)
read_async_start(pid :: pid, callback :: pid, TM.Mercury.ReadPlan.t) ::
  {:ok, term} |
  {:error, term}

Start reading tags asynchronously using a custom read plan Tags will be sent to the process provided as the callback until stop_read_async is called.

read_async_stop(pid)

Stop reading tags asynchronously

read_sync(pid)
read_sync(pid) :: {:ok, term} | {:error, term}
read_sync(pid) :: {:ok, term} | {:error, term}

Read tags synchronously using the current reader configuration

read_sync(pid, rp)
read_sync(pid, TM.Mercury.ReadPlan.t) ::
  {:ok, term} |
  {:error, term}

Read tags synchronously using a custom read plan

read_sync_prepared(pid)

Read tags synchronously using the current reader configuration, skipping preparation steps in prepare_read. Care should be taken that any necessary preparation is performed separately before calling this function.

reboot(pid)
reboot(pid) :: :ok | {:error, term}

Reboot the reader.

reconnect(pid)
reconnect(pid) :: :ok | {:error, term}

Disconnect the reader. The connection will be restarted.

reset_reader_stats(pid, flags)

TODO

set_antenna_port(pid, ports)

Set the antenna port configuration used by the reader

set_baud_rate(pid, rate)
set_baud_rate(pid, pos_integer) :: :ok | {:error, term}

Set the reader’s serial baud rate. The host’s baud rate must be changed separately.

set_param(pid, key, value)
set_param(pid, atom, any) :: {:ok, term} | {:error, term}

Set the value of an optional reader parameter with a given key.

set_power_mode(pid, mode)

Return the power-consumption mode of the reader as a whole

set_read_timeout(pid, timeout)

Change the read timeout used for synchronous tag reading.

set_read_tx_power(pid, level)

Set the current TX power for reading tags in centi-dBm.

Examples

iex> TM.Mercury.Reader.set_read_tx_power(pid, 2500) # 25 dBm
:ok
set_region(pid, region)

Set the RF regulatory environment that the reader will operate within.

set_tag_protocol(pid, protocol)

Set the tag protocol used by the reader

start_link(opts)
start_link(keyword) :: {:ok, pid} | {:error, term}

Start a process and open a connection with the reader over UART connected via TTL / USB

Keyword List Parameters

  • device - The device file for the reader serial connection (required)
  • speed - The port speed, e.g.: speed: 115200 (default)
  • region - The regulatory RF environment used by the reader

    • :none - Unspecified region (default)
    • :na - North America
    • :eu - European Union
    • :kr - Korea
    • :in - India
    • :jp - Japan
    • :prc - People’s Republic of China
    • :eu2 - European Union 2
    • :eu3 - European Union 3
    • :kr2 - Korea 2
    • :prc2 - People’s Republic of China (840 MHz)
    • :au - Australia
    • :nz - New Zealand (Experimental)
    • :na2 - Reduced FCC region
    • :na3 - 5 MHz FCC band
    • :open - Open
  • power_mode - The power-consumption mode of the reader as a whole

    • :full (default)
    • :min_save
    • :med_save
    • :max_save
    • :sleep
  • antennas - The antenna port configuration. default: 1
  • tag_protocol - The tag protocol used by the reader. default: :gen2
  • read_timeout - The duration used by read_sync when reading tags. default: 500
status(pid)

Return the reader’s transport connection status