Module achlys_pmod_nav_worker

The Pmod_NAV worker server.

Behaviours: gen_server.

Authors: Igor Kopestenski (igor.kopestenski@uclouvain.be) [web site: https://github.com/Laymer/achlys/].

See also: Pmod_NAV .

Description

The Pmod_NAV worker server. The general purpose of this worker is to gather and process sensor data from one of the 3 components available on the Pmod_NAV :

- Accelerometer => acc - Gyroscope => alt - Magnetometer => mag

Data can be retrieved as follows :

[Temperature] = pmod_nav:read(acc, [out_temp]).

Where acc is the component providing the data and [out_temp] is the list of registers that is read.

Data Types

task()

task() = #{name => atom(), targets => task_targets(), execution_type => task_execution_type(), function => function()}

task_execution_type()

task_execution_type() = bitstring()

task_targets()

task_targets() = [node()] | bitstring()

Function Index

code_change/3
get_crdt/1Returns the current view of the contents in the temperatures Lasp variable.
get_table/1Returns the current view of the contents in the temperatures Lasp variable.
handle_continue/2
handle_info/2fetches the values from the pmod_nav sensor and stores them in the corresponding ETS table.
run/0declares a Lasp variable for temperature aggregates and sets triggers for handlers after intervals have expired.
start_link/0starts the pmod_nav process using the configuration given in the sys.config file.
terminate/2

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> any()

get_crdt/1

get_crdt(Name::atom()) -> list()

Returns the current view of the contents in the temperatures Lasp variable. -spec get_crdt() -> crdt().

get_table/1

get_table(Name::atom()) -> ok

Returns the current view of the contents in the temperatures Lasp variable.

handle_continue/2

handle_continue(Continue, State) -> any()

handle_info/2

handle_info(Info, State) -> any()

fetches the values from the pmod_nav sensor and stores them in the corresponding ETS table. It is paired with the erlang:monotonic_time/0 to guarantee unique keys. The first call is used to redirect towards implemented handlers e.g. temperature, pressure. For large amounts of sensor data e.g. accumulated for a long time and being larger than the maximum available memory, an alternative would be to use the dets storage module. They can also be combined as described below.

From OTP documentation :

Dets tables provide efficient file-based Erlang term storage. They are used together with ETS tables when fast access needs to be complemented with persistency.

run/0

run() -> ok

declares a Lasp variable for temperature aggregates and sets triggers for handlers after intervals have expired.

start_link/0

start_link() -> {ok, pid()} | ignore | {error, {already_started, pid()} | term()}

starts the pmod_nav process using the configuration given in the sys.config file.

terminate/2

terminate(Reason, State) -> any()


Generated by EDoc