示例#1
0
        public DSPComms()
        {
            dspDevice = new CMcsUsbFactoryNet();
            dspDevice.EnableExceptions(true);
            usblist.Initialize(DeviceEnumNet.MCS_MEAUSB_DEVICE); // Get list of MEA devices connect by USB

            bool dspPortFound = false;
            uint lockMask     = 64;

            for (uint ii = 0; ii < usblist.Count; ii++)
            {
                if (usblist.GetUsbListEntry(ii).SerialNumber.EndsWith("B"))
                {
                    dspPort      = usblist.GetUsbListEntry(ii);
                    dspPortFound = true;
                    break;
                }
            }

            if (dspPortFound && (dspDevice.Connect(dspPort, lockMask) == 0))
            {
                connected = true;
                dspDevice.Disconnect();
            }
            else
            {
                Console.WriteLine("Fug!");
            }
        }
示例#2
0
        public void SearchDevice()
        {
            devices.Initialize(DeviceEnumNet.MCS_MEAUSB_DEVICE); // Get list of MEA devices connect by USB

            RawPort = null;
            DspPort = null;

            DevicesReady = false;
            if (devices.Count == 2)
            {
                for (uint i = 0; i < devices.Count; i++)                       // loop through number of devices found
                {
                    if (devices.GetUsbListEntry(i).SerialNumber.EndsWith("A")) // check for each device if serial number ends with "A" (USB 1) This USB interface will be used by MC_Rack
                    {
                        RawPort = devices.GetUsbListEntry(i);
                    }
                    if (devices.GetUsbListEntry(i).SerialNumber.EndsWith("B"))// check for each device if serial number ends with "B" (USB 2) This USB interface will be used to control DSP
                    {
                        DspPort = devices.GetUsbListEntry(i);
                    }
                }
                Console.WriteLine("Both ports available");
                DevicesReady = true;
            }

            if (DeviceStateChange != null)
            {
                DeviceStateChange(this, EventArgs.Empty);
            }
        }
示例#3
0
 private void updateDeviceList()
 {
     usblist.Initialize(DeviceEnumNet.MCS_MEA_DEVICE);
     devices = new String[usblist.Count];
     for (uint ii = 0; ii < usblist.Count; ii++)
     {
         devices[ii] =
             usblist.GetUsbListEntry(ii).DeviceName + " / "
             + usblist.GetUsbListEntry(ii).SerialNumber;
     }
     this.devices = devices;
 }
示例#4
0
 private void btMeaDevice_present_Click(object sender, EventArgs e)
 {
     cbDevices.Items.Clear();
     usblist.Initialize(DeviceEnumNet.MCS_MEA_DEVICE);
     for (uint i = 0; i < usblist.Count; i++)
     {
         cbDevices.Items.Add(usblist.GetUsbListEntry(i).DeviceName + " / " + usblist.GetUsbListEntry(i).SerialNumber);
     }
     if (cbDevices.Items.Count > 0)
     {
         cbDevices.SelectedIndex = 0;
     }
 }