diff --git a/lib/aprs/is/is.ex b/lib/aprs/is/is.ex index f3f7d9c..15f96c7 100644 --- a/lib/aprs/is/is.ex +++ b/lib/aprs/is/is.ex @@ -124,10 +124,10 @@ defmodule Aprs.Is do packet |> String.split("\r\n") |> Enum.each(&dispatch(String.trim(&1))) + else + dispatch(packet) end - dispatch(packet) - # Start a new timer timer = Process.send_after(self(), :aprs_no_message_timeout, @aprs_timeout) state = Map.put(state, :timer, timer) @@ -149,10 +149,6 @@ defmodule Aprs.Is do def terminate(reason, state) do # Do Shutdown Stuff Logger.info("Going Down: #{inspect(reason)} - #{inspect(state)}") - # Logger.info("Attempting to write ets tables to disk.") - # :ets.tab2file(:aprs, :erlang.binary_to_list("priv/aprs.ets")) - # :ets.tab2file(:aprs_messages, :erlang.binary_to_list("priv/aprs_messages.ets")) - Logger.info("Closing socket") :gen_tcp.close(state.socket) @@ -201,6 +197,7 @@ defmodule Aprs.Is do # end) AprsWeb.Endpoint.broadcast("aprs_messages", "packet", parsed_message) + Logger.debug("BROADCAST: " <> inspect(parsed_message)) # Phoenix.PubSub.broadcast( # Aprs.PubSub, diff --git a/lib/aprs_web/live/packets_live/index.ex b/lib/aprs_web/live/packets_live/index.ex index c84987b..2ea5b5d 100644 --- a/lib/aprs_web/live/packets_live/index.ex +++ b/lib/aprs_web/live/packets_live/index.ex @@ -16,41 +16,4 @@ defmodule AprsWeb.PacketsLive.Index do socket = assign(socket, :packets, [payload | socket.assigns.packets]) {:noreply, socket} end - - # AprsWeb.PacketsLive.Index.handle_info(%Phoenix.Socket.Broadcast{topic: "aprs_messages", event: "packet", payload: %{base_callsign: "AE5PL", data_extended: %{aprs_messaging?: false, comment: "RNG0001 70cm Voice 441.1625MHz", data_type: :position, latitude: 33.26733333333333, longitude: -96.53266666666667, symbol_code: "&", symbol_table_id: "D"}, data_type: :position, destination: "APJI43", information_field: "!3316.04ND09631.96W&RNG0001 70cm Voice 441.1625MHz", path: "TCPIP*,qAC,AE5PL-IG", sender: "AE5PL-B", ssid: "B"}}, #Phoenix.LiveView.Socket, router: AprsWeb.Router, assigns: %{__changed__: %{}, flash: %{}, live_action: :index, packets: []}, transport_pid: #PID<0.776.0>, ...>) - - # @impl true - # def handle_params(params, _url, socket) do - # {:noreply, apply_action(socket, socket.assigns.live_action, params)} - # end - - # defp apply_action(socket, :edit, %{"id" => id}) do - # socket - # |> assign(:page_title, "Edit Book") - # |> assign(:book, Books.get_book!(id)) - # end - - # defp apply_action(socket, :new, _params) do - # socket - # |> assign(:page_title, "New Book") - # |> assign(:book, %Book{}) - # end - - # defp apply_action(socket, :index, _params) do - # socket - # |> assign(:page_title, "Listing Books") - # |> assign(:book, nil) - # end - - # @impl true - # def handle_event("delete", %{"id" => id}, socket) do - # book = Books.get_book!(id) - # {:ok, _} = Books.delete_book(book) - - # {:noreply, assign(socket, :books, list_books())} - # end - - # defp list_books do - # Books.list_books() - # end end