From 388fb0d2e4cdd54041f01fe25e6fb2b33e5b740e Mon Sep 17 00:00:00 2001 From: Jon Carstens Date: Thu, 3 Dec 2020 10:57:54 -0700 Subject: [PATCH] add @impl to DeviceChannel --- lib/nerves_hub_link/device_channel.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/nerves_hub_link/device_channel.ex b/lib/nerves_hub_link/device_channel.ex index d2f9918..73e3d7d 100644 --- a/lib/nerves_hub_link/device_channel.ex +++ b/lib/nerves_hub_link/device_channel.ex @@ -39,15 +39,18 @@ defmodule NervesHubLink.DeviceChannel do GenServer.call(__MODULE__, :connected?) end + @impl GenServer def init(opts) do send(self(), :join) {:ok, struct(State, opts)} end + @impl GenServer def handle_call(:connected?, _from, %{connected?: connected?} = state) do {:reply, connected?, state} end + @impl GenServer def handle_cast({:send_update_progress, progress}, state) do Channel.push_async(state.channel, "fwup_progress", %{value: progress}) {:noreply, state} @@ -58,6 +61,7 @@ defmodule NervesHubLink.DeviceChannel do {:noreply, state} end + @impl GenServer def handle_info(%Message{event: "reboot"}, state) do Logger.warn("Reboot Request from NervesHubLink") Channel.push_async(state.channel, "rebooting", %{}) @@ -98,6 +102,7 @@ defmodule NervesHubLink.DeviceChannel do {:noreply, state} end + @impl GenServer def terminate(_reason, _state), do: NervesHubLink.Connection.disconnected() defp handle_join_reply(%{"firmware_url" => _url} = update) do