File tree 10 files changed +32
-14
lines changed
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)
72
72
73
73
BLECharacteristic::~BLECharacteristic ()
74
74
{
75
- if (_local && _local->release () < = 0 ) {
75
+ if (_local && _local->release () = = 0 ) {
76
76
delete _local;
77
77
}
78
78
79
- if (_remote && _remote->release () < = 0 ) {
79
+ if (_remote && _remote->release () = = 0 ) {
80
80
delete _remote;
81
81
}
82
82
}
Original file line number Diff line number Diff line change @@ -72,11 +72,11 @@ BLEDescriptor::BLEDescriptor(const BLEDescriptor& other)
72
72
73
73
BLEDescriptor::~BLEDescriptor ()
74
74
{
75
- if (_local && _local->release () < = 0 ) {
75
+ if (_local && _local->release () = = 0 ) {
76
76
delete _local;
77
77
}
78
78
79
- if (_remote && _remote->release () < = 0 ) {
79
+ if (_remote && _remote->release () = = 0 ) {
80
80
delete _remote;
81
81
}
82
82
}
Original file line number Diff line number Diff line change @@ -65,11 +65,11 @@ BLEService::BLEService(const BLEService& other)
65
65
66
66
BLEService::~BLEService ()
67
67
{
68
- if (_local && _local->release () < = 0 ) {
68
+ if (_local && _local->release () = = 0 ) {
69
69
delete _local;
70
70
}
71
71
72
- if (_remote && _remote->release () < = 0 ) {
72
+ if (_remote && _remote->release () = = 0 ) {
73
73
delete _remote;
74
74
}
75
75
}
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ BLELocalCharacteristic::~BLELocalCharacteristic()
62
62
for (unsigned int i = 0 ; i < descriptorCount (); i++) {
63
63
BLELocalDescriptor* d = descriptor (i);
64
64
65
- if (d->release () < = 0 ) {
65
+ if (d->release () = = 0 ) {
66
66
delete d;
67
67
}
68
68
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ BLELocalService::~BLELocalService()
33
33
for (unsigned int i = 0 ; i < characteristicCount (); i++) {
34
34
BLELocalCharacteristic* c = characteristic (i);
35
35
36
- if (c->release () < = 0 ) {
36
+ if (c->release () = = 0 ) {
37
37
delete c;
38
38
}
39
39
}
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ BLERemoteCharacteristic::~BLERemoteCharacteristic()
44
44
for (unsigned int i = 0 ; i < descriptorCount (); i++) {
45
45
BLERemoteDescriptor* d = descriptor (i);
46
46
47
- if (d->release () < = 0 ) {
47
+ if (d->release () = = 0 ) {
48
48
delete d;
49
49
}
50
50
}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ void BLERemoteDevice::clearServices()
50
50
for (unsigned int i = 0 ; i < serviceCount (); i++) {
51
51
BLERemoteService* s = service (i);
52
52
53
- if (s->release () < = 0 ) {
53
+ if (s->release () = = 0 ) {
54
54
delete s;
55
55
}
56
56
}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ BLERemoteService::~BLERemoteService()
31
31
for (unsigned int i = 0 ; i < characteristicCount (); i++) {
32
32
BLERemoteCharacteristic* c = characteristic (i);
33
33
34
- if (c->release () < = 0 ) {
34
+ if (c->release () = = 0 ) {
35
35
delete c;
36
36
}
37
37
}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ GATTClass::GATTClass() :
38
38
39
39
GATTClass::~GATTClass ()
40
40
{
41
- clearAttributes ();
41
+ end ();
42
42
}
43
43
44
44
void GATTClass::begin ()
@@ -70,7 +70,22 @@ void GATTClass::begin()
70
70
71
71
void GATTClass::end ()
72
72
{
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 ();
74
89
}
75
90
76
91
void GATTClass::setDeviceName (const char * deviceName)
@@ -164,7 +179,7 @@ void GATTClass::clearAttributes()
164
179
for (unsigned int i = 0 ; i < attributeCount (); i++) {
165
180
BLELocalAttribute* a = attribute (i);
166
181
167
- if (a->release () < = 0 ) {
182
+ if (a->release () = = 0 ) {
168
183
delete a;
169
184
}
170
185
}
Original file line number Diff line number Diff line change @@ -234,7 +234,10 @@ void HCICordioTransportClass::end()
234
234
delete bleLoopThread;
235
235
bleLoopThread = NULL ;
236
236
}
237
+
238
+ #if !defined(ARDUINO_PORTENTA_H7_M4) && !defined(ARDUINO_PORTENTA_H7_M7) && !defined(ARDUINO_NICLA_VISION)
237
239
CordioHCIHook::getDriver ().terminate ();
240
+ #endif
238
241
239
242
_begun = false ;
240
243
}
You can’t perform that action at this time.
0 commit comments