Packages

This mix is to be used to control J1605 switch hub, which contains 16 switches.

Current section

Files

Jump to
j1605 lib j1605.ex
Raw

lib/j1605.ex

defmodule J1605 do
use Application
alias J1605.Device
def subscribe do
Registry.register(J1605.Registry, "subscribers", nil)
end
def turn_on(number) do
GenServer.cast(Device, {true, number})
end
def turn_off(number) do
GenServer.cast(Device, {false, number})
end
def update_states do
GenServer.cast(Device, :states)
end
def start(_type, _args) do
:j1605
|> Application.get_all_env()
|> J1605.Supervisor.start_link()
end
end