The board as a Bluetooth LE HID device (HID over GATT): a keyboard, a mouse, a game controller, whatever its report descriptor says.
It needs NanoKVMGo.Bluetooth. A computer, phone or tablet pairs with it
from its Bluetooth settings while pairing is open
(NanoKVMGo.Bluetooth.open_pairing/1); while it is, the board advertises
as discoverable, and afterwards only to the hosts it knows.
{NanoKVMGo.Bluetooth.HID,
report_map: keyboard_and_mouse_descriptor,
inputs: [keyboard: {1, 8}, mouse: {2, 7}],
outputs: [leds: {1, 1}],
appearance: 0x03C1}
NanoKVMGo.Bluetooth.HID.report(:keyboard, <<0, 0, 4, 0, 0, 0, 0, 0>>)A report is the same bytes as over USB, without its report ID: the
report ID is in the report's GATT descriptor. with_report_id/2 gives a
USB descriptor of one report a report ID, to combine several in one
report map. Output reports (a keyboard's LEDs) go to the :notify
process as {NanoKVMGo.Bluetooth.HID, name, report}.
Options
:report_map- the HID report descriptor (required):inputs,:outputs- reports by name:{report_id, length}:appearance- what hosts show it as: 0x03C0 a HID device (by default), 0x03C1 a keyboard, 0x03C2 a mouse, 0x03C4 a gamepad:pnp_id-{vendor_id_source, vendor_id, product_id, version}, the source 1 for Bluetooth SIG IDs or 2 for USB-IF ones; by default BlueZ's,{2, 0x1D6B, 0x0246, 0x0100}:local_name- the name it advertises, the host name by default:notify- the process for output reports:name- the name to register,NanoKVMGo.Bluetooth.HIDby default
Summary
Functions
Returns a specification to start this module under a supervisor.
Whether a host listens to the input reports: it subscribed to them, or a paired device is connected, which BlueZ remembers the subscriptions of.
Sends an input report to the host, when one listens.
Gives a descriptor of one report, as USB has it, a report ID: the Report ID item after its first application collection.
Types
@type report_spec() :: {report_id :: 1..255, length :: pos_integer()}
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec connected?(GenServer.server()) :: boolean()
Whether a host listens to the input reports: it subscribed to them, or a paired device is connected, which BlueZ remembers the subscriptions of.
@spec report(GenServer.server(), atom(), binary()) :: :ok
Sends an input report to the host, when one listens.
@spec start_link(keyword()) :: GenServer.on_start()
Gives a descriptor of one report, as USB has it, a report ID: the Report ID item after its first application collection.