public void connectDevice()
        {
            int devSerial = Convert.ToInt32(view.DeviceListBox);

            for (int i = 0; i < iNumberOfDevices; i++)
            {
                if (ndNeoDevice[i].SerialNumber == devSerial)
                {
                    view.PublishMessageText = "Selected Device is " + Convert.ToString(devSerial);
                    ndNeoToOpen             = ndNeoDevice[i];
                    //Open the selecteddevice
                    if (ndNeoToOpen.DeviceType == (int)eHardwareTypes.NEODEVICE_VCAN3)
                    {
                        int iResult = icsNeoDll.icsneoOpenNeoDevice(ref ndNeoToOpen, ref m_hObject, ref bNetwork[0], 1, 0);
                        if (iResult == 1)
                        {
                            m_bPortOpen = true;
                            GlobalFunctions.ValueCANStatus = true;
                            view.PublishMessageText        = "ValueCAN3 with Serial Number " + Convert.ToString(devSerial) + " is connected";
                        }
                        else
                        {
                            m_bPortOpen = false;
                            GlobalFunctions.ValueCANStatus = false;
                            MessageBox.Show("Problem Opening CAN device");
                            return;
                        }
                        //Set the device type
                        iOpenDeviceType = ndNeoToOpen.DeviceType;
                    }
                    else
                    {
                        view.PublishMessageText = "Selected Device Type is not ValueCAN3";
                        MessageBox.Show("Selected Device Type is not ValueCAN3");
                    }
                }
            }
        }
コード例 #2
0
 public static extern Int32 icsneoOpenNeoDevice(ref NeoDevice pNeoDevice, ref Int32 hObject, ref byte bNetworkIDs, Int32 bConfigRead, Int32 bSyncToPC);
コード例 #3
0
 public static extern Int32 icsneoFindNeoDevices(UInt32 DeviceTypes, ref NeoDevice pNeoDevice, ref Int32 pNumDevices);
コード例 #4
0
ファイル: neoDevice.cs プロジェクト: lanwailan/TheFlash
 public static extern int icsneoOpenNeoDevice(ref NeoDevice pNeoDevice, ref int hObject, ref Byte bNetworkIDs, int bConfigRead, int bSyncToPC);