1 2 3 Previous Next 31 Replies Latest reply on Sep 12, 2019 5:46 AM by JoMe_264151 Go to original post
      • 15. Re: CySmart API C# example

        Thank you very much about this help. I'm starting with this language and I was a bit confused, it will really help and others I guess.




        Best regards,



        • 16. Re: CySmart API C# example

          Is there anybody from Cypress team who can advice what the correct way of object release while using CySmart dongle. According to API and examples there is two functions for device connection:
          1. Dongle connection: dongleMgr.TryGetCySmartDongleCommunicator(info, out m_communicator);


          2. External device connection: BleMgr.Connect(new CyConnectInfo(deviceAddr, new CyBleConnectionSettings()));


          And two functions for device disconnection:


          3. Disconnect from external device first: BleMgr.Disconnect(m_peerDevice);


          4. Disconnect dongle instance: CySmartDongleMgr.GetInstance().CloseCommunicator(m_communicator);


          I wrote simple application that nothing do besides connect to two different devices following 1-4 process. in a while(true) loop. Unfortunately I have memory leak there, I'm sure dll cannot do that, so probably I'm releasing resources in a wrong way, but I cannot find nothing in API or classes (CySmartDongleMgr, ICyBleMgr) that reminds me the other way (except to CySmartDongleMgr::CloseCommunicator and  ICyBleMgr::Disconnect)


          Please advice.

          • 17. Re: CySmart API C# example

            Hi Artyom,


            This was a bug in the dispose implementation of the API.


            This is already fixed in CySmart 1.2 SP1 release. You  needs to replace the old DLLs with the new DLLs.


            This release should be available on the web in WW14 (in another 2/3 weeks time) .


            Thanks & Regards,

            • 18. Re: CySmart API C# example



              I´m using the dongle to access to cypress APIs and develop my GUI. In this respect, I would like have your support in the following questions:


              1) Is there an event and/or callback from cypress APIs to detect when the BLE device, to which I was already connected, suddenly no more available is, (for instance due to  power supply failure), so that my GUI doesn´t crash or get blocked?


              2) Is it possible to access to cypress APIs by using another Bluetooth USB (for instance, ASUS Bluetooth USB Sticks), rather than using  the CySmart BLE Dongle?


              Very appreciated for your help


              Nuno Alves

              • 19. Re: CySmart API C# example

                Hi Anjana,


                Could you please point on updated .dll location, unfortunately I cannot find it undercy5677-cysmart-bluetooth-low-energy-ble-42-usb-dongle folder or other place..




                Best regards,



                • 20. Re: CySmart API C# example

                  Hello nuno.antunes_2058241,




                  A mounth passed since your question but I now have the same question, did you solved it please ?







                  • 21. Re: CySmart API C# example

                    Thanks a lot!


                    @cypress why this type of example are not available ?

                    • 22. Re: CySmart API C# example

                      Hi Madhu,


                      Can you explain a little bit the meaning for this function in C#


                      ScanCallBack.ScanStatusChangedHandler = status => { };




                      ScanCallBack.ScanResultHandler = status => { };


                      I found that after execute those command then the Handlers will be not " NULL"


                      *I'm not good at C# and now I'm trying to call the Cysmart API y LabVIEW.




                      Uthai T.

                      • 23. Re: CySmart API C# example

                        Timeouts are your friend in the case of unknown disconnections and preventing blocks/crashes.


                        I don't know what is available specifically for the cysmart library, but I would suspect that you can check return values and events that refer to connections/timeouts/connected-operation functions to see what is going on.

                        • 24. Re: CySmart API C# example

                          Okey e.pratt, thank you about your answer, will be usefull to me as usual, keep that !




                          Best regards,



                          • 25. Re: CySmart API C# example



                            I'm trying to reuse notification example. for one of my requirement.


                            Currently without any modifications introduced, i'm connecting USB dongle with a bluetooth device. and enabling notification on one particular characteristic like temperature mode. but when ever i change temperature mode i don't get the notification.


                            I have attached the screen capture of the cySmart App for the device. the selected characteristic is for temp mode. 00 - C and 01 is F.


                            when i change the value in cySmart App it get reflected in the Device. Now when i use the Notification Logger example and set notification for temperature mode characteristic and change the mode in device i don't get any notifications.


                            Can you help me to resolve this issue.

                            • 26. Re: CySmart API C# example

                              Hi Anjana,


                              I am aslo facing same issue as Artyom mentioned "while closing communicator I am getting error  says Unhandled Exception: System.ObjectDisposedException: Safe handle has been closed ". I have tried new DLLs from CySmart 1.2 SP1 release as you mentioned that


                              "This was a bug in the dispose implementation of the API.


                              This is already fixed in CySmart 1.2 SP1 release."


                              but still I am getting same error. Please provide any solution if it is possible.

                              • 27. Re: CySmart API C# example

                                Hello Madhu,

                                  Thanks for providing the example, Could you please tell me which characteristic is targeted for READ and WRITE buttons on the Form?

                                I thought it requires the Characteristic UUID is required for read/write operation, but your example is using CCCD info, how to get a CCCD info for any characteristic, Please clarify this. 




                                • 28. Re: CySmart API C# example

                                  Has anyone successfully paired with a device that is configured with unauthenticated paring with encryption? I'm using code that was posted earlier in this thread. I try to pair with the following line:


                                  err = m_peerDevice.Pair(new CyPairSettings(CySecurityLevel.UNAUTHENTICATED_PAIRING_WITH_ENCRYPTION, false, 16, CyPairingProperties.USE_MITM));


                                  err indicates successful. I've tried changing bonding to true and CyPairingProperities, but nothing seems to work. The OnPairingComplete event is called with a status of BLE_ERROR_GAP_AUTH_PASSKEY_ENTRY_FAILED.


                                  Any ideas?

                                  • 29. Re: CySmart API C# example



                                    I am really struggling with the CySmart API. I tried a simple connection to a Device. But all I get is a time-out (BLE_ERROR_TOOL_REQUEST_TIMEDOUT).


                                    This is what I do (I removed the error handling from the code, because this works):


                                    CySmartDongleMgr dongleMgr = CySmartDongleMgr.GetInstance();

                                    CyApiErr err = dongleMgr.TryGetCySmartDongleCommunicator(new CyDongleInfo(COM_PORT_NAME, CyDongleInfo.CySmartDongleType.CY5670), out m_communicator);

                                    m_bleMgrCb = new BleMgrCb();


                                    AutoResetEvent sync = new AutoResetEvent(false);

                                    m_bleMgrCb.ConnectionHandler = (result, status) =>


                                      if (status == CyStatus.BLE_STATUS_OK)











                                    err = BleMgr.Connect(new CyConnectInfo(deviceAddr, new CyBleConnectionSettings()));


                                    Any idea what I am doing wrong? The connection handler is only called when there is a time out.


                                    Thanks in advance