@@ -31,11 +31,9 @@ GATTClass::GATTClass() :
31
31
_genericAccessService(NULL ),
32
32
_deviceNameCharacteristic(NULL ),
33
33
_appearanceCharacteristic(NULL ),
34
-
35
- _PPCPCharacteristic(NULL ),
36
-
34
+ _preferredConnectionParametersCharacteristic(NULL ),
37
35
_genericAttributeService(NULL )
38
- // _servicesChangedCharacteristic(NULL) // removed
36
+ // _servicesChangedCharacteristic(NULL)
39
37
{
40
38
}
41
39
@@ -49,30 +47,25 @@ void GATTClass::begin()
49
47
_genericAccessService = new BLELocalService (" 1800" );
50
48
_deviceNameCharacteristic = new BLELocalCharacteristic (" 2a00" , BLERead, 20 );
51
49
_appearanceCharacteristic = new BLELocalCharacteristic (" 2a01" , BLERead, 2 );
52
-
53
- _PPCPCharacteristic = new BLELocalCharacteristic (" 2a04" , BLERead, 8 );
54
-
50
+ _preferredConnectionParametersCharacteristic = new BLELocalCharacteristic (" 2a04" , BLERead, 8 );
55
51
_genericAttributeService = new BLELocalService (" 1801" );
56
- // _servicesChangedCharacteristic = new BLELocalCharacteristic("2a05", BLEIndicate, 4); // removed
52
+ // _servicesChangedCharacteristic = new BLELocalCharacteristic("2a05", BLEIndicate, 4);
57
53
58
54
_genericAccessService->retain ();
59
55
_deviceNameCharacteristic->retain ();
60
56
_appearanceCharacteristic->retain ();
61
-
62
- _PPCPCharacteristic->retain ();
63
-
57
+ _preferredConnectionParametersCharacteristic->retain ();
64
58
_genericAttributeService->retain ();
65
- // _servicesChangedCharacteristic->retain(); // removed
59
+ // _servicesChangedCharacteristic->retain();
66
60
67
61
_genericAccessService->addCharacteristic (_deviceNameCharacteristic);
68
62
_genericAccessService->addCharacteristic (_appearanceCharacteristic);
69
- _genericAccessService->addCharacteristic (_PPCPCharacteristic );
70
- // _genericAttributeService->addCharacteristic(_servicesChangedCharacteristic); // removed
63
+ _genericAccessService->addCharacteristic (_preferredConnectionParametersCharacteristic );
64
+ // _genericAttributeService->addCharacteristic(_servicesChangedCharacteristic);
71
65
72
66
setDeviceName (" Arduino" );
73
67
setAppearance (0x000 );
74
-
75
- setPPCP (DEFAULT_PPCP_minimumConnectionInterval, DEFAULT_PPCP_maximumConnectionInterval, DEFAULT_PPCP_slaveLatency, DEFAULT_PPCP_connectionSupervisionTimeout);
68
+ setPreferredConnectionParameters (GAP_PPCP_MIN_CONN_INTERVAL, GAP_PPCP_MAX_CONN_INTERVAL, GAP_PPCP_SLAVE_LATENCY, GAP_PPCP_SUPERVISION_TMO);
76
69
77
70
clearAttributes ();
78
71
@@ -97,21 +90,21 @@ void GATTClass::end()
97
90
_appearanceCharacteristic = NULL ;
98
91
}
99
92
100
- if (_PPCPCharacteristic &&_PPCPCharacteristic ->release () == 0 ) {
101
- delete (_PPCPCharacteristic );
102
- _PPCPCharacteristic = NULL ;
93
+ if (_preferredConnectionParametersCharacteristic &&_preferredConnectionParametersCharacteristic ->release () == 0 ) {
94
+ delete (_preferredConnectionParametersCharacteristic );
95
+ _preferredConnectionParametersCharacteristic = NULL ;
103
96
}
104
97
105
98
if (_genericAttributeService && _genericAttributeService->release () == 0 ) {
106
99
delete (_genericAttributeService);
107
100
_genericAttributeService = NULL ;
108
101
}
109
-
110
- // if (_servicesChangedCharacteristic && _servicesChangedCharacteristic->release() == 0) {
111
- // delete(_servicesChangedCharacteristic);
112
- // _servicesChangedCharacteristic = NULL;
113
- // }
114
-
102
+ /*
103
+ if (_servicesChangedCharacteristic && _servicesChangedCharacteristic->release() == 0) {
104
+ delete(_servicesChangedCharacteristic);
105
+ _servicesChangedCharacteristic = NULL;
106
+ }
107
+ */
115
108
clearAttributes ();
116
109
}
117
110
@@ -125,9 +118,9 @@ void GATTClass::setAppearance(uint16_t appearance)
125
118
_appearanceCharacteristic->writeValue ((uint8_t *)&appearance, sizeof (appearance));
126
119
}
127
120
128
- void GATTClass::setPPCP (uint16_t minimumConnectionInterval, uint16_t maximumConnectionInterval, uint16_t slaveLatency, uint16_t connectionSupervisionTimeout)
121
+ void GATTClass::setPreferredConnectionParameters (uint16_t minimumConnectionInterval, uint16_t maximumConnectionInterval, uint16_t slaveLatency, uint16_t connectionSupervisionTimeout)
129
122
{
130
- uint16_t PPCPData[] = { minimumConnectionInterval, maximumConnectionInterval, slaveLatency, connectionSupervisionTimeout };
123
+ uint16_t PPCPData[] = {minimumConnectionInterval, maximumConnectionInterval, slaveLatency, connectionSupervisionTimeout};
131
124
_PPCPCharacteristic->writeValue ((uint8_t *)&PPCPData, sizeof (PPCPData));
132
125
}
133
126
0 commit comments