OLD | NEW |
---|---|
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 // HCI Error Codes. Used for simulateGATT[Dis]ConnectionResponse. | |
4 // For a complete list of possible error codes see | |
5 // BT 4.2 Vol 2 Part D 1.3 List Of Error Codes. | |
6 const HCI_SUCCESS = 0x0000; | |
7 const HCI_CONNECTION_TIMEOUT = 0x0008; | |
8 | |
3 // Bluetooth UUID constants: | 9 // Bluetooth UUID constants: |
4 // Services: | 10 // Services: |
5 var blocklist_test_service_uuid = "611c954a-263b-4f4a-aab6-01ddb953f985"; | 11 var blocklist_test_service_uuid = "611c954a-263b-4f4a-aab6-01ddb953f985"; |
6 var request_disconnection_service_uuid = "01d7d889-7451-419f-aeb8-d65e7b9277af"; | 12 var request_disconnection_service_uuid = "01d7d889-7451-419f-aeb8-d65e7b9277af"; |
7 // Characteristics: | 13 // Characteristics: |
8 var blocklist_exclude_reads_characteristic_uuid = | 14 var blocklist_exclude_reads_characteristic_uuid = |
9 "bad1c9a2-9a5b-4015-8b60-1579bbbf2135"; | 15 "bad1c9a2-9a5b-4015-8b60-1579bbbf2135"; |
10 var request_disconnection_characteristic_uuid = | 16 var request_disconnection_characteristic_uuid = |
11 "01d7d88a-7451-419f-aeb8-d65e7b9277af"; | 17 "01d7d88a-7451-419f-aeb8-d65e7b9277af"; |
12 // Descriptors: | 18 // Descriptors: |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 address: '09:09:09:09:09:09', | 446 address: '09:09:09:09:09:09', |
441 name: 'Health Thermometer', | 447 name: 'Health Thermometer', |
442 knownServiceUUIDs: ['generic_access', 'health_thermometer'], | 448 knownServiceUUIDs: ['generic_access', 'health_thermometer'], |
443 }), | 449 }), |
444 fake_central.simulatePreconnectedPeripheral({ | 450 fake_central.simulatePreconnectedPeripheral({ |
445 address: '08:08:08:08:08:08', | 451 address: '08:08:08:08:08:08', |
446 name: 'Heart Rate', | 452 name: 'Heart Rate', |
447 knownServiceUUIDs: ['generic_access', 'heart_rate'], | 453 knownServiceUUIDs: ['generic_access', 'heart_rate'], |
448 })])); | 454 })])); |
449 } | 455 } |
456 | |
457 function getConnectedHealthThermometerDevice( | |
ortuno
2017/05/12 00:53:44
Forgot to mention this. This changes our testing p
| |
458 options = {filters: [{services: ['health_thermometer']}]}) { | |
459 return setUpPreconnectedDevice({ | |
460 address: '09:09:09:09:09:09', | |
461 name: 'Health Thermometer', | |
462 knownServiceUUIDs: ['generic_access', 'health_thermometer'], | |
463 }) | |
464 .then(fake_peripheral => { | |
465 return requestDeviceWithKeyDown(options) | |
scheib
2017/05/12 05:43:56
options parameter needed here ... because sometime
ortuno
2017/05/15 07:01:31
Yeah, there are quite a few tests that check getPr
| |
466 .then(device => Promise.all([ | |
467 device.gatt.connect(), | |
468 fake_peripheral.simulateGATTConnectionResponse({code: HCI_SUCCESS})])) | |
469 .then(([gatt]) => [gatt.device, fake_peripheral]); | |
470 }); | |
471 } | |
OLD | NEW |