View Source Cantastic.ReceivedFrameWatcher (Cantastic v1.0.1)

Cantastic.ReceivedFrameWatcher is a GenServer spawned per received frame. It will then send handle_missing_frame events to all processes that subscribed to them.

Summary

Functions

Returns a specification to start this module under a supervisor.

Stop monitoring the frame(s) reception frequencies.

Start monitoring the frame(s) reception frequencies.

Returns true if the frame was received within the expected timeframe.

Subscribe frame_handler :: pid() to one or multiple frame reception errors.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

disable(network_name, frame_names)

View Source

Stop monitoring the frame(s) reception frequencies.

Returns :ok.

Example

iex> Cantastic.ReceivedFrameWatcher.enable(:my_netowrk, "inverter_status")
:ok

iex> Cantastic.Receiver.enable(:my_netowrk, ["inverter_status", "inverter_temperatures"], self())
:ok
Link to this function

enable(network_name, frame_names)

View Source

Start monitoring the frame(s) reception frequencies.

Returns :ok.

Example

iex> Cantastic.ReceivedFrameWatcher.enable(:my_netowrk, "inverter_status")
:ok

iex> Cantastic.Receiver.enable(:my_netowrk, ["inverter_status", "inverter_temperatures"], self())
:ok
Link to this function

is_alive?(network_name, frame_name)

View Source

Returns true if the frame was received within the expected timeframe.

Returns true or false.

Example

iex> Cantastic.ReceivedFrameWatcher.is_alive(:my_netowrk, "inverter_status")
true
Link to this function

subscribe(network_name, frame_names, frame_handler)

View Source

Subscribe frame_handler :: pid() to one or multiple frame reception errors.

frame_handler will then receive {:handle_missing_frame, network_name, frame_name} messages each time a frame is not received during the timeframe defined in your YAML file.

Returns :ok.

Example

iex> Cantastic.ReceivedFrameWatcher.subscribe(:my_netowrk, "inverter_status", self())
:ok

iex> Cantastic.Receiver.subscribe(:my_netowrk, ["inverter_status", "inverter_temperatures"], self())
:ok