Fledex.Supervisor.AnimationSystem (fledex v0.7.0)
View SourceThis module starts and supervises all the services required for running
animations. You rarely will use this module directly, but rather use it
through the Fledex DSL.
This includes:
- The animation manager
- The job scheduler
- The messaging services
- The workers
You can start the whole subsystem by calling
AnimationSystem.start_link/0It's more common to add it to a Supervision tree by calling:
Supervisor.start_link(AnimationSystem.child_spec(opts), strategy: :one_for_one)or for adding it to a dynamic supervisor:
DynamicSupervisor.start_child(AnimationSystem.child_spec(opts))or for adding in a livebook to a Kino supervisor:
Kino.start_child(AnimationSystem.child_spec(opts))The dynamic options are probably not something you want to do manually, but it's
something you want to trigger when calling use Fledex.
Once the AnimationSystem is up and running you can add led strips through
start_led_strip/3
Summary
Functions
This is a child_spec that can be used when starting the AnimationSystem
under a supervision tree.
This returns a list of all the defined led strips
This returns the name of the LedStrip server for the strip with the name strip_name
This checks whether a specific led_strip exists
THis reconfigures the LedStrip
This starts a new led_strip to which we can send some led sequences, and, if we update it in regular intervals, can play an animation
starts the AnimationSystem and all necessary subsystems
stops the Supervisor and all it's attached services
This stops an led_strip.
The name of the supervisor that observes all the workers in the AnimationSystem
Functions
@spec child_spec(keyword()) :: Supervisor.child_spec()
This is a child_spec that can be used when starting the AnimationSystem
under a supervision tree.
@spec get_led_strips() :: [atom()]
This returns a list of all the defined led strips
@spec get_strip_server(atom()) :: GenServer.name()
This returns the name of the LedStrip server for the strip with the name strip_name
This checks whether a specific led_strip exists
@spec reconfigure_led_strip(atom(), Fledex.LedStrip.drivers_config_t(), keyword()) :: :ok
THis reconfigures the LedStrip
Note: this function assumes that the led_strip does already exist.
@spec start_led_strip( atom(), Fledex.LedStrip.drivers_config_t(), keyword(), keyword() ) :: GenServer.on_start()
This starts a new led_strip to which we can send some led sequences, and, if we update it in regular intervals, can play an animation
@spec start_link(keyword()) :: {:ok, pid()} | {:error, {:already_started, pid()} | {:shutdown, term()} | term()}
starts the AnimationSystem and all necessary subsystems
stops the Supervisor and all it's attached services
@spec stop_led_strip(atom()) :: :ok
This stops an led_strip.
It is safe to call this function even if the led_strip does not exist
@spec strip_supervisors() :: module()
The name of the supervisor that observes all the workers in the AnimationSystem