Behaviours: gen_server.
Authors: Igor Kopestenski (igor.kopestenski@uclouvain.be) [web site: https://github.com/achlysproject/achlys/].
See also: Pmod_ALS .
The Pmod_ALS worker server. The general purpose of this worker is to gather and process sensor data the pmod_als module :
- Ambient Light (raw) - Ambient Light percentage
Data can be retrieved as follows :
Raw = pmod_als:read(). Percentage = pmod_als:percentage().task() = #{name => atom(), targets => task_targets(), execution_type => task_execution_type(), function => function()}
task_execution_type() = bitstring()
task_targets() = [node()] | bitstring()
code_change/3 | |
get_crdt/1 | Returns the current view of the contents in Lasp variable. |
get_table/1 | Returns the current view of the contents in Lasp variable. |
handle_continue/2 | |
handle_info/2 | fetches the values from the pmod_als sensor
and stores them in the corresponding ETS table. |
run/0 | declares a Lasp variable for aggregates and sets triggers for handlers after intervals have expired. |
start_link/0 | starts the pmod_als process using the configuration given in the sys.config file. |
terminate/2 |
code_change(OldVsn, State, Extra) -> any()
get_crdt(Name::atom()) -> list()
Returns the current view of the contents in Lasp variable. -spec get_crdt() -> crdt().
get_table(Name::atom()) -> ok
Returns the current view of the contents in Lasp variable.
handle_continue(Continue, State) -> any()
handle_info(Info, State) -> any()
fetches the values from the pmod_als
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() -> ok
declares a Lasp variable for aggregates and sets triggers for handlers after intervals have expired.
start_link() -> {ok, pid()} | ignore | {error, {already_started, pid()} | term()}
starts the pmod_als process using the configuration given in the sys.config file.
terminate(Reason, State) -> any()
Generated by EDoc