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

Minor but important bug at ANCS with iOS

I successfully made an Arduino code using nordic library that gets notification from iOS ANCS.

But some minor bug exists: sometimes i don't get any notification from the device. The only thing that I can do in that situation is to turn de bluetooth on and off on the iOS device and then everything works fine. And this is not a solution for my problem. :)

I have read this:

devzone.nordicsemi.com/.../ancs-and-nrf8001

From what i understand it is an iOS bug something with a CCCD. The solution indicated there is to close the remote pipe and then reopen it. I kinda of tried this but i don't know if i'm doing right because it doesn't work. This should be done in ACI_EVT_PIPE_STATUS? When should i close the pipe? What is the event that tells me that the pipe is successfully closed?

I'd appreciate if you could help me with this problem.

This is the log when the problem happens, if it helps you:

Arduino setup C1 :1, E, E3 :3, 84, E, 0, E4 :4, 81, 3, 0, 2, Evt Device Started: Standby Previous Bond present. Restoring Using existing bond stored in EEPROM. To delete the bond stored in EEPROM, connect Pin 6 to 3.3v and Reset. Make sure that the bond on the phone/PC is deleted as well. [....] Bond restored successfully C5 :5, F, 64, 0, 20, 0, Already bonded : Advertising started : Waiting to be connected E3 :3, 84, F, 0, E15 :F, 85, 3, 7C, D0, 77, AF, C2, 7D, 18, 0, 0, 0, 48, 0, 5, Evt Connected C5 :5, 10, B4, 0, 50, 0, C1 :1, 9, E3 :3, 84, 10, 83, ACI Command 10 Evt Cmd respone: Status 83 E12 :C, 84, 9, 0, 0, 0, 2, 3, 1, 0, 0, 0, 0, C11 :B, D, 2, 0, 0, 2, 3, 1, 0, 0, 0, 0, E3 :3, 84, D, 0, E17 :11, 88, FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Evt Pipe Status C1 :1, 13, Service Discovery is over.

Thank you very much! :)

LE: I tried to call lib_aci_close_remote_pipe but it returns FALSE:

if( lib_aci_is_pipe_available(&aci_state,PIPE_ANCS_NOTIFICATION_SOURCE_RX ) && once_not)
                    {
                      timing_change_done = true;
                      bool a = lib_aci_close_remote_pipe(&aci_state, PIPE_ANCS_NOTIFICATION_SOURCE_RX);
                      if( a ) Serial.println("YES!");
                      else Serial.println("No!");
                      once_not = false;
                       break;
                    }
Related