Loading system/stack/btm/ble_advertiser_hci_interface.cc +27 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,12 @@ class BleAdvertiserVscHciInterfaceImpl : public BleAdvertiserHciInterface { return false; } void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) override { // VSC Advertising don't have remove method. command_complete.Run(0); } public: static void VendorSpecificEventCback(uint8_t length, uint8_t* p) { VLOG(1) << __func__; Loading Loading @@ -404,6 +410,12 @@ class BleAdvertiserLegacyHciInterfaceImpl : public BleAdvertiserHciInterface { LOG(INFO) << __func__ << "Legacy can't do periodic advertising"; command_complete.Run(HCI_ERR_ILLEGAL_COMMAND); } void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) override { // Legacy Advertising don't have remove method. command_complete.Run(0); } }; class BleAdvertiserHciExtendedImpl : public BleAdvertiserHciInterface { Loading Loading @@ -591,6 +603,21 @@ class BleAdvertiserHciExtendedImpl : public BleAdvertiserHciInterface { HCI_LE_ENABLE_PRIODIC_ADVERTISEMENT_LEN, command_complete); } void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) override { VLOG(1) << __func__; const uint16_t cmd_length = 1; uint8_t param[cmd_length]; memset(param, 0, cmd_length); uint8_t* pp = param; UINT8_TO_STREAM(pp, handle); SendAdvCmd(FROM_HERE, HCI_LE_REMOVE_ADVERTISING_SET, param, cmd_length, command_complete); } public: void OnAdvertisingSetTerminated(uint8_t length, uint8_t* p) { VLOG(1) << __func__; Loading system/stack/btm/ble_advertiser_hci_interface.h +2 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ class BleAdvertiserHciInterface { status_cb command_complete) = 0; virtual void SetPeriodicAdvertisingEnable(uint8_t enable, uint8_t handle, status_cb command_complete) = 0; virtual void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) = 0; // Some implementation don't behave well when handle value 0 is used. virtual bool QuirkAdvertiserZeroHandle() { return 0; } Loading system/stack/test/ble_advertiser_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ class AdvertiserHciMock : public BleAdvertiserHciInterface { MOCK_METHOD5(SetPeriodicAdvertisingData, void(uint8_t, uint8_t, uint8_t, uint8_t*, status_cb)); MOCK_METHOD3(SetPeriodicAdvertisingEnable, void(uint8_t, uint8_t, status_cb)); MOCK_METHOD2(RemoveAdvertisingSet, void(uint8_t, status_cb)); MOCK_METHOD9(SetParameters1, void(uint8_t, uint16_t, uint32_t, uint32_t, uint8_t, uint8_t, Loading Loading
system/stack/btm/ble_advertiser_hci_interface.cc +27 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,12 @@ class BleAdvertiserVscHciInterfaceImpl : public BleAdvertiserHciInterface { return false; } void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) override { // VSC Advertising don't have remove method. command_complete.Run(0); } public: static void VendorSpecificEventCback(uint8_t length, uint8_t* p) { VLOG(1) << __func__; Loading Loading @@ -404,6 +410,12 @@ class BleAdvertiserLegacyHciInterfaceImpl : public BleAdvertiserHciInterface { LOG(INFO) << __func__ << "Legacy can't do periodic advertising"; command_complete.Run(HCI_ERR_ILLEGAL_COMMAND); } void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) override { // Legacy Advertising don't have remove method. command_complete.Run(0); } }; class BleAdvertiserHciExtendedImpl : public BleAdvertiserHciInterface { Loading Loading @@ -591,6 +603,21 @@ class BleAdvertiserHciExtendedImpl : public BleAdvertiserHciInterface { HCI_LE_ENABLE_PRIODIC_ADVERTISEMENT_LEN, command_complete); } void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) override { VLOG(1) << __func__; const uint16_t cmd_length = 1; uint8_t param[cmd_length]; memset(param, 0, cmd_length); uint8_t* pp = param; UINT8_TO_STREAM(pp, handle); SendAdvCmd(FROM_HERE, HCI_LE_REMOVE_ADVERTISING_SET, param, cmd_length, command_complete); } public: void OnAdvertisingSetTerminated(uint8_t length, uint8_t* p) { VLOG(1) << __func__; Loading
system/stack/btm/ble_advertiser_hci_interface.h +2 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ class BleAdvertiserHciInterface { status_cb command_complete) = 0; virtual void SetPeriodicAdvertisingEnable(uint8_t enable, uint8_t handle, status_cb command_complete) = 0; virtual void RemoveAdvertisingSet(uint8_t handle, status_cb command_complete) = 0; // Some implementation don't behave well when handle value 0 is used. virtual bool QuirkAdvertiserZeroHandle() { return 0; } Loading
system/stack/test/ble_advertiser_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ class AdvertiserHciMock : public BleAdvertiserHciInterface { MOCK_METHOD5(SetPeriodicAdvertisingData, void(uint8_t, uint8_t, uint8_t, uint8_t*, status_cb)); MOCK_METHOD3(SetPeriodicAdvertisingEnable, void(uint8_t, uint8_t, status_cb)); MOCK_METHOD2(RemoveAdvertisingSet, void(uint8_t, status_cb)); MOCK_METHOD9(SetParameters1, void(uint8_t, uint16_t, uint32_t, uint32_t, uint8_t, uint8_t, Loading