public int deviceStatus() { if (usingHID) { byte[] Buffer = new byte[byteDataLength]; Buffer[0] = 0x02; Buffer[1] = 0x06; bool write = LightFXSDK.HIDWrite(Buffer, Buffer.Length); Buffer[0] = 0x01; int status = LightFXSDK.HIDRead(Buffer, Buffer.Length); bool read = LightFXSDK.getReadStatus(); if (!read) { Global.logger.Info("Error Code: " + Marshal.GetLastWin32Error()); return(-1); } // Global.logger.Info("Read Status: " + write + ": " + read); return(status); } return(-1); //Marshal.FreeHGlobal(unmanagedPointer); }
public void Loop() { if (usingHID) { byte[] Buffer = new byte[byteDataLength]; Buffer[0] = 0x02; Buffer[1] = 0x04; bool result = LightFXSDK.HIDWrite(Buffer, Buffer.Length); } }
public void Reset(int status) { if (usingHID) { byte[] Buffer = new byte[byteDataLength]; Buffer[0] = 0x02; Buffer[1] = 0x07; Buffer[2] = (byte)status; bool read = LightFXSDK.HIDWrite(Buffer, Buffer.Length); } }
public bool ExecuteColors() { if (usingHID) { byte[] Buffer = new byte[byteDataLength]; Buffer[0] = 0x02; Buffer[1] = 0x05; bool result = LightFXSDK.HIDWrite(Buffer, Buffer.Length); return(result); } return(false); }
public void setColor(byte index, int bitmask, byte r, byte g, byte b) { if (usingHID) { byte[] Buffer = new byte[byteDataLength]; Buffer[0] = 0x02; Buffer[1] = 0x03; Buffer[2] = index; Buffer[3] = (byte)((bitmask & 0xFF0000) >> 16); Buffer[4] = (byte)((bitmask & 0x00FF00) >> 8); Buffer[5] = (byte)((bitmask & 0x0000FF)); Buffer[6] = r; Buffer[7] = g; Buffer[8] = b; // bool result = DeviceIoControl(devHandle, 0xb0195, Buffer, (uint)Buffer.Length, IntPtr.Zero, 0, ref writtenByteLength, IntPtr.Zero); bool result = LightFXSDK.HIDWrite(Buffer, Buffer.Length); Loop(); } //bool result2 = ExecuteColors(); // Global.logger.Info("Color Status: " + result + ": " + result2); //ExecuteColors(); }