This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to setup a pipe to access iOS7's ANCS?

Hi,

I'm going to try not to get into stuff that is under apple's NDA, but my question is really on the nRF8001 side. Basically, the ANCS is a service that offers three characteristics: NS, CP and DS. I have followed nRFgo documentation, and added UUID bases for the service and the characteristics, then created a ANCS service, and three characteristics matching their properties (Notifiable, Writeable with response and Notifiable), and then I dragged and dropped the service in the "remote" part of the nRFgo Gatt services tab. I also have setup a local service, with a custom (generated by nRFGo) UUID) and a few characteristics (one which is a boolean read/write, just for testing purposes, TX Power Level and Battery Level).

Then I took the SDK's arduino code (with lib_aci), and based my code on "ble_my_project_template". I then compiled it as is, with the newly generated services.h, and LightBlue can connect to my nRF8001+Arduino, and I could browse through the local service and characteristics, and see the test boolean going out of the pipe on the serial line of the arduino.

But now, what I'm trying to do is to subscribe to ANCS notification from the Arduino side. So, based on the webinar and the lib_aci.h documentation, I'm doing the following:


  if (lib_aci_event_get(&aci_state, &aci_data)) {
    aci_evt_t * aci_evt;
    
    aci_evt = &aci_data.evt;
    switch(aci_evt->evt_opcode)
    {
      case ACI_EVT_PIPE_STATUS:
        if (lib_aci_open_remote_pipe(&aci_state, PIPE_ANCS_CP_TX_ACK))
            Serial.println(F("Success opening ANCS CP Pipe!"));
        else
            Serial.println(F("Failure opening ANCS CP Pipe!"));
        if (lib_aci_is_pipe_available(&aci_state, PIPE_ANCS_CP_TX_ACK)) {
            Serial.println(F("ANCS CP available!"));
        } else
            Serial.println(F("ANCS CP not available :-("));
    }
 }

And sadly, when I connect to the device from the iOS device, I'm getting failure opening any pipe, and checking if the pipe is available. I also tried to open remote pipes that are only made for notifications, but they fail to open too.

All the examples are about exposing stuff in the nRF8001 bound MCU, but there's almost nothing about subscribing to notifications on a remote GATT... Is there any example I may have missed?

So, have you got any idea what am I doing wrong here?

Related