/// <summary>
				/// Move FFD motor of the wheel left or right
				/// </summary>
				/// <param name="forceXY">0xFF - 0xA7(left) and 0x00-0x64(rights) are measurable by feeling </param>
				internal void SetMotor (IDevice device, byte forceX, byte forceY, HIDDevice.WriteCallback callback)
				{


						if (__hidInterface.Generics.ContainsKey (device.ID)) {
								//TODO check if device use sbytes for 0x80 to 0x7f (-128 to 127)
								//Couldn't figure out if forceY doing something

								byte[] data = new byte[5];
								data [0] = 0x40;
								data [1] = forceX;
								data [2] = forceY;
								data [3] = 0x00;
								data [4] = 0x00;

								__hidInterface.Write (data, device.ID, callback);
								//__hidInterface.Generics[device].Write(data, callback);
						}
				}
Пример #2
0
 public virtual void Write(object data, HIDDevice.WriteCallback callback)
 {
     throw new NotImplementedException();
 }
				internal void StopMotor (IDevice device, HIDDevice.WriteCallback callback)
				{
						byte[] data = new byte[5];
						data [0] = 0x40;
						data [1] = 0x7f;
						data [2] = 0xff;
						data [3] = 0x00;
						data [4] = 0x00;

						this.__hidInterface.Write (data, device.ID, callback);
						//this.__hidInterface.Generics[device].Write(data, callback);
				}
 public void StopMotor(HIDDevice.WriteCallback callback)
 {
     ((ThrustMasterDriver)this.driver).StopMotor(this,callback);
 }
 /// <summary>
 /// Move FFD motor of the wheel left or right
 /// </summary>
 /// <param name="forces">0xFF - 0xA7(left) and 0x00-0x64(rights) are measurable by feeling </param>
 public void SetMotor(byte forceX,byte forceY,HIDDevice.WriteCallback callback)
 {
     ((ThrustMasterDriver)this.driver).SetMotor(this, forceX,forceY, callback);
 }
Пример #6
0
        /// <summary>
        /// Write a byte array to a specified address
        /// </summary>
        /// <param name="address">Address to write</param>
        /// <param name="size">Length of buffer</param>
        /// <param name="data">Data buffer</param>

        void WriteMemory(WiimoteDevice device, int address, byte size, byte[] data, HIDDevice.WriteCallback callback = null)
        {

            byte[] mBuff = new byte[REPORT_LENGTH];
            
            mBuff[0] = (byte)OutputReport.WriteMemory;
            mBuff[1] = (byte)(((address & 0xff000000) >> 24) | device.RumbleBit);
            mBuff[2] = (byte)((address & 0x00ff0000) >> 16);
            mBuff[3] = (byte)((address & 0x0000ff00) >> 8);
            mBuff[4] = (byte)(address & 0x000000ff);
            mBuff[5] = size;


            Array.Copy(data, 0, mBuff, 6, size);



            if (callback == null)
                _hidInterface.Write(mBuff, device.ID);
            else
                _hidInterface.Write(mBuff, device.ID, callback);

        }
Пример #7
0
 /// <summary>
 /// Write a single byte to the Wiimote
 /// </summary>
 /// <param name="address">Address to write</param>
 /// <param name="data">Byte to write</param>
 void WriteMemory(WiimoteDevice device, int address, byte data,HIDDevice.WriteCallback callback = null)
 {
     WriteMemory(device, address, 1, new byte[] { data },callback);
 }
Пример #8
0
        /// <summary>
        /// Read data or register from Wiimote
        /// </summary>
        /// <param name="address">Address to read</param>
        /// <param name="size">Length to read</param>

        void ReadMemory(WiimoteDevice device, int address, short size, HIDDevice.WriteCallback callback)
        {

            //Output Report 0x17 reads memory:
            //(52) 17 XX XX XX XX YY YY
            //XX XX XX XX is big-endian formatted address
            //YY YY is big-endian formatted size in bytes
            //LSB of first byte is rumble flag and is not part of address, should
            //be set to whatever state the rumble should be

            byte[] mBuff = new byte[REPORT_LENGTH];
           
            mBuff[0] = (byte)OutputReport.ReadMemory;
            mBuff[1] = (byte)(((address & 0xff000000) >> 24) | (uint)device.RumbleBit);
            mBuff[2] = (byte)((address & 0x00ff0000) >> 16);
            mBuff[3] = (byte)((address & 0x0000ff00) >> 8);
            mBuff[4] = (byte)(address & 0x000000ff);

            mBuff[5] = (byte)((size & 0xff00) >> 8);
            mBuff[6] = (byte)(size & 0xff);

        
            _hidInterface.Write(mBuff,device.ID, callback);

           
           

        }