| OLD | NEW |
| (Empty) |
| 1 'use strict'; | |
| 2 | |
| 3 // Bluetooth UUID constants: | |
| 4 // Services: | |
| 5 var blacklist_test_service_uuid = "611c954a-263b-4f4a-aab6-01ddb953f985"; | |
| 6 var request_disconnection_service_uuid = "01d7d889-7451-419f-aeb8-d65e7b9277af"; | |
| 7 // Characteristics: | |
| 8 var blacklist_exclude_reads_characteristic_uuid = "bad1c9a2-9a5b-4015-8b60-1579b
bbf2135"; | |
| 9 var request_disconnection_characteristic_uuid = "01d7d88a-7451-419f-aeb8-d65e7b9
277af"; | |
| 10 // Descriptors: | |
| 11 var blacklist_exclude_reads_descriptor_uuid = "aaaaaaaa-aaaa-1181-0510-810819516
110"; | |
| 12 var blacklist_descriptor_uuid = "07711111-6104-0970-7011-1107105110aaa"; | |
| 13 var characteristic_user_description_uuid = "00002901-0000-1000-8000-00805f9b34fb
"; | |
| 14 | |
| 15 // Bluetooth Adapter types: | |
| 16 var adapter_type = { | |
| 17 not_present: 'NotPresentAdapter', | |
| 18 not_powered: 'NotPoweredAdapter', | |
| 19 empty: 'EmptyAdapter', | |
| 20 heart_rate: 'HeartRateAdapter', | |
| 21 two_heart_rate: 'TwoHeartRateServicesAdapter', | |
| 22 empty_name_heart_rate: 'EmptyNameHeartRateAdapter', | |
| 23 no_name_heart_rate: 'NoNameHeartRateAdapter', | |
| 24 glucose_heart_rate: 'GlucoseHeartRateAdapter', | |
| 25 unicode_device: 'UnicodeDeviceAdapter', | |
| 26 blacklist: 'BlacklistTestAdapter', | |
| 27 missing_characteristic_heart_rate: 'MissingCharacteristicHeartRateAdapter', | |
| 28 missing_service_heart_rate: 'MissingServiceHeartRateAdapter', | |
| 29 missing_descriptor_heart_rate: 'MissingDescriptorHeartRateAdapter' | |
| 30 }; | |
| 31 | |
| 32 var mock_device_name = { | |
| 33 heart_rate: 'Heart Rate Device', | |
| 34 glucose: 'Glucose Device' | |
| 35 }; | |
| 36 | |
| 37 var wrong = { | |
| 38 name: 'wrong_name', | |
| 39 service: 'wrong_service' | |
| 40 }; | |
| 41 | |
| 42 // Sometimes we need to test that using either the name, alias, or UUID | |
| 43 // produces the same result. The following objects help us do that. | |
| 44 var generic_access = { | |
| 45 alias: 0x1800, | |
| 46 name: 'generic_access', | |
| 47 uuid: '00001800-0000-1000-8000-00805f9b34fb' | |
| 48 }; | |
| 49 | |
| 50 var device_name = { | |
| 51 alias: 0x2a00, | |
| 52 name: 'gap.device_name', | |
| 53 uuid: '00002a00-0000-1000-8000-00805f9b34fb' | |
| 54 }; | |
| 55 | |
| 56 var reconnection_address = { | |
| 57 alias: 0x2a03, | |
| 58 name: 'gap.reconnection_address', | |
| 59 uuid: '00002a03-0000-1000-8000-00805f9b34fb' | |
| 60 }; | |
| 61 | |
| 62 var heart_rate = { | |
| 63 alias: 0x180d, | |
| 64 name: 'heart_rate', | |
| 65 uuid: '0000180d-0000-1000-8000-00805f9b34fb' | |
| 66 }; | |
| 67 | |
| 68 var heart_rate_measurement = { | |
| 69 alias: 0x2a37, | |
| 70 name: 'heart_rate_measurement', | |
| 71 uuid: '00002a37-0000-1000-8000-00805f9b34fb' | |
| 72 }; | |
| 73 | |
| 74 var body_sensor_location = { | |
| 75 alias: 0x2a38, | |
| 76 name: 'body_sensor_location', | |
| 77 uuid: '00002a38-0000-1000-8000-00805f9b34fb' | |
| 78 }; | |
| 79 | |
| 80 var glucose = { | |
| 81 alias: 0x1808, | |
| 82 name: 'glucose', | |
| 83 uuid: '00001808-0000-1000-8000-00805f9b34fb' | |
| 84 }; | |
| 85 | |
| 86 var battery_service = { | |
| 87 alias: 0x180f, | |
| 88 name: 'battery_service', | |
| 89 uuid: '0000180f-0000-1000-8000-00805f9b34fb' | |
| 90 }; | |
| 91 | |
| 92 var battery_level = { | |
| 93 alias: 0x2a19, | |
| 94 name: 'battery_level', | |
| 95 uuid: '00002a19-0000-1000-8000-00805f9b34fb' | |
| 96 }; | |
| 97 | |
| 98 var tx_power = { | |
| 99 alias: 0x1804, | |
| 100 name: 'tx_power', | |
| 101 uuid: '00001804-0000-1000-8000-00805f9b34fb' | |
| 102 }; | |
| 103 | |
| 104 var human_interface_device = { | |
| 105 alias: 0x1812, | |
| 106 name: 'human_interface_device', | |
| 107 uuid: '00001812-0000-1000-8000-00805f9b34fb' | |
| 108 }; | |
| 109 | |
| 110 var device_information = { | |
| 111 alias: 0x180a, | |
| 112 name: 'device_information', | |
| 113 uuid: '0000180a-0000-1000-8000-00805f9b34fb' | |
| 114 }; | |
| 115 | |
| 116 var peripherial_privacy_flag = { | |
| 117 alias: 0x2a02, | |
| 118 name: 'gap.peripheral_privacy_flag', | |
| 119 uuid: '00002a02-0000-1000-8000-00805f9b34fb' | |
| 120 }; | |
| 121 | |
| 122 var serial_number_string = { | |
| 123 alias: 0x2a25, | |
| 124 name: 'serial_number_string', | |
| 125 uuid: '00002a25-0000-1000-8000-00805f9b34fb' | |
| 126 }; | |
| 127 | |
| 128 var client_characteristic_configuration = { | |
| 129 alias: 0x2902, | |
| 130 name: 'gatt.client_characteristic_configuration', | |
| 131 uuid: '00002902-0000-1000-8000-00805f9b34fb' | |
| 132 }; | |
| 133 | |
| 134 var number_of_digitals = { | |
| 135 alias: 0x2909, | |
| 136 name: 'number_of_digitals', | |
| 137 uuid: '00002909-0000-1000-8000-00805f9b34fb' | |
| 138 }; | |
| 139 | |
| 140 // Helper function for converting strings to an array of bytes. | |
| 141 function asciiToDecimal(bytestr) { | |
| 142 var result = []; | |
| 143 for(var i = 0; i < bytestr.length; i++) { | |
| 144 result[i] = bytestr.charCodeAt(i) ; | |
| 145 } | |
| 146 return result; | |
| 147 } | |
| OLD | NEW |