 
   # Constants for HCI commands etc
   @hci_command_package_type 1
+  @hci_event_package_type 4
 
   @type hci_event_code_t :: :hci_async_event | :hci_command_complete_event |
     {:hci_unknown_event, pos_integer}

    <<opcode :: unsigned-integer-size(16)>> = opcode_bin
    package = <<
      @hci_command_package_type  :: unsigned-integer-size(8),
      opcode :: unsigned-integer-size(16)-little,  
      byte_size(params) :: unsigned-integer-size(8)-little,
      params :: binary>>
    Logger.debug "Package is: #{inspect package}"
    package
  end

  def interprete_event(<<opcode :: unsigned-integer-size(8), 
      event :: unsigned-integer-size(8), 
      len :: unsigned-integer-size(8), 
      rest :: binary>>) when len == byte_size(rest), 
    do:  %Event{event: event_code(event), op_code: opcode, parameter: rest}
  
  @doc """
  Partial mapping of event code to their atom counterpart
  """

        end
        # send the answer to the original caller
        GenServer.reply(caller, return_value)
        # remove that pending call from the map of pending calls
        %__MODULE__{state | calls: Map.delete(calls, ref)}
      {:event, event_bin} when is_binary(event_bin) ->
        event = interprete_event(event_bin)
        Logger.debug "Received event #{inspect event}"
        Logger.error "Do not know what to do with the event!"
