Created
January 26, 2021 10:12
-
-
Save mgravell/1d80f94900c15671a7ff2b4f1bbe201d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
Console.WriteLine(Unsafe.SizeOf<Flags>()); // 50, it worked! | |
[StructLayout(LayoutKind.Sequential, Pack = 1)] | |
public struct Flags | |
{ | |
public ushort frameCnt; //0-1 | |
public ushort progVersion;//2-3 | |
public byte algUM;//4 | |
public byte deviceNumber;//5 | |
public _alg_1U _alg_1U;//6-15 | |
public ushort OUTPUTS;//16-17 | |
public _statS _StatS1;//18-19 | |
public _statS2 _StatS2; //20-21 | |
public ushort nbLector; //22-23 | |
public ushort nbSignal; //24-25 | |
public byte comBlockadeT1; //26 | |
public byte comBlockadeT2; //27 | |
public _permS permS; //28-29 | |
public ushort permHistory; //30-31 | |
public ushort stopInfo; //32-33 | |
public _controlFlagsS _controlFlagsS; //34-35 | |
public ushort timerInfo; //36-37 | |
public ushort timerTrDiagCycle; //38-39 | |
public ushort sizeOfStruct; //40-41 | |
public ushort methanSensorValue1; //42-43 | |
public ushort methanSensorValue2; //44-45 | |
public ushort methanSensorValue3; //46-47 | |
public ushort methanSensorValue4; //48-49 | |
} | |
[StructLayout(LayoutKind.Sequential, Pack = 1)] | |
public struct _alg_1U | |
{ | |
public byte PZP1; | |
public byte PZP2; | |
public byte PZS; | |
public byte PZZ1; | |
public byte PZZ2; | |
public byte PZZ3; | |
public byte KB1; | |
public byte KB2; | |
public byte KRU; | |
public byte reserved; | |
} | |
[Flags] | |
public enum _statS : ushort | |
{ | |
None = 0, | |
SYS_AW = 1 << 0, | |
SYS_BK = 1 << 1, | |
SYS_READY = 1 << 2, | |
SYS_WORK = 1 << 3, | |
PT_WORK = 1 << 4, | |
DISPATCHER_ON_LINE = 1 << 5, | |
SYS_STARTING = 1 << 6, | |
LEKTOR_ERROR = 1 << 7, | |
SYS_BK_KSR = 1 << 8, | |
SYS_READY_LEKTOR = 1 << 9, | |
SYS_INIT = 1 << 10, | |
KRU_WORK = 1 << 11, | |
SIG_RES_DIODA = 1 << 12, | |
SIG_RES_BK_KSR = 1 << 13, | |
SIG_RES_WORK = 1 << 14, | |
unUse16 = 1 << 15, | |
} | |
[Flags] | |
public enum _statS2 : ushort | |
{ | |
None = 0, | |
R1 = 1 << 0, | |
R2 = 1 << 1, | |
SAG_DISABLED = 1 << 2, | |
unUse4 = 1 << 3, | |
unUse5 = 1 << 4, | |
unUse6 = 1 << 5, | |
unUse7 = 1 << 6, | |
unUse8 = 1 << 7, | |
unUse9 = 1 << 8, | |
unUse10 = 1 << 9, | |
unUse11 = 1 << 10, | |
unUse12 = 1 << 11, | |
unUse13 = 1 << 12, | |
unUse14 = 1 << 13, | |
unUse15 = 1 << 14, | |
unUse16 = 1 << 15, | |
} | |
[Flags] | |
public enum _permS : ushort | |
{ | |
None = 0, | |
PZP1 = 1 << 0, | |
PZP2 = 1 << 1, | |
PZS = 1 << 2, | |
PZZ1 = 1 << 3, | |
PZZ2 = 1 << 4, | |
PZZ3 = 1 << 5, | |
KOMBAJN1 = 1 << 6, | |
KOMBAJN2 = 1 << 7, | |
KRU = 1 << 8, | |
PT = 1 << 9, | |
unUse11 = 1 << 10, | |
unUse12 = 1 << 11, | |
unUse13 = 1 << 12, | |
unUse14 = 1 << 13, | |
unUse15 = 1 << 14, | |
unUse16 = 1 << 15, | |
} | |
[Flags] | |
public enum _controlFlagsS : ushort | |
{ | |
None = 0, | |
confSaved = 1 << 0, | |
confFrameErr = 1 << 1, | |
confDataErr = 1 << 2, | |
passSaved = 1 << 3, | |
passFrameErr = 1 << 4, | |
unUse6 = 1 << 5, | |
unUse7 = 1 << 6, | |
unUse8 = 1 << 7, | |
unUse9 = 1 << 8, | |
unUse10 = 1 << 9, | |
unUse11 = 1 << 10, | |
unUse12 = 1 << 11, | |
unUse13 = 1 << 12, | |
unUse14 = 1 << 13, | |
unUse15 = 1 << 14, | |
unUse16 = 1 << 15, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment