       @behaviour Bluex.DBusDiscovery
       import Bluex.DBusDiscovery
       use GenServer
+
+      @doc false
       def start_link do
         Bluex.DBusDiscovery.start_link(__MODULE__, [])
       end
+
+      @doc """
+      Starts Bluetooth discovery
+      """
       def start_discovery do
         Bluex.DBusDiscovery.start_discovery(__MODULE__)
       end

    {:ok, %{bus: bus, adapter_manager: adapter_manager, devices: [], adapters: [], bluez_manager: bluez_manager, module: module}}
  end

  def handle_call(:get_adapters, _, state) do
    {:reply, state[:adapters], state}
  end

  def handle_call(:get_devices, _, state) do
    {:reply, state[:devices], state}
  end

  def handle_info({:dbus_signal, _}, state) do
    GenServer.cast(state[:module], :get_adapters)
    {:noreply, state}
  end

  def handle_cast(:get_adapters, state) do
    adapters = :dbus_proxy.children(state[:adapter_manager])
    |> Stream.map(fn (adapter) -> adapter |> String.split("/") |> Enum.at(-1) end)

    GenServer.call(pid, :get_adapters)
  end

  @doc """
  Gets list of devices
  """
  def get_devices(pid) do
    GenServer.call(pid, :get_devices)
  end

  @doc false
  def device_found(pid, device) do
    GenServer.cast(pid, {:device_found, device})
  end
