Skip to content

Instantly share code, notes, and snippets.

@nikitalita
Last active October 29, 2020 03:55
Show Gist options
  • Save nikitalita/ec1b5c4e634ce670f1d28970a6ec1cf0 to your computer and use it in GitHub Desktop.
Save nikitalita/ec1b5c4e634ce670f1d28970a6ec1cf0 to your computer and use it in GitHub Desktop.
steamdevicereport.ci
enum BUTTON {
RT,
LT,
RS,
LS,
Y,
B,
X,
A,
PREV,
STEAM,
NEXT,
DPAD_U,
DPAD_R,
DPAD_L,
DPAD_D,
GRIP_L,
GRIP_R,
STICK_L,
TPAD_L,
TPAD_R
}
enum TOUCH {
leftPad,
rightPad
}
public class TriggerReport{
double left;
double right;
public double GetLeft(){
return left;
}
public double GetRight(){
return right;
}
public void SetLeft(double val){
left = val;
}
public void SetRight(double val){
right = val;
}
}
public class XYPosition{
double x;
double y;
public double GetX() {
return x;
}
public double GetY() {
return y;
}
public void SetX(double val) {
x=val;
}
public void SetY(double val) {
y=val;
}
}
public class PositionReport {
XYPosition() stick;
XYPosition() leftpad;
XYPosition() rightpad;
public XYPosition# GetStick(){
return stick;
}
public XYPosition# GetLeftPad(){
return leftpad;
}
public XYPosition# GetRightPad(){
return rightpad;
}
public void SetStick(XYPosition val){
stick= val;
}
public void SetLeftPad(XYPosition val){
leftpad= val;
}
public void SetRightPad(XYPosition val){
rightpad= val;
}
}
enum SteamDeviceState {
Disconnected = 0x00,
Pairing = 0x01,
Connected = 0x02
}
public class SteamDeviceReport{
int packetCounter;
float battery;
double timestamp;
string() macAddress;
SteamDeviceState state;
bool[20] buttons;
bool[2] touch;
TriggerReport() trigger;
PositionReport() position;
public int GetPacketCounter() => packetCounter;
public float GetBattery() => battery;
public double GetTimestamp() => timestamp;
public string GetMacAddress() => macAddress;
public SteamDeviceState GetState() => state;
public bool[] GetButtons() => buttons;
public bool[] GetTouch() => touch;
public TriggerReport# GetTrigger() => trigger;
public PositionReport# GetPosition() => position;
public void SetPacketCounter(int val) { packetCounter = val;}
public void SetBattery(float val) { battery = val;}
public void SetTimestamp(double val) { timestamp = val;}
public void SetMacAddress(string val) { macAddress = val;}
public void SetState(SteamDeviceState val) { state = val;}
public void SetButtons(bool[] val) { buttons = val;}
public void SetTouch(bool[] val) { touch = val;}
public void SetTrigger(TriggerReport# val) { trigger = val;}
public void SetPosition(PositionReport# val) { position = val;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment