View Source Cantastic.Receiver (Cantastic v1.0.1)
Cantastic.Receiver is a GenServer spawned per CAN network. It will then send the received Cantastic.Frame to all processes that subscribed to them.
Summary
Functions
Returns a specification to start this module under a supervisor.
Subscribe frame_handler :: pid() to all frames received on a CAN network.
Subscribe frame_handler :: pid() to one or multiple frames.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Subscribe frame_handler :: pid() to all frames received on a CAN network.
Passing %{errors: true} as opt will also subscribe the frame_handler to handle_missing_frame events that are triggered when the related frames are not received during the expected timeframe on the CAN network. (see also Cantastic.ReceivedFrameWatcher)
Returns :ok.
Example
iex> Cantastic.Receiver.subscribe(self(), :my_network)
:ok
iex> Cantastic.Receiver.subscribe(self(), :my_network, %{errors: true})
:ok
subscribe(frame_handler, network_name, frame_names, opts \\ %{errors: false})
View SourceSubscribe frame_handler :: pid() to one or multiple frames.
Passing %{errors: true} as opt will also subscribe the frame_handler to handle_missing_frame events that are triggered when the related frames are not received during the expected timeframe on the CAN network. (see also Cantastic.ReceivedFrameWatcher)
Returns :ok.
Example
iex> Cantastic.Receiver.subscribe(self(), :my_netowrk, "inverter_status")
:ok
iex> Cantastic.Receiver.subscribe(self(), :my_netowrk, "inverter_status", %{errors: true})
:ok
iex> Cantastic.Receiver.subscribe(self(), :my_netowrk, ["inverter_status", "inverter_temperatures"])
:ok