File tree Expand file tree Collapse file tree 10 files changed +32
-14
lines changed Expand file tree Collapse file tree 10 files changed +32
-14
lines changed Original file line number Diff line number Diff line change @@ -72,11 +72,11 @@ BLECharacteristic::BLECharacteristic(const BLECharacteristic& other)
7272
7373BLECharacteristic::~BLECharacteristic ()
7474{
75- if (_local && _local->release () < = 0 ) {
75+ if (_local && _local->release () = = 0 ) {
7676 delete _local;
7777 }
7878
79- if (_remote && _remote->release () < = 0 ) {
79+ if (_remote && _remote->release () = = 0 ) {
8080 delete _remote;
8181 }
8282}
Original file line number Diff line number Diff line change @@ -72,11 +72,11 @@ BLEDescriptor::BLEDescriptor(const BLEDescriptor& other)
7272
7373BLEDescriptor::~BLEDescriptor ()
7474{
75- if (_local && _local->release () < = 0 ) {
75+ if (_local && _local->release () = = 0 ) {
7676 delete _local;
7777 }
7878
79- if (_remote && _remote->release () < = 0 ) {
79+ if (_remote && _remote->release () = = 0 ) {
8080 delete _remote;
8181 }
8282}
Original file line number Diff line number Diff line change @@ -65,11 +65,11 @@ BLEService::BLEService(const BLEService& other)
6565
6666BLEService::~BLEService ()
6767{
68- if (_local && _local->release () < = 0 ) {
68+ if (_local && _local->release () = = 0 ) {
6969 delete _local;
7070 }
7171
72- if (_remote && _remote->release () < = 0 ) {
72+ if (_remote && _remote->release () = = 0 ) {
7373 delete _remote;
7474 }
7575}
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ BLELocalCharacteristic::~BLELocalCharacteristic()
6262 for (unsigned int i = 0 ; i < descriptorCount (); i++) {
6363 BLELocalDescriptor* d = descriptor (i);
6464
65- if (d->release () < = 0 ) {
65+ if (d->release () = = 0 ) {
6666 delete d;
6767 }
6868 }
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ BLELocalService::~BLELocalService()
3333 for (unsigned int i = 0 ; i < characteristicCount (); i++) {
3434 BLELocalCharacteristic* c = characteristic (i);
3535
36- if (c->release () < = 0 ) {
36+ if (c->release () = = 0 ) {
3737 delete c;
3838 }
3939 }
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ BLERemoteCharacteristic::~BLERemoteCharacteristic()
4444 for (unsigned int i = 0 ; i < descriptorCount (); i++) {
4545 BLERemoteDescriptor* d = descriptor (i);
4646
47- if (d->release () < = 0 ) {
47+ if (d->release () = = 0 ) {
4848 delete d;
4949 }
5050 }
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ void BLERemoteDevice::clearServices()
5050 for (unsigned int i = 0 ; i < serviceCount (); i++) {
5151 BLERemoteService* s = service (i);
5252
53- if (s->release () < = 0 ) {
53+ if (s->release () = = 0 ) {
5454 delete s;
5555 }
5656 }
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ BLERemoteService::~BLERemoteService()
3131 for (unsigned int i = 0 ; i < characteristicCount (); i++) {
3232 BLERemoteCharacteristic* c = characteristic (i);
3333
34- if (c->release () < = 0 ) {
34+ if (c->release () = = 0 ) {
3535 delete c;
3636 }
3737 }
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ GATTClass::GATTClass() :
3838
3939GATTClass::~GATTClass ()
4040{
41- clearAttributes ();
41+ end ();
4242}
4343
4444void GATTClass::begin ()
@@ -70,7 +70,22 @@ void GATTClass::begin()
7070
7171void GATTClass::end ()
7272{
73- _attributes.clear ();
73+ if (_genericAccessService->release () == 0 )
74+ delete (_genericAccessService);
75+
76+ if (_deviceNameCharacteristic->release () == 0 )
77+ delete (_deviceNameCharacteristic);
78+
79+ if (_appearanceCharacteristic->release () == 0 )
80+ delete (_appearanceCharacteristic);
81+
82+ if (_genericAttributeService->release () == 0 )
83+ delete (_genericAttributeService);
84+
85+ if (_servicesChangedCharacteristic->release () == 0 )
86+ delete (_servicesChangedCharacteristic);
87+
88+ clearAttributes ();
7489}
7590
7691void GATTClass::setDeviceName (const char * deviceName)
@@ -164,7 +179,7 @@ void GATTClass::clearAttributes()
164179 for (unsigned int i = 0 ; i < attributeCount (); i++) {
165180 BLELocalAttribute* a = attribute (i);
166181
167- if (a->release () < = 0 ) {
182+ if (a->release () = = 0 ) {
168183 delete a;
169184 }
170185 }
Original file line number Diff line number Diff line change @@ -234,7 +234,10 @@ void HCICordioTransportClass::end()
234234 delete bleLoopThread;
235235 bleLoopThread = NULL ;
236236 }
237+
238+ #if !defined(ARDUINO_PORTENTA_H7_M4) && !defined(ARDUINO_PORTENTA_H7_M7) && !defined(ARDUINO_NICLA_VISION)
237239 CordioHCIHook::getDriver ().terminate ();
240+ #endif
238241
239242 _begun = false ;
240243}
You can’t perform that action at this time.
0 commit comments