1.) Call
FUSB_Initialize() --. pFusionUSB is the Uint32 pointer to the USB handle. It is 0 when not initialized. deviceID is the full string of the PID/VID including the hardware ID. instanceNumber should be 0. If it returns true, it was initialized successfully.
2.) Call
FUSB_Send() and
FUSB_Receive().
FUSB_Send takes an array of 64 bytes.
FUSB_Receive returns an array of bytes 64 long.
3.) Once you are all done, call
FUSB_Free() and pass in the pointer you used to initialize to free it. If it returns 0, then it was freed successfully.
Code:
public static class FusionUSB
{
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern bool FUSB_Initialize(ref UInt32 pFusionUSB, String deviceID, UInt32 instanceNumber);
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern bool FUSB_Receive(UInt32 pFusionUSB, byte[] buffer);
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern bool FUSB_Send(UInt32 pFusionUSB, byte[] buffer);
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern UInt32 FUSB_Free(ref UInt32 pFusionUSB);
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern bool FUSB_printf(UInt32 pFusionUSB);
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern UInt32 FUSB_GetWinUSBerror(UInt32 pFusionUSB);
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern UInt32 FUSB_GetFUSBstatus(UInt32 pFusionUSB);
[System.Runtime.InteropServices.DllImport("FusionUSB.dll")]
public static extern String FUSB_GetDeviceInstanceID(UInt32 pFusionUSB);
}