@@ -31,11 +31,9 @@ GATTClass::GATTClass() :
3131 _genericAccessService(NULL ),
3232 _deviceNameCharacteristic(NULL ),
3333 _appearanceCharacteristic(NULL ),
34-
35- _PPCPCharacteristic(NULL ),
36-
34+ _preferredConnectionParametersCharacteristic(NULL ),
3735 _genericAttributeService(NULL )
38- // _servicesChangedCharacteristic(NULL) // removed
36+ // _servicesChangedCharacteristic(NULL)
3937{
4038}
4139
@@ -49,30 +47,25 @@ void GATTClass::begin()
4947 _genericAccessService = new BLELocalService (" 1800" );
5048 _deviceNameCharacteristic = new BLELocalCharacteristic (" 2a00" , BLERead, 20 );
5149 _appearanceCharacteristic = new BLELocalCharacteristic (" 2a01" , BLERead, 2 );
52-
53- _PPCPCharacteristic = new BLELocalCharacteristic (" 2a04" , BLERead, 8 );
54-
50+ _preferredConnectionParametersCharacteristic = new BLELocalCharacteristic (" 2a04" , BLERead, 8 );
5551 _genericAttributeService = new BLELocalService (" 1801" );
56- // _servicesChangedCharacteristic = new BLELocalCharacteristic("2a05", BLEIndicate, 4); // removed
52+ // _servicesChangedCharacteristic = new BLELocalCharacteristic("2a05", BLEIndicate, 4);
5753
5854 _genericAccessService->retain ();
5955 _deviceNameCharacteristic->retain ();
6056 _appearanceCharacteristic->retain ();
61-
62- _PPCPCharacteristic->retain ();
63-
57+ _preferredConnectionParametersCharacteristic->retain ();
6458 _genericAttributeService->retain ();
65- // _servicesChangedCharacteristic->retain(); // removed
59+ // _servicesChangedCharacteristic->retain();
6660
6761 _genericAccessService->addCharacteristic (_deviceNameCharacteristic);
6862 _genericAccessService->addCharacteristic (_appearanceCharacteristic);
69- _genericAccessService->addCharacteristic (_PPCPCharacteristic );
70- // _genericAttributeService->addCharacteristic(_servicesChangedCharacteristic); // removed
63+ _genericAccessService->addCharacteristic (_preferredConnectionParametersCharacteristic );
64+ // _genericAttributeService->addCharacteristic(_servicesChangedCharacteristic);
7165
7266 setDeviceName (" Arduino" );
7367 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);
7669
7770 clearAttributes ();
7871
@@ -97,21 +90,21 @@ void GATTClass::end()
9790 _appearanceCharacteristic = NULL ;
9891 }
9992
100- if (_PPCPCharacteristic &&_PPCPCharacteristic ->release () == 0 ) {
101- delete (_PPCPCharacteristic );
102- _PPCPCharacteristic = NULL ;
93+ if (_preferredConnectionParametersCharacteristic &&_preferredConnectionParametersCharacteristic ->release () == 0 ) {
94+ delete (_preferredConnectionParametersCharacteristic );
95+ _preferredConnectionParametersCharacteristic = NULL ;
10396 }
10497
10598 if (_genericAttributeService && _genericAttributeService->release () == 0 ) {
10699 delete (_genericAttributeService);
107100 _genericAttributeService = NULL ;
108101 }
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+ */
115108 clearAttributes ();
116109}
117110
@@ -125,9 +118,9 @@ void GATTClass::setAppearance(uint16_t appearance)
125118 _appearanceCharacteristic->writeValue ((uint8_t *)&appearance, sizeof (appearance));
126119}
127120
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)
129122{
130- uint16_t PPCPData[] = { minimumConnectionInterval, maximumConnectionInterval, slaveLatency, connectionSupervisionTimeout };
123+ uint16_t PPCPData[] = {minimumConnectionInterval, maximumConnectionInterval, slaveLatency, connectionSupervisionTimeout};
131124 _PPCPCharacteristic->writeValue ((uint8_t *)&PPCPData, sizeof (PPCPData));
132125}
133126
0 commit comments