My system is using 3 redrats at the same time. I check to see if the system is connected to three redrats and then proceed to the next line of code. The code is give below.
devices = RedRat3USBImpl.FindRedRat3s();
if(device.Length!=3)
{
MessageBox.Show("Error");
}
About 4 or 6 times every day, I get an error message. When I check the computer, sometimes I find an error message saying "USB device has malfunctioned" and one of the redrats are missing in the device manager. Sometimes I dont get the error message but my program still fails.
I read somewhere that by using a USB powered hub, this problem is reduced. It is reduced but I still have this problem once in a while. Can you help me?
My whole code is shown below:-
IRedRat3 redRat3 = null;
IRedRat3 redRat31 = null;
IRedRat3 redRat32 = null;
// Find the no. of Redrats connected.
string[] devices = new string[3];
devices.Initialize();
devices = RedRat3USBImpl.FindRedRat3s();
if (devices.Length == 3)
{
redRat3 = RedRat3USBImpl.GetInstance(devices[
redRat31 = RedRat3USBImpl.GetInstance(devices[1]);
redRat32 = RedRat3USBImpl.GetInstance(devices[2]);
}
else
{
MessageBox.Show("One of the Redrats wasn't detected. Please Reinsert all Redrats.");
return 0;
}
AVDeviceDB newAVDeviceDB = null;
string fName = "RedratDatabase.xml";
XmlSerializer ser = new XmlSerializer(typeof(AVDeviceDB));
FileStream fs = null;
fs = new FileStream((new FileInfo(fName)).FullName, FileMode.Open);
newAVDeviceDB = (AVDeviceDB)ser.Deserialize(fs);
ModulatedSignal sig = (ModulatedSignal)newAVDeviceDB.GetIRPacket("Settop", Signal);
redRat3.OutputModulatedSignal(sig);
redRat31.OutputModulatedSignal(sig);
redRat32.OutputModulatedSignal(sig);
