View Source LocationSimulator.Worker (LocationSimulator v0.6.3)

Worker is a simulator that use for generating GPS data.

Worker will call client follow :callback setting in config.

Two start/stop event is used for start or init data and clean if need.

event api is used for put GPS data to client.

Callbacks are declared in LocationSimulator.Event module.

Link to this section Summary

Functions

Generate child spec for supervisor.

Entry point of worker, start event will be fired from here.

Support for starting from supervisor.

Link to this section Functions

@spec child_spec(map()) :: %{
  id: any(),
  restart: any(),
  shutdown: any(),
  start: {LocationSimulator.Worker, :start_link, [map(), ...]},
  type: :worker
}

Generate child spec for supervisor.

@spec init(map()) :: :ok

Entry point of worker, start event will be fired from here.

Init some data and go to loop function for generating GPS data.

Root GPS data will be generated in this function.

@spec start_link(any()) :: {:ok, pid()}

Support for starting from supervisor.