Author Topic: Bluetooth framework with Unity  (Read 19710 times)

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Bluetooth framework with Unity
« on: March 29, 2020, 12:30:32 PM »
Bluetooth Framework often used with Unity.

There is some known issue when you use Bluetooth Framework .NET edition: the Unity editor freezes on "Mono Cleanup" message when editor is closing. The issue related to Mono itself and for now there is no solution.

To prevent this we created some "wrappers" that can be used with C++ Edition. You can find it by this link: https://github.com/btframework/WCL-for-Unity

How to build the "wrapper" DLL:

1. Install Bluetooth Framework C++ Edition. better in its default location but actually it does not matter.
2. Find its installation path. By default it is installed in <DOCUMENTS>\WCL\CPP\Bluetooth
3. Open WclGattClientDll solution.
4. Open WclGattClientDll.cpp file in the IDE
5. Change this code lines (at the very beginning of the file)

Code: [Select]
#include "..\..\..\..\..\WCL7\CPP\Source\Bluetooth\wclBluetooth.h"
#include "..\..\..\..\..\WCL7\CPP\Source\Common\wclErrors.h"

to
 
Code: [Select]
#include "<DOCUMENTS>\WCL7\CPP\Source\Bluetooth\wclBluetooth.h"
#include "<DOCUMENTS>\WCL7\CPP\Source\Common\wclErrors.h"

REPLACE <DOCUMENTS> with real path. For example on my PC it is c:\Users\mike\Documents (DO NOT FORGET to change single "\" to double "\\" in the path.

So in my case the changes should look like this:
 
Code: [Select]
#include "c:\\Users\\mike\\Documents\WCL7\CPP\Source\Bluetooth\wclBluetooth.h"
#include "c:\\Users\\mike\\Documents\WCL7\CPP\Source\Common\wclErrors.h"

6. Change next code line:
 
Code: [Select]
#pragma comment(lib, "..\\..\\..\\..\\..\\WCL7\\CPP\\Lib\\2017\\x64\\wclBluetoothFramework.lib")
to
 
Code: [Select]
#pragma comment(lib, "<DOCUMENTS>\\WCL7\\CPP\\Lib\\2017\\x64\\wclBluetoothFramework.lib")
Replace the <DOCUMENTS> as above.
 
7. Build the project.
8. Copy the DLL into assets folder.

Should you have any questions feel free to contact us at support@btframework.com
« Last Edit: March 29, 2020, 12:34:10 PM by Mike Petrichenko »

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Bluetooth framework with Unity
« Reply #1 on: November 03, 2022, 12:24:04 PM »
New demos available by this link: https://github.com/btframework/Wireless-Communication-Library-Unity-Samples
This demos use native .NET libraries and does not require C++ wrappers.

 

Sitemap 1 2 3 4 5 6 7