LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BLE GATT

Hi there,

 

i have a BlueTooth LE device that i can communicate with following the Microsoft example Heart Rate Service.

 

Since the code is offered in C, C++ and Javascript, i used Visual studios and ran the C-code. It works great.

 

 

Now i want to run the code in LabView. I understand i need to call the GATT functions in the BlueToothAps.dll file.

 

My problem is i am having difficulties using the call library function specifying the input and ouput parameters since the function code is in C.

 

I tried to use the import manager on the BlueToothApis.dll but it doesnt work. None of the 97 functions can be converted into Labview Vi´s.

 

 

Can anyone help here?

 

 

Cheers

 

Erik

0 Kudos
Message 1 of 17
(4,811 Views)

Hi ErikDK,

 

What difficulties exactly do you have in specifying the input and output parameters when using the call library function? When you specify the dll, the inputs and outputs on the function in the VI will correspond to the inputs and outputs of the dll you're calling. 

 

What happens when you try to use the import manager on the BlueToothApis.dll? Do you get any kind of error message?

 

 

Cody

0 Kudos
Message 2 of 17
(4,759 Views)

Dear Cody,

thanks for the respond. Lets get into it by taking an example:

In the BlueToothApis.dll there is a function called BluetoothGATTGetServices. I want to use this in LabVIEW. I use the CallLibrary function.


Here is the description from Microsoft:

https://msdn.microsoft.com/en-us/library/windows/hardware/hh450802(v=vs.85).aspx



Since it is a very long time ago I looked on C-code, I am not sure how to set the input/output parameters on this function. Or even remember what a pointer is doing. Sorry. I am used to program in LabVIEW only.


If I use the import manager on the BlueToothApis.dll file I need to choose the corresponding header. I have tried several from the SDK, the ones I found on my PC. I downloaded them from the web. I get the following error:


The library contains 97 functions. But no function is found and recognized in the header file.


If some smart person could translate/write a VI for the BluetoothGATTGetServices that would help me a lot. I think I can manage it from there then. I just need a kick start. A push in the right direction so to say.


Looking forward to hear from you.


Cheers


Erik

 

0 Kudos
Message 3 of 17
(4,748 Views)

Hi,

 

You should be able to use the Call Library function node for calling this dll, then specifying the same inputs and outputs as are listed in the windows document you linked me. With Windows functions you will usually need to manually configure the input and output parameters, but this shouldn't be too difficult. There is a very useful document in LabVIEW help, if you type in Configuring the Call Library Function Node, which includes an example. I would suggest that you have a look through this, and let me know if you have any questions on it. If you like, you can send me the dll you're using and I can try to create a small example.

 

Cody

 

0 Kudos
Message 4 of 17
(4,691 Views)

Dear Cody,

 

unfortunatly it seems it is very difficult for me. So thanks for the offer. Here is a link to the file, LINK.

 

I look forward to see an example.

 

Cheers

 

Erik

 

 

 

0 Kudos
Message 5 of 17
(4,682 Views)

Hi Erik,

 

Are you using Windows 8? I am running Windows 7 and it seems like there may be some kind of compatibility issue. Also, just to clarify, there was no header file or type library to download from where you got this dll? It should be able to work with manual configuration of the parameters, but I can't seem to test it on my PC. 

 

 

Cody

0 Kudos
Message 6 of 17
(4,658 Views)

Dear Cody,

 

in WIN 7 as far as i know the GATT protocoll is not implemented. Therefore I tried WIN 8, 8.1 and 10.

 

I donwloaded the Windows Developer SDK kit for the different windows which provides a DLL file and and a header file.

 

But when i try to import the DLL file via the import manager i get the following error:

 

The library contains 97 functions. But no function is found and recognized in the header file.

 

Thats why i think i will have to do it manually with the call library function. But here I need help again since i have no clue how to set the input/output parameters.

 

 

Cheers

 

Erik

0 Kudos
Message 7 of 17
(4,650 Views)

Hi Erik,

 

Are you using 32 bit or 64 bit? You can only use 32-bit DLL files with 32-bit machines, so if you're running 64-bit this may be the cause of your problem. Could you send me the header file, or the link to the location where you downloaded these files so I could also take a look? 

 

I have tried to configure it manually, and it may work, but like I said, I can't test it for you. It may be possible for me later on to try this on a Windows 8 machine, but I cannot guarantee this. Are you aware if you or your company has a support package with us? I do want to help you with this, but since it may need a bit of work on our side then it would be a faster process if you could get in contact with support and make a service request. If not, I will continue to help you with this, and I could make a small VI for you to test. 

 

Thank you for your cooperation and patience!

 

Cody

0 Kudos
Message 8 of 17
(4,640 Views)

Dear Cody,

 

i have tested both 32 and 64 bit. I have three different PC´s running different Window versions.

 

Here is e.g. the link for WIN 8.1:

 

https://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx

 

 

Yes, we have the SSP package, and i already opened a support ticket. The guy was very helpfull, but we could not solve the problem.

 

I would love to see a VI from you and test it.

 

 

Cheers

 

Erik

 

0 Kudos
Message 9 of 17
(4,636 Views)

Dear Cody,

 

i recieved your PM and I wrote back to you several times. This is almost 2 weeks ago. Anything new?

 

Cheers

 

Erik

 

0 Kudos
Message 10 of 17
(4,512 Views)