Showing the changes to Source/Libraries/GSF.EMAX/ControlFileStructures.cs (1 of 7 files). Show all
Unified · Split
| @@ -73,17 +73,25 @@ namespace GSF.EMAX · 72 unmodified lines | ||
| 73 | 73 | { |
| 74 | 74 | public UInt24 id; // System ID |
| 75 | 75 | public uint time; // Time of CTL file creation |
| 76 | − public ushort num_of_structs; // Number of Structures in CTL file (not really) | |
| 76 | + public int num_of_structs; // Number of Structures in CTL file (not really) | |
| 77 | 77 | |
| 78 | 78 | public CTL_HEADER(BinaryReader reader) |
| 79 | 79 | { |
| 80 | 80 | id = BigEndian.ToUInt24(reader.ReadBytes(3), 0); |
| 81 | 81 | time = BigEndian.ToUInt32(reader.ReadBytes(4), 0); |
| 82 | − num_of_structs = BigEndian.ToUInt16(reader.ReadBytes(2), 0); | |
| 82 | + num_of_structs = (int)BinaryCodedDecimal.Decode((uint)BigEndian.ToUInt16(reader.ReadBytes(2), 0)); | |
| 83 | 83 | |
| 84 | 84 | // Skip padding |
| 85 | 85 | reader.ReadBytes(2); |
| 86 | 86 | } |
| 87 | + | |
| 88 | + public DateTime Timestamp | |
| 89 | + { | |
| 90 | + get | |
| 91 | + { | |
| 92 | + return (new UnixTimeTag(time)).ToDateTime(); | |
| 93 | + } | |
| 94 | + } | |
| 87 | 95 | } |
| 88 | 96 | |
| 89 | 97 | public struct CTL_FILE_STRUCT |
| @@ -469,49 +477,49 @@ namespace GSF.EMAX · 379 unmodified lines | ||
| 469 | 477 | private const int PEAK_CAL_LEN = 4; |
| 470 | 478 | |
| 471 | 479 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CHANLNUM_LEN + 1)] |
| 472 | − string chanlnum; | |
| 480 | + public string chanlnum; | |
| 473 | 481 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TITLE_LEN + 1)] |
| 474 | − string title; | |
| 482 | + public string title; | |
| 475 | 483 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TYPE_LEN + 1)] |
| 476 | − string type; | |
| 484 | + public string type; | |
| 477 | 485 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = PRIMARY_LEN + 1)] |
| 478 | − string primary; | |
| 486 | + public string primary; | |
| 479 | 487 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SECONDARY_LEN + 1)] |
| 480 | − string secondary; | |
| 488 | + public string secondary; | |
| 481 | 489 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CAL_LEN + 1)] |
| 482 | − string cal_in; | |
| 490 | + public string cal_in; | |
| 483 | 491 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CAL_LEN + 1)] |
| 484 | − string cal_ref; | |
| 492 | + public string cal_ref; | |
| 485 | 493 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SHUNT_LEN + 1)] |
| 486 | − string shunt; | |
| 494 | + public string shunt; | |
| 487 | 495 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = ZERO_LINE_LEN + 1)] |
| 488 | − string display_location; | |
| 496 | + public string display_location; | |
| 489 | 497 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SCALE_FACTOR_LEN + 1)] |
| 490 | − string display_scale; | |
| 498 | + public string display_scale; | |
| 491 | 499 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = LIMIT_SET_LEN + 1)] |
| 492 | − string limit_set; | |
| 500 | + public string limit_set; | |
| 493 | 501 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = ON_OFF_LEN + 1)] |
| 494 | − string limit_on_off; | |
| 502 | + public string limit_on_off; | |
| 495 | 503 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SET_LEN + 1)] |
| 496 | − string over_set; | |
| 504 | + public string over_set; | |
| 497 | 505 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = ON_OFF_LEN + 1)] |
| 498 | − string over_on_off; | |
| 506 | + public string over_on_off; | |
| 499 | 507 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SET_LEN + 1)] |
| 500 | − string under_set; | |
| 508 | + public string under_set; | |
| 501 | 509 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = ON_OFF_LEN + 1)] |
| 502 | − string under_on_off; | |
| 510 | + public string under_on_off; | |
| 503 | 511 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SET_LEN + 1)] |
| 504 | − string rate_set; | |
| 512 | + public string rate_set; | |
| 505 | 513 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = ON_OFF_LEN + 1)] |
| 506 | − string rate_on_off; | |
| 514 | + public string rate_on_off; | |
| 507 | 515 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MULT_FACT_LEN + 1)] |
| 508 | − string mult_factor; | |
| 516 | + public string mult_factor; | |
| 509 | 517 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CT_RATIO_LEN + 1)] |
| 510 | − string ct_ratio; | |
| 518 | + public string ct_ratio; | |
| 511 | 519 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = PEAK_CAL_LEN + 1)] |
| 512 | − string peak_cal; | |
| 520 | + public string peak_cal; | |
| 513 | 521 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)] |
| 514 | − string cr_lf; | |
| 522 | + public string cr_lf; | |
| 515 | 523 | } |
| 516 | 524 | |
| 517 | 525 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] |
| @@ -523,17 +531,17 @@ namespace GSF.EMAX · 5 unmodified lines | ||
| 523 | 531 | private const int E_ON_OFF_LEN = 3; |
| 524 | 532 | |
| 525 | 533 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = EVENTNUM_LEN + 1)] |
| 526 | − string eventnum; | |
| 534 | + public string eventnum; | |
| 527 | 535 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = E_TITLE_LEN + 1)] |
| 528 | − string e_title; | |
| 536 | + public string e_title; | |
| 529 | 537 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NC_NO_LEN + 1)] |
| 530 | − string nc_no; | |
| 538 | + public string nc_no; | |
| 531 | 539 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = E_ON_OFF_LEN + 1)] |
| 532 | − string alarm_on_off; | |
| 540 | + public string alarm_on_off; | |
| 533 | 541 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = E_ON_OFF_LEN + 1)] |
| 534 | − string rtn_on_off; | |
| 542 | + public string rtn_on_off; | |
| 535 | 543 | [MarshalAs(UnmanagedType.I2)] |
| 536 | − ushort eveentdebouncems; | |
| 544 | + public ushort eveentdebouncems; | |
| 537 | 545 | } |
| 538 | 546 | |
| 539 | 547 | // Since this structure includes dynamically sized arrays, we manually parse structure |
| @@ -691,12 +699,12 @@ namespace GSF.EMAX · 151 unmodified lines | ||
| 691 | 699 | public struct A_SELECTION |
| 692 | 700 | { |
| 693 | 701 | public short size; |
| 694 | − public string value; | |
| 702 | + public byte[] value; | |
| 695 | 703 | |
| 696 | 704 | public A_SELECTION(BinaryReader reader) |
| 697 | 705 | { |
| 698 | 706 | size = reader.ReadInt16(); |
| 699 | − value = Encoding.ASCII.GetString(reader.ReadBytes(size)); | |
| 707 | + value = reader.ReadBytes(size); | |
| 700 | 708 | } |
| 701 | 709 | } |
| 702 | 710 | |
| @@ -862,9 +870,9 @@ namespace GSF.EMAX · 159 unmodified lines | ||
| 862 | 870 | public struct FAULT_LOCATION |
| 863 | 871 | { |
| 864 | 872 | [MarshalAs(UnmanagedType.I2)] |
| 865 | − short type; | |
| 873 | + public short type; | |
| 866 | 874 | [MarshalAs(UnmanagedType.R4)] |
| 867 | − float k; | |
| 875 | + public float k; | |
| 868 | 876 | }; |
| 869 | 877 | |
| 870 | 878 | // Since this structure includes a dynamically sized array, we manually parse structure |
| @@ -896,16 +904,16 @@ namespace GSF.EMAX · 25 unmodified lines | ||
| 896 | 904 | public struct SEQUENCE_CHANNELS |
| 897 | 905 | { |
| 898 | 906 | public short length; |
| 899 | − public SEQUENCE_CHANNEL[] groups; | |
| 907 | + public SEQUENCE_CHANNEL[] channels; | |
| 900 | 908 | |
| 901 | 909 | public SEQUENCE_CHANNELS(BinaryReader reader) |
| 902 | 910 | { |
| 903 | 911 | length = reader.ReadInt16(); |
| 904 | − groups = new SEQUENCE_CHANNEL[length / Marshal.SizeOf(typeof(SEQUENCE_CHANNEL))]; | |
| 912 | + channels = new SEQUENCE_CHANNEL[length / Marshal.SizeOf(typeof(SEQUENCE_CHANNEL))]; | |
| 905 | 913 | |
| 906 | − for (int i = 0; i < groups.Length; i++) | |
| 914 | + for (int i = 0; i < channels.Length; i++) | |
| 907 | 915 | { |
| 908 | − groups[i] = reader.ReadStructure<SEQUENCE_CHANNEL>(); | |
| 916 | + channels[i] = reader.ReadStructure<SEQUENCE_CHANNEL>(); | |
| 909 | 917 | } |
| 910 | 918 | } |
| 911 | 919 | } |