Hi I thought I had it working but my last post was a little premature unfortunatly.
I still have a problem with Initializing the FB this time when using
FusionBrain_WinUSB.MainUSBClass.FindAllDevices(ref ver3, ref ver4);
it always returns true even though
FusionBrain_WinUSB.MainUSBClass.FindMyDevice(i, 4)
where i is the index. I think
FusionBrain_WinUSB.MainUSBClass.FindMyDevice(i, 4)
is correct to return false because the count of the ver4 list is 0 after calling FindAllDevices
I'm starting to think it's my set up?
I'm using
XP
Visual Studio 2008 full
Added
FusionBrainWinUSB.dll as a reference to my project
Uninstalled
MDX
FusionBrainV4 drivers(installed from drivers download on FusionControllCenter)
If I get this working I'll put up a for dummies post
Here is my complete code incase I have made some huge error
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FusionBrain_WinUSB;
namespace AAL
{
class FusionBrain
{
public void connect()
{
//holds list of devices found
List<string> ver3 = new List<string>();
List<string> ver4 = new List<string>();
byte[] buffer = new byte [64];
//returns true even if there is no Brain connected
bool deviceFound = FusionBrain_WinUSB.MainUSBClass.FindAllDevices(ref ver3, ref ver4);
Console.WriteLine("Device Found : " + deviceFound);
//count always == 0 even with 2 Brains connected
Console.WriteLine("Version 4 count: "+ ver4.Count() );
int index4 = 0;
for (int i = 0; i < ver4.Count; i++)
{
//not connecting when Brain is connected
bool myDevice = FusionBrain_WinUSB.MainUSBClass.FindMyDevice(i, 4);
if( myDevice )
{
index4 = i;
Console.WriteLine("Conected at Index: " + index4);
}
}
}
}
}