mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Slash Lighting ID for GA605 #2892
This commit is contained in:
@@ -25,14 +25,22 @@ namespace GHelper.AnimeMatrix
|
|||||||
BatteryLevel,
|
BatteryLevel,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SlashPacket : Packet
|
||||||
|
{
|
||||||
|
public SlashPacket(byte[] command, byte reportID = 0x5E) : base(reportID, 128, command)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SlashDevice : Device
|
public class SlashDevice : Device
|
||||||
{
|
{
|
||||||
|
|
||||||
internal class SlashPacket : Packet
|
protected virtual byte reportID => 0x5E;
|
||||||
|
|
||||||
|
protected virtual SlashPacket CreatePacket(byte[] command)
|
||||||
{
|
{
|
||||||
public SlashPacket(byte[] command) : base(0x5E, 128, command)
|
return new SlashPacket(command, reportID);
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<SlashMode, string> Modes = new Dictionary<SlashMode, string>
|
public static Dictionary<SlashMode, string> Modes = new Dictionary<SlashMode, string>
|
||||||
@@ -90,25 +98,25 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public void WakeUp()
|
public void WakeUp()
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")), "SlashWakeUp");
|
Set(CreatePacket(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")), "SlashWakeUp");
|
||||||
Set(Packet<SlashPacket>(0xC2), "SlashWakeUp");
|
Set(CreatePacket([0xC2]), "SlashWakeUp");
|
||||||
Set(Packet<SlashPacket>(0xD1, 0x01, 0x00, 0x01), "SlashWakeUp");
|
Set(CreatePacket([0xD1, 0x01, 0x00, 0x01 ]), "SlashWakeUp");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(0xD7, 0x00, 0x00, 0x01, 0xAC), "SlashInit");
|
Set(CreatePacket([0xD7, 0x00, 0x00, 0x01, 0xAC]), "SlashInit");
|
||||||
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xAB), "SlashInit");
|
Set(CreatePacket([0xD2, 0x02, 0x01, 0x08, 0xAB]), "SlashInit");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEnabled(bool status = true)
|
public void SetEnabled(bool status = true)
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(0xD8, 0x02, 0x00, 0x01, status ? (byte)0x00 : (byte)0x80), $"SlashEnable {status}");
|
Set(CreatePacket([0xD8, 0x02, 0x00, 0x01, status ? (byte)0x00 : (byte)0x80]), $"SlashEnable {status}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(0xD4, 0x00, 0x00, 0x01, 0xAB), "SlashSave");
|
Set(CreatePacket([0xD4, 0x00, 0x00, 0x01, 0xAB]), "SlashSave");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMode(SlashMode mode)
|
public void SetMode(SlashMode mode)
|
||||||
@@ -124,8 +132,8 @@ namespace GHelper.AnimeMatrix
|
|||||||
modeByte = 0x00;
|
modeByte = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set(Packet<SlashPacket>(0xD2, 0x03, 0x00, 0x0C), "SlashMode");
|
Set(CreatePacket([0xD2, 0x03, 0x00, 0x0C]), "SlashMode");
|
||||||
Set(Packet<SlashPacket>(0xD3, 0x04, 0x00, 0x0C, 0x01, modeByte, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13), "SlashMode");
|
Set(CreatePacket([0xD3, 0x04, 0x00, 0x0C, 0x01, modeByte, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13]), "SlashMode");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetStatic(int brightness = 0)
|
public void SetStatic(int brightness = 0)
|
||||||
@@ -179,35 +187,35 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public void SetCustom(byte[] data)
|
public void SetCustom(byte[] data)
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xAC), "Static");
|
Set(CreatePacket([0xD2, 0x02, 0x01, 0x08, 0xAC]), "Static");
|
||||||
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAC, 0xFF, 0xFF, 0x01, 0x05, 0xFF, 0xFF), "StaticSettings");
|
Set(CreatePacket([0xD3, 0x03, 0x01, 0x08, 0xAC, 0xFF, 0xFF, 0x01, 0x05, 0xFF, 0xFF]), "StaticSettings");
|
||||||
Set(Packet<SlashPacket>(0xD4, 0x00, 0x00, 0x01, 0xAC), "StaticSave");
|
Set(CreatePacket([0xD4, 0x00, 0x00, 0x01, 0xAC]), "StaticSave");
|
||||||
|
|
||||||
byte[] payload = new byte[] { 0xD3, 0x00, 0x00, 0x07 };
|
byte[] payload = new byte[] { 0xD3, 0x00, 0x00, 0x07 };
|
||||||
Set(Packet<SlashPacket>(payload.Concat(data.Take(7)).ToArray()), "Static Data");
|
Set(CreatePacket(payload.Concat(data.Take(7)).ToArray()), "Static Data");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetOptions(bool status, int brightness = 0, int interval = 0)
|
public void SetOptions(bool status, int brightness = 0, int interval = 0)
|
||||||
{
|
{
|
||||||
byte brightnessByte = (byte)(brightness * 85.333);
|
byte brightnessByte = (byte)(brightness * 85.333);
|
||||||
|
|
||||||
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightnessByte, 0xFF, (byte)interval), "SlashOptions");
|
Set(CreatePacket([0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightnessByte, 0xFF, (byte)interval]), "SlashOptions");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBatterySaver(bool status)
|
public void SetBatterySaver(bool status)
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00), $"SlashBatterySaver {status}");
|
Set(CreatePacket([0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00]), $"SlashBatterySaver {status}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetLidMode(bool status)
|
public void SetLidMode(bool status)
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00), $"DisableLidClose {status}");
|
Set(CreatePacket([0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00]), $"DisableLidClose {status}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSleepActive(bool status)
|
public void SetSleepActive(bool status)
|
||||||
{
|
{
|
||||||
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xA1), "SleepInit");
|
Set(CreatePacket([0xD2, 0x02, 0x01, 0x08, 0xA1]), "SleepInit");
|
||||||
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xA1, 0x00, 0xFF, status ? (byte)0x01 : (byte)0x00, 0x02, 0xFF, 0xFF), $"Sleep {status}");
|
Set(CreatePacket([0xD3, 0x03, 0x01, 0x08, 0xA1, 0x00, 0xFF, status ? (byte)0x01 : (byte)0x00, 0x02, 0xFF, 0xFF]), $"Sleep {status}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set(Packet packet, string? log = null)
|
public void Set(Packet packet, string? log = null)
|
||||||
@@ -219,15 +227,11 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public class SlashDeviceAura : SlashDevice
|
public class SlashDeviceAura : SlashDevice
|
||||||
{
|
{
|
||||||
public SlashDeviceAura(): base(0x19B6)
|
protected override byte reportID => 0x5D;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
internal new class SlashPacket : Packet
|
protected override SlashPacket CreatePacket(byte[] command)
|
||||||
{
|
{
|
||||||
public SlashPacket(byte[] command) : base(0x5D, 128, command)
|
return new SlashPacket(command, reportID);
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user