CySmart DLL Import @Unity

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

cross mob
TaDa_1407706
Level 2
Level 2

Is there anyone can import CySmart DLL into Unity Project???

I know it's a little bit Unity's issue, but I also want to get your advice.

At first, I've already confirmed that below DLLs work well by C# WPF project.

(I confirmed that it open CY5677 dongle's comm port without problem.)

  • cybleautobase.dll
  • cyblecommonbase.dll
  • cybledonglecommunicator.dll

Then I bring those DLLs into Unity project, and confirmed "there is no error message".

But the problem is that DLL doesn't work at all.(TryGetCySmartDongleCommunicator Function returns NULL)

I've tried to modify below configuration options, but the situation doesn't change.

(Build Setting→Player Setting→Other Setting →Configuration)

  • Runtime version : 4.0 -> 3.5 (rebuild but NG)
  • Scripting Backend : Mono->IL2CPP ( Still NG)
  • Api Compatibility : 4.0 -> 2.0 (still NG)

=======

My Environment

  • Unity 2018.4.16f1 personal
  • Microsoft Visual Studio Community 2019 Version 16.5.1
  • Windows 10 1903

DLL information (confirmed at VS2019's property window)

  • Version : 1.3.0.8
  • Runtime Version: v2.0.50727

=======

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using CySmart.Common.Base.Compatibility.Net20;
  5. using CySmart.DongleCommunicator.API;
  6. using System.Runtime.InteropServices.ComTypes;
  7. public class BLErx : MonoBehaviour{
  8.     CyDongleInfo DongleInfo;
  9.     CySmartDongleMgr DongleManager;
  10.     ICySmartDongleCommunicator Comm;
  11.     public void StartBLE()
  12.     {
  13.      DongleInfo = new CyDongleInfo("COMxx", CyDongleInfo.CySmartDongleType.CY5677);
  14.      DongleManager = CySmartDongleMgr.GetInstance();
  15.      CyApiErr err = DongleManager.TryGetCySmartDongleCommunicator(DongleInfo, out Comm);
  16.      if (err.IsOk)
  17.      {
  18.          Debug.Log("OK");
  19.      }
  20.      else
  21.      {
  22.          Debug.Log("NG");
  23.      }
  24. }
  25. }
0 Likes
1 Solution
TaDa_1407706
Level 2
Level 2

I modified PSoC 4 dongle firmware which output UART (P1[4],P1[5]).

In this case, I don't need to use DLL file such as cybleautobase.dll,

so I can use Serial Port as usual, and confirmed BLE information.

I think this is one of the solution for Unity reciving BLE from Cypress Dongle.

========

I tried bellow cases, but in all cases,"NotSupportedException: System.IO.Ports.SerialPort" happen.

Case 1. Unity 2018 Mono    .Net 4.x

Case 2. Unity 2018 IL2CPP  .Net 4.x

Case 3. Unity 2018 Mono    .Net standoard 2.x

Case 4. Unity 2018 IL2CPP  .Net standoard 2.x

(When switching .NET 3.5 Equivalent environment, the situation doesn't change)

Case 5. Unity 2019 Mono    .Net 4.x

Case 6. Unity 2019 IL2CPP  .Net 4.x

Case 7. Unity 2019 Mono    .Net standoard 2.x

Case 8. Unity 2019 IL2CPP  .Net standoard 2.x

========

Thanks

View solution in original post

0 Likes
7 Replies