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
Functions
@spec default_config() :: map()
Returns the merged default config (application config overrides built-in defaults).
@spec start() :: :ok
Starts one worker with the default / application config.
@spec start(map()) :: :ok
Starts workers using a plain config map (legacy API).
See the module doc for supported config keys.
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.).
@spec stop(group_id :: any()) :: :ok
Stops all workers that belong to group_id.