Beispiel #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (simconnect == null)
            {
                try
                {
                    simconnect = new SimConnect("Managed Client Events", this.Handle, WM_USER_SIMCONNECT, null, 0);
                    initClientEvent();
                }
                catch (COMException ex)
                {
                    Debug.WriteLine("Unable to connect to FSX " + ex.Message);
                }
            }
            else
            {
                Debug.WriteLine("Error - try again");
                closeConnection();
            }

            efisDevice                 = new UsbHidDevice(0x16C0, 0x0486);
            efisDevice.OnConnected    += deviceOnConnected;
            efisDevice.OnDisConnected += deviceOnDisConnected;
            efisDevice.DataReceived   += deviceDataReceived;
            efisDevice.Connect();
        }
Beispiel #2
0
        public SensorListThermo(DataTable table)
        {
            Device = new UsbHidDevice(0x16C0, 0x0480);
            Device.DataReceived += DeviceDataReceived;
            connected            = Device.Connect();

            set = table;
        }
Beispiel #3
0
 private void FrmMainLoad(object sender, EventArgs e)
 {
     Device                 = new UsbHidDevice(VendorId, ProductId, 0x00, "HID-compliant device");//0x01, "HID-compliant game controller");//0x00, "HID-compliant device");
     Device.OnConnected    += DeviceOnConnected;
     Device.OnDisconnected += DeviceOnDisConnected;
     Device.DataReceived   += DeviceDataReceived;
     Device.Connect();
 }
Beispiel #4
0
 public Form1()
 {
     InitializeComponent();
     Device                 = new UsbHidDevice(0x046D, 0xC215);
     Device.OnConnected    += DeviceOnConnected;
     Device.OnDisConnected += DeviceOnDisConnected;
     Device.DataReceived   += DeviceDataReceived;
     bool isConnect = Device.Connect();
 }
Beispiel #5
0
 public SensorThermometer()
 {
     this.value             = "N/A";
     Device                 = new UsbHidDevice(0x16C0, 0x0480);
     Device.OnConnected    += DeviceOnConnected;
     Device.OnDisConnected += DeviceOnDisConnected;
     Device.DataReceived   += DeviceDataReceived;
     this.status            = SensorStatus.BUSY;
     Device.Connect();
 }
 //
 private void SetupHid()
 {
     Device = new UsbHidDevice(5566, 22352);
     if (Device.Connect())
     {
         Device.OnConnected    += DeviceOnConnected;
         Device.OnDisConnected += DeviceOnDisConnected;
         Device.DataReceived   += DeviceDataReceived;
     }
     else
     {
         MessageBox.Show("Canot connect to control Box, Please check usb cable!");
     }
 }
Beispiel #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        public LightClient(double defaultBrightness)
        {
            this.Brightness = defaultBrightness;

            // Instantiate new device
            Device = new UsbHidDevice(VendorId, ProductId);

            // Bind connection states
            Device.OnConnected    += DeviceOnConnected;
            Device.OnDisconnected += DeviceOnDisConnected;

            // Attempt connection
            this.Status = ConnectionStatus.Pending;
            Device.Connect();
        }
Beispiel #8
0
 public void connect()
 {
     Device.Connect();
 }