GithubHelp home page GithubHelp logo

Comments (3)

sdetweil avatar sdetweil commented on July 26, 2024

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.

sdetweil avatar sdetweil commented on July 26, 2024

I added the didModifyServices delegate, no longer get the error, but don't get the new service detected...

from cordova-plugin-bluetoothle.

sdetweil avatar sdetweil commented on July 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.