mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Add G3 gatt server
PiperOrigin-RevId: 531287485
This commit is contained in:
committed by
Copybara-Service
parent
3241efb292
commit
b5938c0d17
@@ -160,7 +160,8 @@ class BleMedium : public api::ble_v2::BleMedium {
|
||||
class GattServer : public api::ble_v2::GattServer {
|
||||
public:
|
||||
GattServer() = default;
|
||||
explicit GattServer(GNCMBlePeripheral *peripheral) : peripheral_(peripheral) {}
|
||||
GattServer(BluetoothAdapter *adapter, GNCMBlePeripheral *peripheral)
|
||||
: adapter_(adapter), peripheral_(peripheral) {}
|
||||
|
||||
absl::optional<api::ble_v2::GattCharacteristic> CreateCharacteristic(
|
||||
const Uuid &service_uuid, const Uuid &characteristic_uuid,
|
||||
@@ -172,8 +173,10 @@ class BleMedium : public api::ble_v2::BleMedium {
|
||||
absl::Status NotifyCharacteristicChanged(const api::ble_v2::GattCharacteristic &characteristic,
|
||||
bool confirm, const ByteArray &new_value) override;
|
||||
void Stop() override;
|
||||
BlePeripheral &GetBlePeripheral() override { return adapter_->GetPeripheral(); }
|
||||
|
||||
private:
|
||||
BluetoothAdapter *adapter_ = nullptr;
|
||||
GNCMBlePeripheral *peripheral_;
|
||||
};
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ std::unique_ptr<api::ble_v2::GattServer> BleMedium::StartGattServer(
|
||||
if (!peripheral_) {
|
||||
peripheral_ = [[GNCMBlePeripheral alloc] init];
|
||||
}
|
||||
return std::make_unique<GattServer>(peripheral_);
|
||||
return std::make_unique<GattServer>(adapter_, peripheral_);
|
||||
}
|
||||
|
||||
std::unique_ptr<api::ble_v2::GattClient> BleMedium::ConnectToGattServer(
|
||||
|
||||
Reference in New Issue
Block a user