GAP interface

class pybtle.gap.gap(cmd)

Generic Access Profile (GAP) class

advertising_set_interval(min_interval, max_interval)

Set Advertisinig interval

Parameters:
  • min_interval (int) – Minimum advertising interval (> 20ms)
  • max_interval (int) – Maximum advertising interval (< 10240ms)
advertising_set_local_name(name)

Set Advertisinig Local Name

Parameters:Name (str) – Local Name
connect(devId, addr, addrtype, sec_level, discovery_cb=None)

Create a connection

Parameters:
  • devId (int) – Adapter index.
  • addr (str) – BLE address to connect (00:11:22:33:44:55).
  • addrtype (str) – “public” or “random”
  • sec_level (str) – security level from (“low”, “medium”, “high”)
  • discovery_cb (callback) –

Returns:

{
    'result': ("ok", "error"),
    'reason': "failure reason"
}
connection_setpcp(min_interval, max_interval, latency, timeout)

Set GAP Peripheral Preferred Connection Parameters

Parameters:
  • min_interval (int) – Minimum connection interval
  • max_interval (int) – Maximum connection interval
  • latency (int) – latency
  • timeout (int) – Supervision timeout

Returns:

{
    'result': ("ok", "error"),
    'reason': "failure reason"
}