Beispiel #1
0
            private static void Main()
            {
                var devices = DeviceDiscovery.FindHidDevices(new SerialStringMatcher("aimforfs.eu:RMP"));
                var device  = new UsbHidDevice(devices[0].Key);

                var command = new USB.Classes.Messaging.CommandMessage(0x20, new byte[] {
                    16,
                    0, (1 << 0) + (1 << 3) + (1 << 6) + (1 << 7) + (1 << 4),
                    1, 0x0,
                    2, 0x0,
                    3, 1 << 1,
                        4, (1 << 0) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 6) + (1 << 7),
                        5, (1 << 3) + (1 << 5),
                        6, 0x0,
                        7, (1 << 0) + (1 << 2) + (1 << 4) + (1 << 5) + (1 << 7),
                        8, (1 << 4) + (1 << 3) + (1 << 5) + (1 << 6),
                        9, (1 << 0) + (1 << 1) + (1 << 4) + (1 << 3) + (1 << 5) + (1 << 7),
                        10, (1 << 0) + (1 << 1) + (1 << 4) + (1 << 3) + (1 << 5) + (1 << 7),
                        11, (1 << 4) + (1 << 3) + (1 << 5) + (1 << 6),
                        12, (1 << 0) + (1 << 2) + (1 << 4) + (1 << 5) + (1 << 7),
                        13, (1 << 0) + (1 << 3) + (1 << 6) + (1 << 7) + (1 << 4),
                        14, (1 << 3) + (1 << 5),
                        15, (1 << 0) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 6) + (1 << 7)
                }, device.OutputReportByteLength);

                device.SendMessage(command);

                System.Diagnostics.Debug.WriteLine(devices);
            }
Beispiel #2
0
 public bool SendCommandMessage(byte command)
 {
     var message = new CommandMessage(command);
     return DeviceCommunication.WriteRawReportToDevice(message.MessageData, ref _deviceInformation);
 }
Beispiel #3
0
        public void PrimiPosalji(object sender, EventArgs e)
        {
            //Device.Dispose();
            //Device = new UsbHidDevice(0x1234, 0x0021);
            //Device.OnConnected += DeviceOnConnected;
            //Device.OnDisConnected += DeviceOnDisConnected;
            //Device.DataReceived += DeviceDataReceived;
            //Device.Connect();

            Random rnd = new Random();
            int asd = rnd.Next(1, 9)+48;
            byte dsa = (byte)asd;

            //MessageBox.Show("Tick");                    // Alert the user
            if (!Device.IsDeviceConnected)
            {

                Device.Connect();

                return;
            };

            var command = new CommandMessage(1);
            Device.SendMessage(command);
            try
            {
                float fl1 = float.Parse(Data1);

                float fl2 = float.Parse(Data2);

            }
            catch { };
        }
Beispiel #4
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 10, 200, 150), "Send Data"))
     {
         byte[] data = new byte[] { 0x58, 0x57, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0};
         var command = new CommandMessage(0x86, data);
         print(device.SendMessage(command));
     }
 }