We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am struggling to implement the following
[INFO] : didDiscoverServices [INFO] : { [INFO] : bubbles = 1; [INFO] : cancelBubble = 0; [INFO] : error = "<null>"; [INFO] : peripheral = "[object TiBluetoothPeripheral]"; [INFO] : source = "[object TiBluetoothPeripheral]"; [INFO] : type = didDiscoverServices; [INFO] : } [INFO] : [object TiBluetoothPeripheral] [INFO] : ( [INFO] : "[object TiBluetoothService]", [INFO] : "[object TiBluetoothService]" [INFO] : ) [INFO] : peripheral has 2 service(s) [INFO] : service characteristics <null> [INFO] : service characteristics <null>
Next I want to get the UUIDs from the services, and subscribe to let's say one of them My code so far:
centralManager.addEventListener('didConnectPeripheral', function(e) { console.log('\ndidConnectPeripheral'); console.log(e); console.log(e.peripheral); centralManager.stopScan(); connectedPeripheral = e.peripheral; connectedPeripheral.addEventListener('didDiscoverServices', function(e) { console.log('\ndidDiscoverServices'); console.log(e); console.log(e.peripheral); console.log(e.peripheral.services); console.log('peripheral has ', e.peripheral.services.length, 'service(s)'); var services = e.peripheral.services; for (var i = 0; i < services.length; i++) console.log('service characteristics ', services[i].characteristics.uuid); // if (service.UUID.toLowerCase() == CUSTOM_SERVICE_UUID.toLowerCase()) { // e.peripheral.discoverCharacteristicsForService(service); // } }); connectedPeripheral.addEventListener('didDiscoverCharacteristicsForService', function(e) { console.log('didDiscoverCharacteristicsForService'); console.log(e); }); connectedPeripheral.addEventListener('didUpdateValueForCharacteristic', function(e) { console.log('didUpdateValueForCharacteristic'); console.log(e); }); connectedPeripheral.discoverServices(); });
The text was updated successfully, but these errors were encountered:
You have to add the event listener on the latest peripheral you get
centralManager.addEventListener('didConnectPeripheral', function(e) { console.log('\ndidConnectPeripheral'); console.log(e); console.log(e.peripheral); centralManager.stopScan(); connectedPeripheral = e.peripheral; connectedPeripheral.addEventListener('didDiscoverServices', function(e) { console.log('\ndidDiscoverServices'); console.log(e); console.log(e.peripheral); console.log(e.peripheral.services); var peripheral = e.peripheral; peripheral.addEventListener('didDiscoverCharacteristicsForService', function(e) { console.log('didDiscoverCharacteristicsForService'); console.log(e); }); peripheral.services.forEach(function(service) { peripheral.discoverCharacteristicsForService({ service: service }); }); }); connectedPeripheral.discoverServices(); });
Sorry, something went wrong.
I am doing that, please take a look at #23
I updated that issue today.
No branches or pull requests
I am struggling to implement the following
Next I want to get the UUIDs from the services, and subscribe to let's say one of them
My code so far:
The text was updated successfully, but these errors were encountered: