View Source Cantastic.OBD2.Request (Cantastic v1.0.1)
Cantastic.OBD2.Request is a GenServer used to emit OBD2 requests at the frequency defined in your YAML configuration file.
There is one process started per OBD2 request defined in your YAML file.
Here is an example on how to subscribe to one OBD2 request and start emitting it:
:ok = OBD2.Request.subscribe(self(), :obd2, "current_speed_and_rotation_per_minute")
:ok = OBD2.Request.enable(:obd2, "current_speed_and_rotation_per_minute")
Summary
Functions
Returns a specification to start this module under a supervisor.
Disable the OBD2 request(s), the requests is/are then not emitted on the bus anymore.
Enable the OBD2 request(s), the request(s) is/are then emitted on the bus at the predefined frequency.
Subscribe response_handler :: pid() to one OBD2 request.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Disable the OBD2 request(s), the requests is/are then not emitted on the bus anymore.
Returns: :ok
Examples
iex> Cantastic.OBD2.Request.disable(:obd2, "current_speed_and_rpm") :ok
iex> Cantastic.OBD2.Request.disable(:obd2, ["current_speed_and_rpm", "current_speed_and_rpm"]) :ok
Enable the OBD2 request(s), the request(s) is/are then emitted on the bus at the predefined frequency.
Returns: :ok
Examples
iex> Cantastic.OBD2.Request.enable(:obd2, "current_speed_and_rpm") :ok
iex> Cantastic.OBD2.Request.enable(:obd2, ["current_speed_and_rpm", "throttle_status"]) :ok
Subscribe response_handler :: pid() to one OBD2 request.
Returns :ok.
Example
iex> Cantastic.OBD2.Request(self(), :my_netowrk, "current_speed_and_rpm")
:ok