Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

Anonymous
Not applicable

I am using the c# dlls to create a windows pc app, and I am having trouble figuring out how to programmatically set the security level, and the bonding option.  I know how to do this in the CySmart app  (Configure master settings -> security parameters -> security level and bonding), but I dont know how to use the api to do this myself. Any help is appreciated.

Thank you!

0 Likes
11 Replies
Anonymous
Not applicable

See this thread: CySmart API C# example Contains an attached project with C# api examples, and reference to the documentation on the APIs

0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

Thanks for the response, but the example code in the thread shows how to connect to the dongle and peripheral device, and perform read/write/notify operations.  It doesn't seem to mention setting local device security.

The API document only mentions its use when setting pair settings, but that is not what I am trying to accomplish:

pastedImage_0.png

I am trying to set the Security Parameters to have a security level of NO_SECURITY and set Bonding to false (picture from CySmart configuration master settings):

pastedImage_1.png

0 Likes
Anonymous
Not applicable

The CypairSettings() refer to pairing, and a unit is "paired" when it connects to another device. Just use that function to setup the pair settings to NO_SECURITY with the CySecurityLevel setting passed as the parameter for the function.

Page 13 of the PDF I linked shows it.

0 Likes
Anonymous
Not applicable

I am trying to do a OTA firmware update to a device, and that requires the dongle to be disconnected from the device before initiating the update.  I was able to do the firmware update successfully, but now the peripheral device requires NO_SECURITY for the update to work (peripheral device firmware changed).  I can set the pair settings that are passed into the OTAfirmware update method, but that didn't work.  Maybe I am just missing something here, but the only time that it seems to try to use the settings is when they are called by "Pair()"

pastedImage_0.png

0 Likes
Anonymous
Not applicable

The "Pair" operation is when the two devices connect to each other, so that would make sense for the settings to be passed into the Pair() function to operate. You should be able to call Pair() with no security to finish the bootload. The callback procedures only fire if the device has higher security set: Passkey entry, display, numeric comparison. You also should be able to determine if the pairing succeeded with the CyBleDeviceCallback.OnPairingCompleted callback method.

0 Likes
Anonymous
Not applicable

I wanted to try this but the device I am working with doesn't support pairing (OnPairingCompleted gets a status of "BLE_ERROR_GAP_AUTH_PAIRING_NOT_SUPPORTED")

In CySmart:

pastedImage_0.png

Looks like I might need the device to support pairing if this is the only way to do it.  Obviously CySmart can do it a different way but I'm guessing that they are using API that is not supported with the current DLLs.... 

0 Likes
Anonymous
Not applicable

It could be rejecting just the authentication part of the pairing. Try setting the security to unauthenticated pairing with encryption (under the CyPairSettings() function).

0 Likes
Anonymous
Not applicable

Unfortunately the same result happens using unauthenticated pairing with encryption.  I appreciate your suggestions though

0 Likes
Anonymous
Not applicable

Bummer

Brute force usually works if there are only a couple options But if the peripheral isn't supporting connections at all, then that is a different issue entirely

Best of luck with getting the next step working

0 Likes
Anonymous
Not applicable

Thanks for all your help! If I find a way to do this without pairing I will post in this thread.