bluetooth.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* SPDX-License-Identifier: LGPL-2.1-or-later */
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
  7. *
  8. *
  9. */
  10. typedef void (*bt_bluetooth_ready)(int err, const bdaddr_t *addr);
  11. bool bt_bluetooth_start(int index, bool mgmt_dbg, bt_bluetooth_ready cb);
  12. typedef void (*bt_bluetooth_stopped)(void);
  13. bool bt_bluetooth_stop(bt_bluetooth_stopped cb);
  14. void bt_bluetooth_cleanup(void);
  15. bool bt_bluetooth_register(struct ipc *ipc, uint8_t mode);
  16. void bt_bluetooth_unregister(void);
  17. int bt_adapter_add_record(sdp_record_t *rec, uint8_t svc_hint);
  18. void bt_adapter_remove_record(uint32_t handle);
  19. typedef void (*bt_le_device_found)(const bdaddr_t *addr, int rssi,
  20. uint16_t eir_len, const void *eir,
  21. bool connectable, bool bonded);
  22. bool bt_le_register(bt_le_device_found cb);
  23. void bt_le_unregister(void);
  24. bool bt_le_discovery_start(void);
  25. typedef void (*bt_le_discovery_stopped)(void);
  26. bool bt_le_discovery_stop(bt_le_discovery_stopped cb);
  27. typedef void (*bt_le_set_advertising_done)(uint8_t status, void *user_data);
  28. bool bt_le_set_advertising(bool advertising, bt_le_set_advertising_done cb,
  29. void *user_data);
  30. uint8_t bt_get_device_android_type(const bdaddr_t *addr);
  31. bool bt_is_device_le(const bdaddr_t *addr);
  32. uint8_t bt_device_last_seen_bearer(const bdaddr_t *bdaddr);
  33. const char *bt_get_adapter_name(void);
  34. bool bt_device_is_bonded(const bdaddr_t *bdaddr);
  35. bool bt_device_set_uuids(const bdaddr_t *bdaddr, GSList *uuids);
  36. typedef void (*bt_read_device_rssi_done)(uint8_t status, const bdaddr_t *addr,
  37. int8_t rssi, void *user_data);
  38. bool bt_read_device_rssi(const bdaddr_t *addr, bt_read_device_rssi_done cb,
  39. void *user_data);
  40. bool bt_get_csrk(const bdaddr_t *addr, bool local, uint8_t key[16],
  41. uint32_t *sign_cnt, bool *authenticated);
  42. void bt_update_sign_counter(const bdaddr_t *addr, bool local, uint32_t val);
  43. void bt_store_gatt_ccc(const bdaddr_t *addr, uint16_t value);
  44. uint16_t bt_get_gatt_ccc(const bdaddr_t *addr);
  45. const bdaddr_t *bt_get_id_addr(const bdaddr_t *addr, uint8_t *type);
  46. bool bt_kernel_conn_control(void);
  47. bool bt_auto_connect_add(const bdaddr_t *addr);
  48. void bt_auto_connect_remove(const bdaddr_t *addr);
  49. typedef void (*bt_unpaired_device_cb)(const bdaddr_t *addr);
  50. bool bt_unpaired_register(bt_unpaired_device_cb cb);
  51. void bt_unpaired_unregister(bt_unpaired_device_cb cb);
  52. typedef void (*bt_paired_device_cb)(const bdaddr_t *addr);
  53. bool bt_paired_register(bt_paired_device_cb cb);
  54. void bt_paired_unregister(bt_paired_device_cb cb);
  55. bool bt_is_pairing(const bdaddr_t *addr);
  56. struct bt_ad;
  57. struct adv_instance {
  58. uint8_t instance;
  59. int32_t timeout;
  60. int32_t type;
  61. struct bt_ad *ad;
  62. struct bt_ad *sr;
  63. unsigned include_tx_power:1;
  64. };
  65. /* Values below have no C API definition - only in Java (AdvertiseManager.java)
  66. * and bluedroid
  67. */
  68. enum android_adv_type {
  69. ANDROID_ADVERTISING_EVENT_TYPE_CONNECTABLE = 0,
  70. ANDROID_ADVERTISING_EVENT_TYPE_SCANNABLE = 2,
  71. ANDROID_ADVERTISING_EVENT_TYPE_NON_CONNECTABLE = 3,
  72. };
  73. typedef void (*bt_le_addrm_advertising_done)(uint8_t status, void *user_data);
  74. bool bt_le_add_advertising(struct adv_instance *adv,
  75. bt_le_addrm_advertising_done cb, void *user_data);
  76. bool bt_le_remove_advertising(struct adv_instance *adv,
  77. bt_le_addrm_advertising_done cb, void *user_data);