Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39ca860c authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

service: add get_gatt_db and it's callback to HAL

Change-Id: I6412b464c4299ea351446f384b539ffa2e6111b2
parent 428e3582
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -463,6 +463,7 @@ const btgatt_client_callbacks_t gatt_client_callbacks = {
    nullptr, /* batchscan_threshold_cb; */
    nullptr, /* track_adv_event_cb; */
    nullptr, /* scan_parameter_setup_completed_cb; */
    nullptr, /* get_gatt_db_cb; */
};

const btgatt_callbacks_t gatt_callbacks = {
+19 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ void ConnectCallback(int conn_id, int status, int client_if, bt_bdaddr_t* bda) {
          << " client_if: " << client_if
          << " - BD_ADDR: " << BtAddrString(bda)
          << " - conn_id: " << conn_id;

  FOR_EACH_CLIENT_OBSERVER(
    ConnectCallback(g_interface, conn_id, status, client_if, *bda));
}
@@ -247,6 +248,15 @@ void MultiAdvDisableCallback(int client_if, int status) {
      MultiAdvDisableCallback(g_interface, client_if, status));
}

void GetGattDbCallback(int conn_id, btgatt_db_element_t *db, int size) {
  shared_lock<shared_timed_mutex> lock(g_instance_lock);
  VLOG(2) << __func__ << " - conn_id: " << conn_id << " size: " << size;
  VERIFY_INTERFACE_OR_RETURN();

  FOR_EACH_CLIENT_OBSERVER(
      GetGattDbCallback(g_interface, conn_id, db, size));
}

void RegisterServerCallback(int status, int server_if, bt_uuid_t* app_uuid) {
  shared_lock<shared_timed_mutex> lock(g_instance_lock);
  VLOG(2) << __func__ << " - status: " << status << " server_if: " << server_if;
@@ -448,6 +458,7 @@ const btgatt_client_callbacks_t gatt_client_callbacks = {
    nullptr,  // batchscan_threshold_cb
    nullptr,  // track_adv_event_cb
    nullptr,  // scan_parameter_setup_completed_cb
    GetGattDbCallback,
};

const btgatt_server_callbacks_t gatt_server_callbacks = {
@@ -694,6 +705,14 @@ void BluetoothGattInterface::ClientObserver::MultiAdvDisableCallback(
  // Do nothing.
}

void BluetoothGattInterface::ClientObserver::GetGattDbCallback(
    BluetoothGattInterface* /* gatt_iface */,
    int /* conn_id */,
    btgatt_db_element_t* /* gatt_db */,
    int /* size */) {
  // Do nothing.
}

void BluetoothGattInterface::ServerObserver::RegisterServerCallback(
    BluetoothGattInterface* /* gatt_iface */,
    int /* status */,
+5 −1
Original line number Diff line number Diff line
@@ -126,7 +126,11 @@ class BluetoothGattInterface {
        BluetoothGattInterface* gatt_iface,
        int client_if, int status);

    // TODO(armansito): Complete the list of callbacks.
    virtual void GetGattDbCallback(
        BluetoothGattInterface* gatt_iface,
        int conn_id,
        btgatt_db_element_t* gatt_db,
        int size);
  };

  // The standard BT-GATT server callback interface.
+1 −0
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@ btgatt_client_interface_t fake_btgattc_iface = {
  nullptr,  // batchscan_dis_batch_scan
  nullptr,  // batchscan_read_reports
  nullptr,  // test_command
  nullptr,  // get_gatt_db
};

btgatt_server_interface_t fake_btgatts_iface = {