xplane v0.1.0 XPlane.Data
Get and set X-Plane data.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Request latest values of the listed data reference ids. Values will not be
available until you have called XPlane.Data.request_updates/2
. If you request
a data reference that we have not received a value for, an
Request updates of the specified data references at the corresponding frequency.
Values can then be retrieved using XPlane.Data.latest_updates/2
. A small
delay occurs during the call to give the GenServer a chance to collect at least
one value for each requested data reference
Start GenServer to exchange data references with a specific X-Plane instance
Stop the GenServer listening for data reference updates, and tell X-Plane to stop sending any we are currently subscribed to
Link to this section Types
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
latest_updates(XPlane.Instance.t(), [atom()]) :: %{atom: float() | nil}
Request latest values of the listed data reference ids. Values will not be
available until you have called XPlane.Data.request_updates/2
. If you request
a data reference that we have not received a value for, an:
{:error, {no_values, [list of requested data reference ids missing values]}}`
message is returned. This seemed to be more a more useful way to handle missing values, because most clients will need all the requested values to do their work.
Parameters
- instance: X-Plane instance from list returned by
XPlane.Instance.list/0
- dref_ids: List of data reference ids to return values for
Example
iex> master |> latest_updates([:flightmodel_position_elevation])
%{flightmodel_position_elevation: ...}`
request_updates(XPlane.Instance.t(), [{atom(), integer()}]) :: :ok | {:error, list()}
Request updates of the specified data references at the corresponding frequency.
Values can then be retrieved using XPlane.Data.latest_updates/2
. A small
delay occurs during the call to give the GenServer a chance to collect at least
one value for each requested data reference.
Parameters
- instance: X-Plane instance from list returned by
XPlane.Instance.list/0
- dref_id_freq: Keyword list of data reference ids and integer updates per second
Example
iex> request_updates(master, [flightmodel_position_indicated_airspeed: 10])
:ok
start(XPlane.Instance.t(), list()) :: {:ok, pid()} | {:error, any()} | :ignore
Start GenServer to exchange data references with a specific X-Plane instance.
Parameters
- instance: X-Plane instance from list returned by
XPlane.Instance.list/0
Stop the GenServer listening for data reference updates, and tell X-Plane to stop sending any we are currently subscribed to.