LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BLE Bluetooth .NET API

 

 

Hello everubody.

I'm trying to comunicate with some BLE devices using CYPRESS USB Dongle. the application .exe from Cypress is able to connect with my devices and Write/Read information.

 

there is a .pdf document where explain the C# .NET API used and how we can use the DLLs into our Visual Studio (C#), but I'm using LabView2015.

 

I can Explore the API using .NET Connectivity, but I'm not able to make a real VI than works, actually I can't to put more than three blocks (Constructor, Invoke and pproperty node)

 

the files are annexed.

the PDF file explain into pages 9-13.

 

 

maybe some body can help with this, this is my firts time than I'm trying using API DLLs

0 Kudos
Message 1 of 14
(6,074 Views)

 

DLL's,

I renamed to ".doc", from ".dll", please return

Thank you all!

0 Kudos
Message 2 of 14
(6,071 Views)

Where is the VI where with your attempt?

0 Kudos
Message 3 of 14
(6,046 Views)

 

Here what I have now.!

 

0 Kudos
Message 4 of 14
(6,026 Views)

Well, you cant find the reference to the callback object since it is not implemented by the server DLL, but supposed to be provided by the caller.

 

You have two possibilities:

 

1) If the component also implements events for this, which is the officially sanctioned way in .Net to inform the caller about something, you can use that instead. LabVIEW supports .Net events.

 

2) If it doesn't, you could try to create a .Net component from a LabVIEW library that implements this callback class and then import it into your LabVIEW VI and pass it to the node. But this is going to be pretty tricky as the normal mode is not to try to match an existing .Net class interface when implementing the .Net component in LabVIEW but rather provide a .Net API that has to be called in the way it is exported by whoever needs its services.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 14
(5,997 Views)

This library requires you to write code targeting the CLR in order to use it (ie creating an object that implements the callback interface); LabVIEW does not target the CLR, only host it and provides a way to interact with the objects present in the system to a limited extent.

 

The third way (and in my opinon your best shot) is to wrap all the calls in a custom .Net assembly that exposes the commands as concrete objects (ie. instances of the interfaces are in the .Net assembly, not your LV code).

0 Kudos
Message 6 of 14
(5,969 Views)

 

 

The C# still need to make a class to get the Callbacks needed (CyBleMgrCallback and CyScanCallback)

 

---------------------------------

#region BleMgrCb

/// <summary>
/// BLE manager Callback class
/// </summary>
class BleMgrCb : CyBleMgrCallback
{
/// <summary>
/// Gets/Sets the connection handler
/// </summary>
public Action<CyConnectResult, CyStatus> ConnectionHandler { get; set; }

public override void OnConnected(CyConnectResult result, CyStatus status)
{
if (ConnectionHandler != null)
ConnectionHandler(result, status);
}
}

#endregion

#region ScanCb

/// <summary>
/// Scan callback class
/// </summary>
class ScanCb : CyScanCallback
{
#region props

/// <summary>
/// Gets/Sets the scan result handler
/// </summary>
public Action<CyScanResult> ScanResultHandler { get; set; }

/// <summary>
/// Gets/Sets the scan status changed handler
/// </summary>
public Action<CyScanStatus> ScanStatusChangedHandler { get; set; }

#endregion

#region overrides

public override void OnScanResult(CyScanResult result)
{
if (ScanResultHandler != null)
ScanResultHandler(result);
}

public override void OnScanStatusChanged(CyScanStatus scanStatus)
{
if (ScanStatusChangedHandler != null)
ScanStatusChangedHandler(scanStatus);
}

#endregion
}

#endregion
}

------------------------------

 

Can I do this classes in labView?

0 Kudos
Message 7 of 14
(5,849 Views)

No you cannot. LabVIEW will let you create and use .NET objects but not directly create .NET classes that inherit from .NET classes. You will need to create your own .NET assembly that contains these classes and then LabVIEW will be able to use them.

 

LabVIEW can create custom .NET classes from LabVIEW code but not inherit from existing .NET classes.

0 Kudos
Message 8 of 14
(5,846 Views)

Hi Luis,

 

Have you found any solution for this? Could you please share some details about the workaround.

 

Regards

Deepu Jacob

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 9 of 14
(5,117 Views)

Hello Luis,

 

Can you share your C# library if you have made the wrapper code in C#

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 10 of 14
(5,093 Views)