Hello folks,
I'm still working on the CY5677 dongle with the example linked by Madhu Sudhan (thanks to him) at: http://www.cypress.com/forum/proc-ble/cysmart-api-c-example?page=1
I got an issue wich is now solved as mentionned here : http://www.cypress.com/forum/proc-ble/cy5677-cc2650
I'm close to the end of my application but I'm stuck since a long time on an other issue which is notifications are never enable.
I tried to make it work with CYSMART and it's working nicely, same with a phone but never with this application. I tried to solve the issue with the same way Madhu Sudhan solved the last issue but never worked. I join you the code of the notify button :
private void Notify_Button_Click(object sender, System.EventArgs e)
{
AutoResetEvent sync = new AutoResetEvent(false);
CyApiErr err = CyApiErr.OK;
CharHandle = 0x0027;
CCCDHandle = 0x0028;
// Setup the descriptor write handler
GATTClientEventCallback.DescriptorWriteHandler = (CyConnectResult, status) =>
{
if (status != CyStatus.BLE_STATUS_OK)
err = new CyApiErr("Failed to Write: Reason: " + status.ToString());
sync.Set();
};
if (!(NotificationEnabled))
{
var NotifByte = new byte[1];
NotifByte = BitConverter.GetBytes(0x0001);
Array.Resize(ref NotifByte, 1);
// Initiate write descriptor request to the CCCD
err = GattClient.WriteDescriptor(new CyGattWriteInfo(CCCDHandle, NotifByte));
if (err.IsOK)
{
sync.WaitOne();
NotificationEnabled = true;
Notify_Button.Text = "Disable Notification";
}
}
else
{
var NotifByte = new byte[1];
NotifByte = BitConverter.GetBytes(0x0000);
Array.Resize(ref NotifByte, 1);
err = GattClient.WriteDescriptor(new CyGattWriteInfo(CCCDHandle, NotifByte ));
if (err.IsOK)
{
sync.WaitOne();
NotificationEnabled = false;
Notify_Button.Text = "Enable Notification";
}
}
}
Err is variable is ok when I debug so the transmission seems to be well but the principle of activation seems failed. With CySmart I'm able to write "01:00" or "0100" and it's working.
Plus I have a question about that on CySmart I can see what is on the joined picture. With characteristic which haven't notification mod I'm ok to write CharHandle and CCCDHandle nicely but with the notification characteristic I have 3 values as joined 0x0027 to 0x0029. What should I put where ?
Regards,
Guillaume