Is Gap_SaveCustomPeerInformation required when bonding is not in use?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is Gap_SaveCustomPeerInformation required when bonding is not in use?

1,144 Views
stephenlangstaf
Contributor III

In the Location and Navigation Client example code (FRDM-KW36, SDK version 2.2.1) the call to Gap_LoadCustomPeerInformation is conditionally compiled with the gAppUseBonding_d macro, whereas the call to Gap_SaveCustomPeerInformation is not:

#if gAppUseBonding_d
            (void)Gap_CheckIfBonded(peerDeviceId, &mPeerInformation.isBonded);

            if ((mPeerInformation.isBonded) &&
                (gBleSuccess_c == Gap_LoadCustomPeerInformation(peerDeviceId,
                    (void*) &mPeerInformation.customInfo, 0, sizeof (appCustomInfo_t))))
            {
                /* Restored custom connection information. Encrypt link */
                (void)Gap_EncryptLink(peerDeviceId);
            }
#endif

vs.

                /* Write data in NVM */
                (void)Gap_SaveCustomPeerInformation(mPeerInformation.deviceId,
                                              (void*) &mPeerInformation.customInfo, 0,
                                              sizeof (appCustomInfo_t));

Is this just an omission in the example code (and similarly in the otap_server code) or does the custom peer information need to be saved even if bonding is not required?

Labels (1)
Tags (2)
0 Kudos
4 Replies

1,005 Views
Xiang_Li
NXP Employee
NXP Employee

The codes look strange to me. The function Gap_SaveCustomPeerInformation() writes data into NVM. So logically, the action is only needed when we have new data to store, but where the data is updated I don't see from your snippet.

Could you attach the entire file?

0 Kudos

1,005 Views
stephenlangstaf
Contributor III

I've attached the file.

I think that all that's missing is a #if gAppUseBonding_d directive, but it's not clear from the documentation whether or not Gap_SaveCustomPeerInformation() should be called when bonding is not being used.

0 Kudos

1,004 Views
Xiang_Li
NXP Employee
NXP Employee

Hi Stephen, I think you are probably right. If the data written into NVM is never used, then the action of writing seems unnecessary.

When I look at QN9080's code, in private_profile_client example, the code is already like:

#if gAppUseBonding_d
                /* Write data in NVM */
                Gap_SaveCustomPeerInformation(mPeerInformation[peerDeviceId].deviceId,
                                              (void*) &mPeerInformation[peerDeviceId].customInfo, 0,
                                              sizeof (appCustomInfo_t));
#endif


So probably they just haven't got to update the KW36 example yet.

But anyway, the example projects are just a reference for you to understand how to use the product. The examples are not meant to be perfect, although I believe my NXP colleagues are trying

0 Kudos

1,005 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

The API you are asking about it's by the application to save custom information about the peer device, it a custom save of the data of the report in this case.

Regards ,

Estephania

0 Kudos