Comments (3)
I think an example of the didModifyServices delegate would be
- (void)peripheral:(CBPeripheral *)peripheral didModifyServices:_ {
NSMutableArray *noSpecifiedServices = [NSMutableArray new];
// discover all the services . I think this is the one we want.. as we are in a generic plugin..
[peripheral discoverServices:noSpecifiedServices];
}
the note on the didModifyServices is
When the peripheral discovers one or more services, it calls the [peripheral(_:didDiscoverServices:)]
(https://developer.apple.com/documentation/corebluetooth/cbperipheraldelegate/1518744-peripheral): method of its
delegate object. After a peripheral discovers services, you can access them through the peripheral’s [services]
(https://developer.apple.com/documentation/corebluetooth/cbperipheral/1518978-services) property.
which says UNLESS this delegate is provided AND discovers the services, you CANNOT access them
from cordova-plugin-bluetoothle.
I added the didModifyServices delegate, no longer get the error, but don't get the new service detected...
from cordova-plugin-bluetoothle.
well, there is a small doc that says the device MUST have the two default services
As you can see, even before we have done anything, **there are already two mandatory services** set up for us:
[The Generic Access service](https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.generic_access.xml). Service UUID 0x1800. Three mandatory characteristics:
[Characteristic: Device name](https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.device_name.xml). UUID 0x2A00.
[Characteristic: Appearance](https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml). UUID 0x2A01.
[Characteristic: Peripheral Preferred Connection Parameters](https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters.xml). UUID 0x2A04.
[The Generic Attribute service](https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.generic_attribute.xml). UUID 0x1801. One optional characteristic:
[Characteristic: Service Changed](https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gatt.service_changed.xml). UUID 0x2A05.
The Generic Access Service contains general information about the device. You can recognize a characteristic holding the device name “OurService”. The second characteristic holds the appearance value and in our case we haven't set the value to anything so it just shows 0x0000. The third characteristic holds various parameters used to establish a connection. You can recognise values from the #defines in the example called: MIN_CONN_INTERVAL, MAX_CONN_INTERVAL, SLAVE_LATENCY, and CONN_SUP_TIMEOUT. [Here](https://devzone.nordicsemi.com/question/60/what-is-connection-parameters/) is a short explanation regarding these parameters.
The second service is the Generic Attribute Service. Simply put, this service can be used to notify the central of changes made to the fundamental structure of services and characteristics on the peripheral. Short explanation [here](https://devzone.nordicsemi.com/question/15099/changing-gatt-characteristic-properties/).
I didn't add those 'mandatory' services
from cordova-plugin-bluetoothle.
Related Issues (20)
- Unable to read from Device HOT 2
- Connect 2 Android devices using BluetoothLE HOT 4
- Crash of the App when StartScan() is called with BLUETOOTH_SCAN permission HOT 2
- Support `android:usesPermissionFlags="neverForLocation"`
- writeQ and read
- hasPermissionBtScanAction and hasPermissionBtConnectAction should always return true on AndroidSDK < 31 HOT 2
- Android 13 Limit max MTU to 515
- subscribe(): Descriptor not found
- respond() to a status writeRequested not work HOT 1
- bluetooth-le on ionic V6, Vue 3, ios 16.3.1 HOT 5
- Bluetooth HOT 1
- switching on Bluetooth in an iOS device using an API is not possible
- Peripheral service UUID mangled HOT 1
- access to peripheral hashvalue HOT 1
- porting from IOS to Android and in trouble
- Error In Setpin method is not exist On BluetoothLe
- BluetoothLE writing a service and send the data to another device
- Bluetooth LE data transmission to broadcast device In parts HOT 1
- scanResponse not available when advertising as BLE device
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-bluetoothle.