standard

This module provides Service classes for BLE defined standard services.

class AppearanceCharacteristic(**kwargs)

What type of device it is

class GenericAccess(*, service=None, secondary=False, **initial_values)

Required service that provides basic device information

class GenericAttribute(*, service=None, secondary=False, **initial_values)

Required service that provides notifications when Services change

class BatteryService(*, service=None, secondary=False, **initial_values)

Provides battery level information

class CurrentTimeService(*, service=None, secondary=False, **initial_values)

Provides the current time.

current_time

(year, month, day, hour, minute, second, weekday, subsecond, adjust_reason)

Type:A tuple describing the current time
local_time_info

(timezone, dst_offset)

Type:A tuple of location information
struct_time

The current time as a time.struct_time. Day of year and whether DST is in effect are always -1.

device_info

class DeviceInfoService(*, manufacturer=None, software_revision=None, model_number=None, serial_number=None, firmware_revision=None, hardware_revision=None, service=None)

Device information

hid

BLE Human Interface Device (HID)

  • Author(s): Dan Halbert for Adafruit Industries
DEFAULT_HID_DESCRIPTOR = b'\x05\x01\t\x06\xa1\x01\x85\x01\x05\x07\x19\xe0)\xe7\x15\x00%\x01u\x01\x95\x08\x81\x02\x81\x01\x19\x00)e\x15\x00%eu\x08\x95\x06\x81\x00\x05\x08\x19\x01)\x05\x15\x00%\x01u\x01\x95\x05\x91\x02\x95\x03\x91\x01\xc0\x05\x01\t\x02\xa1\x01\t\x01\xa1\x00\x85\x02\x05\t\x19\x01)\x05\x15\x00%\x01\x95\x05u\x01\x81\x02\x95\x01u\x03\x81\x01\x05\x01\t0\t1\x15\x81%\x7fu\x08\x95\x02\x81\x06\t8\x15\x81%\x7fu\x08\x95\x01\x81\x06\xc0\xc0\x05\x0c\t\x01\xa1\x01\x85\x03u\x10\x95\x01\x15\x01&\x8c\x02\x19\x01*\x8c\x02\x81\x00\xc0'

provides mouse, keyboard, and consumer control devices.

Type:Default HID descriptor
class ReportIn(service, report_id, usage_page, usage, *, max_length)

A single HID report that transmits HID data into a client.

send_report(report)

Send a report to the peers

class ReportOut(service, report_id, usage_page, usage, *, max_length)

A single HID report that receives HID data from a client.

class HIDService(hid_descriptor=b'x05x01tx06xa1x01x85x01x05x07x19xe0)xe7x15x00%x01ux01x95x08x81x02x81x01x19x00)ex15x00%eux08x95x06x81x00x05x08x19x01)x05x15x00%x01ux01x95x05x91x02x95x03x91x01xc0x05x01tx02xa1x01tx01xa1x00x85x02x05tx19x01)x05x15x00%x01x95x05ux01x81x02x95x01ux03x81x01x05x01t0t1x15x81%x7fux08x95x02x81x06t8x15x81%x7fux08x95x01x81x06xc0xc0x05x0ctx01xa1x01x85x03ux10x95x01x15x01&x8cx02x19x01*x8cx02x81x00xc0', service=None)

Provide devices for HID over BLE.

Parameters:hid_descriptor (str) – USB HID descriptor that describes the structure of the reports. Known as the report map in BLE HID.

Example:

from adafruit_ble.hid_server import HIDServer

hid = HIDServer()
protocol_mode

boot (0) or report (1)

Type:Protocol mode
hid_information

Hid information including version, country code and flags.

report_map

This is the USB HID descriptor (not to be confused with a BLE Descriptor). It describes which report characteristic are what.

suspended

Controls whether the device should be suspended (0) or not (1).