-
1. Re: CySmart API C# example
rola_264706 May 10, 2016 7:12 AM (in response to chfuc_293041)1 of 1 people found this helpfulYou can get the complete code from Cypress if you open a case. There are no barebone examples that I know of.
-
2. Re: CySmart API C# example
chfuc_293041 May 10, 2016 10:12 AM (in response to rola_264706)Thanks.. I'll give that a go..
-
3. Re: CySmart API C# example
chfuc_293041 May 12, 2016 9:24 AM (in response to chfuc_293041)Apparently Cypress does not share the C# sources to the CySmart app, nor do they provide any other example as an option to help get an API driven application off the ground... not the 'helpful response' we were expecting.. we've suggested signing an NDA to get a peek.. we'll see how that goes.. sigh..
Otherwise, their response to my case has been a bit disappointing:
"Thanks for contacting Cypress Technical support. Currently we don't have any example source code using Cymsart API."
And after a second inquiry about the CySmart code itself:
"The CySmart source code for windows tool is internal and cannot be shared. We provide CySmart API reference guide available at http://www.cypress.com/documentation/software-and-drivers/cysmart-bluetooth-le-test-and-debug-tool."
-
4. Re: CySmart API C# example
GauravS_31May 18, 2016 11:47 PM (in response to chfuc_293041)
I have attached a sample code for using CySmart C# APIs. I hope this helps. Let me know if you have any questions or if you face any problems with the code.
-
cysmart.zip 619.9 K
-
-
5. Re: CySmart API C# example
webuc_1676051 Aug 4, 2016 5:52 AM (in response to GauravS_31)grsr, Thank you very much for your samples! I design electronics and develop embedded software/firmware. I developed a Bluetooth instrument and needed to make a demo app but I don't know C#. I was able to study and expand your samples. Thanks!!!
-
6. Re: CySmart API C# example
aler_1271121 Aug 5, 2016 4:55 AM (in response to chfuc_293041)Hi GRSR,
ı will use your example code. this code read a data from psoc. I need send a data from computer to psoc. How can I do this ?
-
7. Re: CySmart API C# example
GauravS_31Aug 8, 2016 2:51 AM (in response to aler_1271121)
If your question implies sending data from CySmart dongle (GATT client) to PSoC BLE (GATT server) then first the GATT client should discover attributes on the GATT server after establishing connection. Then you need to use the CySmart API WriteCharacteristic (CyGattWriteInfo info). The class CyGattWriteInfo will encapsulate the data you need to send. Try implementing the CySmart APIs for attribute discovery and characteristic read or write and let me know if you face any difficulties. The CySmart API reference guide is available at the link mentioned in post#4. Attach the project code if necessary.
-
8. Re: CySmart API C# example
userc_40153 Jan 13, 2017 12:45 AM (in response to GauravS_31)Hi grsr,
Thank you very much for your samples!
It would be helpful if you can share what correct sequence should be done for reading data on CySmart dongle (GATT client) that was sent from PSoC BLE (GATT server). Encapsulation using CySmart API WriteCharacteristic (CyGattWriteInfo info) working for me great, since CyGattWriteInfo(ushort handle, params byte[] value) has parameter "value" and I able to send notifications, once I need to receive I should use ReadCharacteristic(CyGattReadInfo info), but CyGattReadInfo object has no value I can read? According to documentation this object holds the information necessary to read an attribute value, but were the value actually stored?
-
9. Re: CySmart API C# example
GauravS_31Jan 16, 2017 4:07 AM (in response to userc_40153)
If the GATT Server is notifying data to GATT Client, then you should not use ReadCharacteristic(CyGattReadInfo info) API. The GATT client shall receive notification as a callback "OnCharacteristicChanged" under CyGattClientCallback. The class CyCharacteristicChangedInfo will encapsulate the Handle-Value pair of the notified data. The ReadCharacteristic API should be used to read data that is already written into the GATT database of the GATT Server.
-
10. Re: CySmart API C# example
userc_40153 Jan 19, 2017 12:30 AM (in response to GauravS_31)Hi grsr,
Thanks for your answer!
Unfortunately "OnCharacteristicChanged" callback is not fired in my case, but while I'm using CySmart 1.2 application I able to see GATT Server's message under 0x010 hanle. What can be a possible reason?
-
11. Re: CySmart API C# example
GauravS_31Jan 22, 2017 3:34 AM (in response to userc_40153)
You need to enable CCCD in CySmart C# code to receive notifications. If you are doing so, check if you have entered the correct attribute handle of the CCCD. Open CySmart 1.2 and check the attribute handle of the CCCD. It should equal the attribute handle of the characteristic to be notified + 1. Use this value in the C# code.
-
12. Re: CySmart API C# example
userc_38709 Mar 1, 2017 5:19 AM (in response to chfuc_293041)Hi grsr,
Thank you about this code it's very helpful to me. I'm trying actually to make my own but I'm facing to a problem.
I want to use the ReadCharacteristic(CyGattReadInfo info) method to read a characteristic value but I'm unable to read it.
Can you help me ?
I called it with the parameter : "CyGattReadInfo GattInfo = new CyGattReadInfo(0x001E);" but when I call "err = GattClient.ReadCharacteristic(GattInfo);" it's an unknow name for visual studio. To read this data I made the callback but my problem is about to launch the read operation. I guess the problem is coming from my way to declare "ICyGattClient GattClient;" but I don't see how to manage with this object.
Thank you.
Best regards,
Guillaume
-
13. Re: CySmart API C# example
userc_40153 Mar 5, 2017 10:19 PM (in response to GauravS_31)Hello GRSR,
Thank you for support!
I’m doing following sequence:
Step 1. override void OnCharacteristicChanged(CyCharacteristicChangedInfo info) and enabling public Action<CyCharacteristicChangedInfo> CharacteristicChangedHandler { get; set; }
under class GattClientCb : CyGattClientCallback
Step 2. Once m_gattClientCb initialized, I’m linking m_gattClientCb to CharacteristicChangedHandler (m_gattClientCb.CharacteristicChangedHandler = (info) => while here I’m using data GetPrintableValue(info.Value))
Step 3. In main function I’m creating
m_cyGattReadInfo = new CyGattReadInfo(0x0011); (0x0011 value taken from CySmart 1.2, I can see changes (received data) on 0x0010 handler, accourding to previous suggestion it should be equal to attribute handle of the characteristic to be notified + 1). And enabling m_peerDevice.GattClient.ReadCharacteristic(m_cyGattReadInfo);Step 4. No notification is received and no OnCharacteristicChanged event fired in this case.
A’m I missing something?
Please advice.
-
14. Re: CySmart API C# example
madhul_36 Mar 20, 2017 5:12 AM (in response to chfuc_293041)Hi,
I am attaching another simple code example. This is a simple GUI that demosntrates scanning, connection, Write, Read and receiving notification.
You can download the project from this link:
https://www.dropbox.com/s/w5v7oje0ssuz2ix/MADY-40.zip?dl=0
Also, document for testing the project is attached here.
Regards,
- Madhu Sudhan
-
MADY40.doc 277.5 K
-