MCPcopy Create free account
hub / github.com/XCSoar/XCSoar / onServicesDiscovered

Method onServicesDiscovered

android/src/BluetoothSensor.java:249–292  ·  view source on GitHub ↗
(BluetoothGatt gatt,
                                   int status)

Source from the content-addressed store, hash-verified

247 }
248
249 @Override
250 public void onServicesDiscovered(BluetoothGatt gatt,
251 int status) {
252 if (BluetoothGatt.GATT_SUCCESS != status) {
253 submitError("Discovering GATT services failed");
254 return;
255 }
256
257 BluetoothGattService service = gatt.getService(BluetoothUuids.HEART_RATE_SERVICE);
258 if (service != null) {
259 BluetoothGattCharacteristic c =
260 service.getCharacteristic(BluetoothUuids.HEART_RATE_MEASUREMENT_CHARACTERISTIC);
261 if (c != null) {
262 setStateSafe(STATE_READY);
263 enableNotification(c);
264 }
265 }
266
267 /* enable notifications for Flytec Sensbox */
268 service = gatt.getService(BluetoothUuids.FLYTEC_SENSBOX_SERVICE);
269 if (service != null) {
270 BluetoothGattCharacteristic c =
271 service.getCharacteristic(BluetoothUuids.FLYTEC_SENSBOX_NAVIGATION_SENSOR_CHARACTERISTIC);
272 if (c != null) {
273 setStateSafe(STATE_READY);
274 enableNotification(c);
275 }
276
277 c = service.getCharacteristic(BluetoothUuids.FLYTEC_SENSBOX_MOVEMENT_SENSOR_CHARACTERISTIC);
278 if (c != null)
279 enableNotification(c);
280
281 c = service.getCharacteristic(BluetoothUuids.FLYTEC_SENSBOX_SECOND_GPS_CHARACTERISTIC);
282 if (c != null)
283 enableNotification(c);
284
285 c = service.getCharacteristic(BluetoothUuids.FLYTEC_SENSBOX_SYSTEM_CHARACTERISTIC);
286 if (c != null)
287 enableNotification(c);
288 }
289
290 if (state == STATE_LIMBO)
291 submitError("Unsupported Bluetooth device");
292 }
293}

Callers

nothing calls this directly

Calls 3

submitErrorMethod · 0.95
setStateSafeMethod · 0.95
enableNotificationMethod · 0.95

Tested by

no test coverage detected