Entry-point API for the LocationSimulator library.
With a pipeline module (recommended)
defmodule MyApp.Tracker do
use LocationSimulator.Pipeline
source :synthetic, direction: :north, elevation: 50
plug LocationSimulator.Plug.Callback, callback: MyApp.GpsHandler
end
LocationSimulator.start(MyApp.Tracker, %{worker: 3, event: 100, interval: 1_000})With a plain config map (legacy)
LocationSimulator.start(%{
worker: 3,
event: 100,
interval: 1_000,
random_range: 200,
direction: :north,
elevation: 50,
callback: MyApp.GpsHandler
})
Summary
Functions
Returns the merged default config (application config overrides built-in defaults).
Starts one worker with the default / application config.
Starts workers using a plain config map (legacy API).
Starts workers with a pipeline module and runtime config.
Stops all workers that belong to group_id.
Types
@type start_result() :: :ok | {:error, term()}
Functions
@spec default_config() :: map()
Returns the merged default config (application config overrides built-in defaults).
@spec start() :: start_result()
Starts one worker with the default / application config.
@spec start(map()) :: start_result()
Starts workers using a plain config map (legacy API).
See the module doc for supported config keys.
@spec start(module(), map()) :: start_result()
Starts workers with a pipeline module and runtime config.
The pipeline module defines the GPS source and the plug chain. The config map supplies runtime parameters (worker count, event count, etc.).
Returns :ok, or {:error, reason} when a worker fails to start or the
configured GPX glob matches no files.
@spec stop(group_id :: any()) :: :ok
Stops all workers that belong to group_id.