@@ -115,27 +115,27 @@ void connect_callback(uint16_t conn_handle)
115
115
116
116
// Once HRM service is found, we continue to discover its characteristic
117
117
Serial.println (" Found it" );
118
- Serial.println (" Discovering Measurement and Body location characteristic ... " );
119
118
120
- uint8_t num_found_chr = Bluefruit.Discovery .discoverCharacteristic (conn_handle, hrmc, bslc);
121
-
122
- Serial.print (" Found " );
123
- Serial.print (num_found_chr);
124
- Serial.println (" Characteristics" );
125
-
126
- // Measurement chr is mandatory, if it is not found (valid), then disconnect
127
- if ( !hrmc.discovered () )
119
+
120
+ Serial.print (" Discovering Measurement characteristic ... " );
121
+ if ( !hrmc.discover () )
128
122
{
129
- Serial.println (" Measurement characteristic not found" );
123
+ // Measurement chr is mandatory, if it is not found (valid), then disconnect
124
+ Serial.println (" not found !!!" );
125
+ Serial.println (" Measurement characteristic is mandatory but not found" );
130
126
Bluefruit.Central .disconnect (conn_handle);
131
-
132
127
return ;
133
128
}
129
+ Serial.println (" Found it" );
134
130
131
+ // Measurement is found, continue to look for option Body Sensor Location
135
132
// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.body_sensor_location.xml
136
- // Body Sensor Location is optional, print its location (in text) if present
137
- if ( bslc.discovered () )
133
+ // Body Sensor Location is optional, print out the location in text if present
134
+ Serial.print (" Discovering Body Sensor Location characteristic ... " );
135
+ if ( bslc.discover () )
138
136
{
137
+ Serial.println (" Found it" );
138
+
139
139
// Body sensor location value is 8 bit
140
140
const char * body_str[] = { " Other" , " Chest" , " Wrist" , " Finger" , " Hand" , " Ear Lobe" , " Foot" };
141
141
@@ -145,6 +145,9 @@ void connect_callback(uint16_t conn_handle)
145
145
Serial.print (" Body Location Sensor: " );
146
146
Serial.println (body_str[loc_value]);
147
147
}
148
+ }else
149
+ {
150
+ Serial.println (" Found NONE" );
148
151
}
149
152
150
153
// Reaching here means we are ready to go, let's enable notification on measurement chr
0 commit comments