Big changes
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
// **********************************************************************************************************
|
||||
// CMessage.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Message: compatability option; This class provides a message object option that is compatible
|
||||
/// with what was used in COE 3.x. This is also the format generated by CMAT.
|
||||
/// </summary>
|
||||
public abstract class CMessage : coeMessage, IDisposable
|
||||
{
|
||||
protected CMessage(uint size) : this(size, 0) { }
|
||||
protected CMessage(uint size, uint label) : this(size, label, 0) { }
|
||||
protected CMessage(uint size, uint label, int priority) : base((int)size, label, priority) { }
|
||||
|
||||
~CMessage()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
new public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
new protected void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
abstract public byte[] serialize();
|
||||
abstract public bool deserialize(byte[] stream);
|
||||
|
||||
override public void Serialize()
|
||||
{
|
||||
byte[] data = serialize();
|
||||
if (data.Length > 0)
|
||||
{
|
||||
Marshal.Copy(data, 0, m_UnmanagedBuffer, data.Length);
|
||||
Size = (uint)data.Length;
|
||||
}
|
||||
}
|
||||
|
||||
override public void Deserialize()
|
||||
{
|
||||
byte[] data = copyFromMessageBuffer();
|
||||
deserialize(data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
1361
Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coe.cs
Normal file
1361
Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coe.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,138 @@
|
||||
// **********************************************************************************************************
|
||||
// coeDataInterchange.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
internal struct DataInterchangeManagedCodeFormatType
|
||||
{
|
||||
public DataInterchangeManagedCodeFormatType(coeDataInterchange.FormatType format)
|
||||
{
|
||||
m_Repetition = format.m_Repetition;
|
||||
m_FormatLength = format.m_FormatLength;
|
||||
m_Format = format.m_Format;
|
||||
}
|
||||
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
internal uint m_Repetition;
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
internal uint m_FormatLength;
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
internal uint m_Format;
|
||||
}
|
||||
|
||||
public class coeDataInterchange
|
||||
{
|
||||
public const int LABEL_SIZE = 40;
|
||||
|
||||
public class FormatType
|
||||
{
|
||||
public FormatType(string fieldName,
|
||||
uint repetition,
|
||||
uint length,
|
||||
char format)
|
||||
{
|
||||
m_FieldName = fieldName;
|
||||
m_Repetition = repetition;
|
||||
m_FormatLength = length;
|
||||
m_Format = format;
|
||||
}
|
||||
|
||||
public string m_FieldName;
|
||||
public uint m_Repetition;
|
||||
public uint m_FormatLength;
|
||||
public char m_Format;
|
||||
}
|
||||
|
||||
public class FormatPacketType
|
||||
{
|
||||
public FormatPacketType(string name,
|
||||
uint msgSize,
|
||||
uint numItems,
|
||||
FormatType[] format)
|
||||
{
|
||||
m_Name = name;
|
||||
m_NumberItems = numItems;
|
||||
m_DataByteSize = msgSize;
|
||||
m_Format = format;
|
||||
}
|
||||
|
||||
public string m_Name;
|
||||
public uint m_NumberItems;
|
||||
public uint m_DataByteSize;
|
||||
public FormatType[] m_Format;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
// **********************************************************************************************************
|
||||
// coeDataInterchangePackets.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Data Interchange Packet
|
||||
//
|
||||
//
|
||||
//
|
||||
public class coeDataInterchangePackets
|
||||
{
|
||||
private Dictionary<uint, IntPtr> _packets;
|
||||
public coe.CallBackDelegate _delegate;
|
||||
private GCHandle _GCdelegate;
|
||||
|
||||
internal coeDataInterchangePackets()
|
||||
{
|
||||
_packets = new Dictionary<uint, IntPtr>();
|
||||
_delegate = new coe.CallBackDelegate(Find);
|
||||
_GCdelegate = GCHandle.Alloc(_delegate);
|
||||
}
|
||||
|
||||
~coeDataInterchangePackets()
|
||||
{
|
||||
foreach (KeyValuePair<uint, IntPtr> entry in _packets)
|
||||
{
|
||||
Marshal.FreeHGlobal(entry.Value);
|
||||
}
|
||||
_GCdelegate.Free();
|
||||
}
|
||||
|
||||
internal IntPtr Find(uint Label)
|
||||
{
|
||||
_packets.TryGetValue(Label, out IntPtr packetArray);
|
||||
return packetArray;
|
||||
}
|
||||
|
||||
private void FormatString(byte[] dataBuffer, ref uint StartingIndex, string Name)
|
||||
{
|
||||
uint index;
|
||||
for (index = 0; index < Name.Length && index < 39; index++)
|
||||
{
|
||||
dataBuffer[StartingIndex++] = (byte)Name[(int)index];
|
||||
}
|
||||
for (; index < 40; index++)
|
||||
{
|
||||
dataBuffer[StartingIndex++] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void FormatUint(byte[] dataBuffer,
|
||||
ref uint StartingIndex,
|
||||
uint DataValue)
|
||||
{
|
||||
dataBuffer[StartingIndex++] = (byte)((DataValue) & 0xFF);
|
||||
dataBuffer[StartingIndex++] = (byte)((DataValue >> 8) & 0xFF);
|
||||
dataBuffer[StartingIndex++] = (byte)((DataValue >> 16) & 0xFF);
|
||||
dataBuffer[StartingIndex++] = (byte)((DataValue >> 24) & 0xFF);
|
||||
}
|
||||
|
||||
internal IntPtr Add(uint Label, coeDataInterchange.FormatPacketType packet)
|
||||
{
|
||||
IntPtr packetArray = IntPtr.Zero;
|
||||
if ((packet.m_NumberItems > 0) && (!_packets.TryGetValue(Label, out packetArray)))
|
||||
{
|
||||
int sizeOfInterchangeStructure = (int)(52 + (packet.m_NumberItems * 52));
|
||||
packetArray = Marshal.AllocHGlobal(sizeOfInterchangeStructure);
|
||||
byte[] dataArray = new byte[sizeOfInterchangeStructure];
|
||||
// Format the byte array with the data
|
||||
uint dataArrayIndex = 0;
|
||||
FormatString(dataArray, ref dataArrayIndex, packet.m_Name);
|
||||
FormatUint(dataArray, ref dataArrayIndex, packet.m_NumberItems);
|
||||
FormatUint(dataArray, ref dataArrayIndex, packet.m_DataByteSize);
|
||||
FormatUint(dataArray, ref dataArrayIndex, (uint)((IntPtr)(packetArray.ToInt32() + 52)));
|
||||
for (int count = 0; count < packet.m_NumberItems; count++)
|
||||
{
|
||||
FormatString(dataArray, ref dataArrayIndex, packet.m_Format[count].m_FieldName);
|
||||
FormatUint(dataArray, ref dataArrayIndex, packet.m_Format[count].m_Repetition);
|
||||
FormatUint(dataArray, ref dataArrayIndex, packet.m_Format[count].m_FormatLength);
|
||||
FormatUint(dataArray, ref dataArrayIndex, packet.m_Format[count].m_Format);
|
||||
}
|
||||
Marshal.Copy(dataArray, 0, packetArray, sizeOfInterchangeStructure);
|
||||
_packets.Add(Label, packetArray);
|
||||
}
|
||||
return packetArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
// **********************************************************************************************************
|
||||
// coeEndpoint.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Endpoint
|
||||
//
|
||||
//
|
||||
//
|
||||
public class coeEndpoint : IDisposable
|
||||
{
|
||||
#region DLLImports
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Create_Dynamic_With_Domain")]
|
||||
private static extern IntPtr OE_Endpoint_Create_Dynamic_With_Domain(IntPtr Name,
|
||||
coe.ScopeType Scope,
|
||||
IntPtr Router,
|
||||
uint Domain,
|
||||
uint MaximumTransmitMessages,
|
||||
uint MaximumReceiveMessages,
|
||||
uint MaximumTransmitMessageSize,
|
||||
uint MaximumReceiveMessageSize,
|
||||
IntPtr ApplicationContext,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Delete")]
|
||||
private static extern coe.Status OE_Endpoint_Delete(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Associate")]
|
||||
private static extern coe.Status OE_Endpoint_Associate(IntPtr _obj,
|
||||
IntPtr Event,
|
||||
TriggerType Trigger);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Send_Labeled")]
|
||||
private static extern coe.Status OE_Endpoint_Send_Labeled(IntPtr _obj,
|
||||
IntPtr Message,
|
||||
uint Options,
|
||||
uint Handling_Policy);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Peek")]
|
||||
private static extern coe.Status OE_Endpoint_Peek(IntPtr _obj,
|
||||
out uint Message_Label,
|
||||
out uint Message_Size,
|
||||
out int Message_Priority);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Wait")]
|
||||
private static extern coe.Status OE_Endpoint_Wait(IntPtr _obj,
|
||||
int Timeout);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Receive")]
|
||||
private static extern coe.Status OE_Endpoint_Receive(IntPtr _obj,
|
||||
ref IntPtr Message,
|
||||
uint Handling_Policy,
|
||||
int Timeout,
|
||||
IntPtr Source);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Register_Ex2")]
|
||||
private static extern coe.Status OE_Endpoint_Register_Ex2(IntPtr _obj,
|
||||
uint Label,
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)]
|
||||
coe.CallBackDelegate callbackD);
|
||||
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Deregister")]
|
||||
private static extern coe.Status OE_Endpoint_Deregister(IntPtr _obj,
|
||||
uint Label);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Empty")]
|
||||
private static extern coe.Status OE_Endpoint_Empty(IntPtr _obj);
|
||||
|
||||
#endregion
|
||||
|
||||
public enum TriggerType : int
|
||||
{
|
||||
DATA_RECEIVED = 0,
|
||||
BUFFER_EMPTY = 1,
|
||||
DATA_DISCARDED = 2
|
||||
};
|
||||
|
||||
private bool _disposed;
|
||||
private IntPtr _handle;
|
||||
private readonly coeEvent[] _events;
|
||||
private const int MaximumNumberOfEvents = 4;
|
||||
private int _numberOfEvents;
|
||||
|
||||
// Constant to be used for a non-queued endpoint
|
||||
public const uint NON_QUEUED_SIZE = 0;
|
||||
|
||||
public coeEndpoint(uint maxMessageSize, IntPtr router = default) : this(0, maxMessageSize, 0, router) { }
|
||||
public coeEndpoint(uint maxMessageSize, uint maxBufferMessages, IntPtr router = default)
|
||||
: this(0, maxMessageSize, maxBufferMessages, router) { }
|
||||
public coeEndpoint(uint domain, uint maxMessageSize, uint maxBufferMessages, IntPtr router = default)
|
||||
{
|
||||
_handle = OE_Endpoint_Create_Dynamic_With_Domain(IntPtr.Zero, coe.ScopeType.OE_Local, router, domain,
|
||||
maxBufferMessages, maxBufferMessages, maxMessageSize, maxMessageSize, IntPtr.Zero, out coe.Status oe_status);
|
||||
if (oe_status != coe.Status.SUCCESS)
|
||||
{
|
||||
_handle = IntPtr.Zero;
|
||||
throw new Exception("Unable to create OE_Endpoint. Error = " + oe_status);
|
||||
}
|
||||
else
|
||||
{
|
||||
_numberOfEvents = 0;
|
||||
_events = new coeEvent[MaximumNumberOfEvents];
|
||||
}
|
||||
}
|
||||
|
||||
~coeEndpoint()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
if (_handle != IntPtr.Zero)
|
||||
{
|
||||
for (int index = 0; index < _numberOfEvents; index++)
|
||||
{
|
||||
_events[index].Disable();
|
||||
}
|
||||
OE_Endpoint_Delete(_handle);
|
||||
_handle = IntPtr.Zero;
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
public IntPtr Handle
|
||||
{
|
||||
get { return _handle; }
|
||||
}
|
||||
|
||||
public coe.Status Register(uint label)
|
||||
{
|
||||
coe.Status status = OE_Endpoint_Register_Ex2(_handle, label, null);
|
||||
return status;
|
||||
}
|
||||
|
||||
public coe.Status Register(uint label, coeDataInterchange.FormatPacketType packet)
|
||||
{
|
||||
|
||||
coe._dataInterchangePackets.Add(label, packet);
|
||||
coe.Status status = OE_Endpoint_Register_Ex2(_handle, label, coe._dataInterchangePackets._delegate);
|
||||
return status;
|
||||
}
|
||||
|
||||
public coe.Status Deregister(uint label)
|
||||
{
|
||||
coe.Status status = OE_Endpoint_Deregister(_handle, label);
|
||||
return status;
|
||||
}
|
||||
|
||||
public coe.Status Send(coeMessage message)
|
||||
{
|
||||
return Send(message, 0);
|
||||
}
|
||||
|
||||
public coe.Status Send(coeMessage message, uint options)
|
||||
{
|
||||
message.Serialize();
|
||||
return OE_Endpoint_Send_Labeled(_handle, message.Handle, options, 0);
|
||||
}
|
||||
|
||||
public coe.Status Peek(out uint message_Label,
|
||||
out uint message_Size,
|
||||
out int message_Priority)
|
||||
{
|
||||
coe.Status status;
|
||||
status = OE_Endpoint_Peek(_handle, out uint messageLabel, out uint messageSize, out int messagePriority);
|
||||
message_Label = messageLabel;
|
||||
message_Size = messageSize;
|
||||
message_Priority = messagePriority;
|
||||
return status;
|
||||
}
|
||||
|
||||
public coe.Status Wait(int timeout)
|
||||
{
|
||||
return OE_Endpoint_Wait(_handle, timeout);
|
||||
}
|
||||
|
||||
public coe.Status Clear()
|
||||
{
|
||||
return OE_Endpoint_Empty(_handle);
|
||||
}
|
||||
|
||||
public coe.Status Receive(coeMessage message, int timeout)
|
||||
{
|
||||
coe.Status Status;
|
||||
IntPtr coeMessageHandle = message != null ? message.Handle : IntPtr.Zero;
|
||||
Status = OE_Endpoint_Receive(_handle, ref coeMessageHandle, 0, timeout, IntPtr.Zero);
|
||||
if (Status == coe.Status.SUCCESS)
|
||||
{
|
||||
message.Deserialize();
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
public coe.Status Receive(coeMessage message)
|
||||
{
|
||||
return Receive(message, coe.OE_Wait_Forever);
|
||||
}
|
||||
|
||||
public coe.Status Associate(coeEventFlag eventFlag, uint mask, TriggerType trigger)
|
||||
{
|
||||
coe.Status status;
|
||||
|
||||
if (_numberOfEvents >= MaximumNumberOfEvents)
|
||||
{
|
||||
status = coe.Status.FAILED_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
_events[_numberOfEvents] = new coeEvent();
|
||||
_events[_numberOfEvents].SetNotification(eventFlag, mask);
|
||||
status = OE_Endpoint_Associate(_handle, _events[_numberOfEvents].Handle, trigger);
|
||||
if (status == coe.Status.SUCCESS)
|
||||
{
|
||||
status = _events[_numberOfEvents].Enable();
|
||||
_numberOfEvents++;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
// **********************************************************************************************************
|
||||
// coeEvent.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Event
|
||||
//
|
||||
//
|
||||
//
|
||||
public class coeEvent : IDisposable
|
||||
{
|
||||
|
||||
#region DLLImports
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Create_Dynamic")]
|
||||
private static extern IntPtr OE_Event_Create_Dynamic(IntPtr Name,
|
||||
PersistenceType Persistence,
|
||||
int Priority,
|
||||
IntPtr ApplicationContext,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Delete")]
|
||||
public static extern coe.Status OE_Event_Delete(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Enable")]
|
||||
private static extern coe.Status OE_Event_Enable(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Disable")]
|
||||
private static extern coe.Status OE_Event_Disable(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Set_Event_Flag_Notification")]
|
||||
private static extern coe.Status OE_Event_Set_Event_Flag_Notification(IntPtr _obj,
|
||||
IntPtr EventFlag,
|
||||
uint Mask);
|
||||
#endregion
|
||||
|
||||
public enum PersistenceType : int
|
||||
{
|
||||
ONE_SHOT = 0,
|
||||
ENDURING = 1
|
||||
}
|
||||
private bool _disposed = false;
|
||||
private IntPtr _handle = IntPtr.Zero;
|
||||
|
||||
public coeEvent() : this(PersistenceType.ENDURING, 0) { }
|
||||
public coeEvent(PersistenceType persistence) : this(persistence, 0) { }
|
||||
public coeEvent(int priority) : this(PersistenceType.ENDURING, priority) { }
|
||||
public coeEvent(PersistenceType persistence, int priority)
|
||||
{
|
||||
_handle = OE_Event_Create_Dynamic(IntPtr.Zero, persistence, priority, IntPtr.Zero, out coe.Status oe_status);
|
||||
if (oe_status != coe.Status.SUCCESS)
|
||||
{
|
||||
_handle = IntPtr.Zero;
|
||||
throw new Exception("Unable to create OE_Event. Error = " + oe_status);
|
||||
}
|
||||
}
|
||||
|
||||
~coeEvent()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed) return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
if (_handle != IntPtr.Zero)
|
||||
{
|
||||
OE_Event_Delete(_handle);
|
||||
_handle = IntPtr.Zero;
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
internal IntPtr Handle
|
||||
{
|
||||
get { return _handle; }
|
||||
}
|
||||
|
||||
public coe.Status Enable()
|
||||
{
|
||||
return OE_Event_Enable(_handle);
|
||||
}
|
||||
|
||||
public coe.Status Disable()
|
||||
{
|
||||
return OE_Event_Disable(_handle);
|
||||
}
|
||||
|
||||
public coe.Status SetNotification(coeEventFlag eventFlag, uint mask)
|
||||
{
|
||||
return OE_Event_Set_Event_Flag_Notification(_handle, eventFlag.Handle, mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
// **********************************************************************************************************
|
||||
// coeEventFlag.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Event Flag
|
||||
//
|
||||
//
|
||||
//
|
||||
public class coeEventFlag : IDisposable
|
||||
{
|
||||
|
||||
#region DLLImports
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Create_Dynamic")]
|
||||
private static extern IntPtr OE_Event_Flag_Create_Dynamic(IntPtr Name,
|
||||
coe.ScopeType Scope,
|
||||
uint InitialMask,
|
||||
IntPtr ApplicationContext,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Delete")]
|
||||
private static extern coe.Status OE_Event_Flag_Delete(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Set")]
|
||||
private static extern coe.Status OE_Event_Flag_Set(IntPtr _obj,
|
||||
uint Mask);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Clear")]
|
||||
private static extern coe.Status OE_Event_Flag_Clear(IntPtr _obj,
|
||||
uint Mask);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Peek_Mask")]
|
||||
private static extern coe.Status OE_Event_Flag_Peek_Mask(IntPtr _obj,
|
||||
out uint Mask);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Wait")]
|
||||
private static extern coe.Status OE_Event_Flag_Wait(IntPtr _obj,
|
||||
uint Mask,
|
||||
uint ResetMask,
|
||||
WaitPolicyType PolicyType,
|
||||
int TimeInterval,
|
||||
out uint CurrentMask);
|
||||
|
||||
#endregion
|
||||
|
||||
private bool _disposed = false;
|
||||
private IntPtr _handle = IntPtr.Zero;
|
||||
|
||||
public enum WaitPolicyType : int
|
||||
{
|
||||
WAIT_FOR_ALL = 0,
|
||||
WAIT_FOR_ANY = 1
|
||||
}
|
||||
|
||||
public coeEventFlag()
|
||||
{
|
||||
_handle = OE_Event_Flag_Create_Dynamic(IntPtr.Zero, coe.ScopeType.OE_Local, 0, IntPtr.Zero, out coe.Status oe_status);
|
||||
if (oe_status != coe.Status.SUCCESS)
|
||||
{
|
||||
_handle = IntPtr.Zero;
|
||||
throw new Exception("Unable to create OE_Event_Flag. Error = " + oe_status);
|
||||
}
|
||||
}
|
||||
|
||||
~coeEventFlag()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
if (_handle != IntPtr.Zero)
|
||||
{
|
||||
OE_Event_Flag_Delete(_handle);
|
||||
_handle = IntPtr.Zero;
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
internal IntPtr Handle
|
||||
{
|
||||
get { return _handle; }
|
||||
}
|
||||
|
||||
public coe.Status Set(uint mask)
|
||||
{
|
||||
return OE_Event_Flag_Set(_handle, mask);
|
||||
}
|
||||
|
||||
public coe.Status Clear(uint mask)
|
||||
{
|
||||
return OE_Event_Flag_Clear(_handle, mask);
|
||||
}
|
||||
|
||||
public coe.Status Peek(out uint mask)
|
||||
{
|
||||
coe.Status status;
|
||||
status = OE_Event_Flag_Peek_Mask(_handle, out uint currentMask);
|
||||
mask = currentMask;
|
||||
return status;
|
||||
}
|
||||
|
||||
public coe.Status Wait(uint mask,
|
||||
uint resetMask,
|
||||
WaitPolicyType waitPolicy,
|
||||
int timeout,
|
||||
out uint currentMask)
|
||||
{
|
||||
coe.Status status;
|
||||
status = OE_Event_Flag_Wait(_handle, mask, resetMask, waitPolicy, timeout, out uint returnedMask);
|
||||
currentMask = returnedMask;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,392 @@
|
||||
// **********************************************************************************************************
|
||||
// coeMessage.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Message Attributes
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class MessageOffset : Attribute
|
||||
{
|
||||
readonly uint _bufferOffset;
|
||||
public MessageOffset(uint bufferOffset)
|
||||
{
|
||||
_bufferOffset = bufferOffset;
|
||||
}
|
||||
public uint Offset
|
||||
{
|
||||
get { return _bufferOffset; }
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class MessageSize : Attribute
|
||||
{
|
||||
readonly int _bufferSize;
|
||||
public MessageSize(int bufferSize)
|
||||
{
|
||||
_bufferSize = bufferSize;
|
||||
}
|
||||
public int Size
|
||||
{
|
||||
get { return _bufferSize; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message: base class
|
||||
/// </summary>
|
||||
public abstract class coeMessage : IDisposable
|
||||
{
|
||||
#region DLLImports
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_Create")]
|
||||
private static extern IntPtr OE_Message_Create(IntPtr Buffer_Address,
|
||||
uint Size,
|
||||
int Create_Shared,
|
||||
IntPtr ApplicationContext,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_Delete")]
|
||||
private static extern coe.Status OE_Message_Delete(IntPtr Handle);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Priority")]
|
||||
private static extern coe.Status OE_Message_set_Priority(IntPtr Handle,
|
||||
int Priority);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Priority")]
|
||||
private static extern int OE_Message_get_Priority(IntPtr Handle,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Domain")]
|
||||
private static extern coe.Status OE_Message_set_Domain(IntPtr Handle,
|
||||
uint Domain);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Domain")]
|
||||
private static extern uint OE_Message_get_Domain(IntPtr Handle,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Label")]
|
||||
private static extern coe.Status OE_Message_set_Label(IntPtr Handle,
|
||||
uint Label);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Label")]
|
||||
private static extern uint OE_Message_get_Label(IntPtr Handle,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Data_Size")]
|
||||
private static extern coe.Status OE_Message_set_Data_Size(IntPtr Handle,
|
||||
uint Size);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Data_Size")]
|
||||
private static extern uint OE_Message_get_Data_Size(IntPtr Handle,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Transmit_Timestamp")]
|
||||
private static extern coe.Status OE_Message_get_Transmit_Timestamp(IntPtr Handle,
|
||||
out ulong Seconds,
|
||||
out uint Fraction_Of_Second);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Receive_Timestamp")]
|
||||
private static extern coe.Status OE_Message_get_Receive_Timestamp(IntPtr Handle,
|
||||
out ulong Seconds,
|
||||
out uint Fraction_Of_Second);
|
||||
#endregion
|
||||
|
||||
private bool disposed = false;
|
||||
protected IntPtr m_Handle = IntPtr.Zero;
|
||||
protected IntPtr m_UnmanagedBuffer = IntPtr.Zero;
|
||||
protected int m_UnmanagedBufferSize = 0;
|
||||
protected int m_Size;
|
||||
protected byte[] m_Buffer;
|
||||
|
||||
//
|
||||
// The following routines are provided for testing and access purposes
|
||||
//
|
||||
public IntPtr GetUnmanagedBuffer() { return m_UnmanagedBuffer; }
|
||||
public byte[] GetManagedBuffer() { return m_Buffer; }
|
||||
|
||||
protected coeMessage(int size) : this(size, 0) { }
|
||||
protected coeMessage(int size, uint label) : this(size, label, 0) { }
|
||||
protected coeMessage(int size, uint label, int priority)
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
size = getPayloadSize();
|
||||
}
|
||||
if (size > 0)
|
||||
{
|
||||
m_Buffer = new byte[size];
|
||||
m_UnmanagedBuffer = Marshal.AllocHGlobal((int)size);
|
||||
m_UnmanagedBufferSize = (int)size;
|
||||
}
|
||||
m_Handle = OE_Message_Create(m_UnmanagedBuffer, (uint)size, coe.OE_FALSE, IntPtr.Zero, out coe.Status oe_status);
|
||||
if (oe_status != coe.Status.SUCCESS)
|
||||
{
|
||||
m_Handle = IntPtr.Zero;
|
||||
throw new Exception("Unable to create OE_Message. Error = " + oe_status);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Size = size;
|
||||
// The message was created successfully
|
||||
oe_status = OE_Message_set_Priority(m_Handle, priority);
|
||||
if (oe_status != coe.Status.SUCCESS)
|
||||
{
|
||||
throw new Exception("Unable to set message priority to " + priority + ". Error = " + oe_status);
|
||||
}
|
||||
|
||||
oe_status = OE_Message_set_Label(m_Handle, label);
|
||||
if (oe_status != coe.Status.SUCCESS)
|
||||
{
|
||||
throw new Exception("Unable to set message priority to " + label + ". Error = " + oe_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~coeMessage()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed) return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
if (m_UnmanagedBuffer != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(m_UnmanagedBuffer);
|
||||
m_UnmanagedBuffer = IntPtr.Zero;
|
||||
}
|
||||
if (m_Handle != IntPtr.Zero)
|
||||
{
|
||||
OE_Message_Delete(m_Handle);
|
||||
m_Handle = IntPtr.Zero;
|
||||
}
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
internal IntPtr Handle
|
||||
{
|
||||
get { return m_Handle; }
|
||||
}
|
||||
|
||||
public uint Domain
|
||||
{
|
||||
get
|
||||
{
|
||||
return OE_Message_get_Domain(m_Handle, out coe.Status status);
|
||||
}
|
||||
set
|
||||
{
|
||||
coe.Status status = OE_Message_set_Domain(m_Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
public uint Label
|
||||
{
|
||||
get
|
||||
{
|
||||
return OE_Message_get_Label(m_Handle, out coe.Status status);
|
||||
}
|
||||
set
|
||||
{
|
||||
coe.Status status = OE_Message_set_Label(m_Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
return OE_Message_get_Priority(m_Handle, out coe.Status status);
|
||||
}
|
||||
set
|
||||
{
|
||||
coe.Status status = OE_Message_set_Priority(m_Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
public uint Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return OE_Message_get_Data_Size(m_Handle, out coe.Status status);
|
||||
}
|
||||
set
|
||||
{
|
||||
coe.Status status = OE_Message_set_Data_Size(m_Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int BufferSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_UnmanagedBufferSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > m_UnmanagedBufferSize)
|
||||
{
|
||||
uint savedDomain = Domain;
|
||||
uint savedLabel = Label;
|
||||
int savedPriority = Priority;
|
||||
uint savedSize = Size;
|
||||
|
||||
if (m_UnmanagedBuffer != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(m_UnmanagedBuffer);
|
||||
m_UnmanagedBuffer = IntPtr.Zero;
|
||||
}
|
||||
if (m_Handle != IntPtr.Zero)
|
||||
{
|
||||
OE_Message_Delete(m_Handle);
|
||||
m_Handle = IntPtr.Zero;
|
||||
}
|
||||
m_Buffer = new byte[value];
|
||||
m_UnmanagedBuffer = Marshal.AllocHGlobal((int)value);
|
||||
m_UnmanagedBufferSize = (int)value;
|
||||
m_Handle = OE_Message_Create(m_UnmanagedBuffer, (uint)value, coe.OE_FALSE, IntPtr.Zero, out coe.Status oe_status);
|
||||
m_Size = value;
|
||||
|
||||
Domain = savedDomain;
|
||||
Label = savedLabel;
|
||||
Priority = savedPriority;
|
||||
Size = savedSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetSendTime(out ulong Seconds, out uint FractionOfSecond)
|
||||
{
|
||||
var status = OE_Message_get_Transmit_Timestamp(m_Handle, out ulong seconds, out uint fractionOfSecond);
|
||||
Seconds = seconds;
|
||||
FractionOfSecond = fractionOfSecond;
|
||||
}
|
||||
|
||||
public void GetReceiveTime(out ulong Seconds, out uint FractionOfSecond)
|
||||
{
|
||||
var status = OE_Message_get_Receive_Timestamp(m_Handle, out ulong seconds, out uint fractionOfSecond);
|
||||
Seconds = seconds;
|
||||
FractionOfSecond = fractionOfSecond;
|
||||
}
|
||||
|
||||
abstract public void Serialize();
|
||||
abstract public void Deserialize();
|
||||
|
||||
// Serialization/Deserialization support
|
||||
private void alignIndex(ref int dataBufferIndex,
|
||||
int alignment)
|
||||
{
|
||||
int indexMisalignment = dataBufferIndex % alignment;
|
||||
if (indexMisalignment > 0)
|
||||
{
|
||||
dataBufferIndex += alignment - indexMisalignment;
|
||||
}
|
||||
}
|
||||
|
||||
public int getPayloadSize()
|
||||
{
|
||||
int size = 0;
|
||||
return serializationSupport.getPayloadSize(this, GetType(), ref size);
|
||||
}
|
||||
|
||||
|
||||
protected void copyToMessageBuffer(byte[] data)
|
||||
{
|
||||
Marshal.Copy(data, 0, m_UnmanagedBuffer, data.Length);
|
||||
}
|
||||
|
||||
protected byte[] copyFromMessageBuffer()
|
||||
{
|
||||
byte[] data = null;
|
||||
uint dataSize = OE_Message_get_Data_Size(m_Handle, out coe.Status status);
|
||||
if (dataSize > 0)
|
||||
{
|
||||
Marshal.Copy(m_UnmanagedBuffer, m_Buffer, 0, (int)dataSize);
|
||||
data = m_Buffer;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
@@ -0,0 +1,102 @@
|
||||
// **********************************************************************************************************
|
||||
// coeMessageBasic.cs
|
||||
// 7/8/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// The coeMessageBasic class is a template that can be used to create user messages
|
||||
/// </summary>
|
||||
internal class coeMessageBasic : coeMessage, IDisposable
|
||||
{
|
||||
public coeMessageBasic(uint size) : this(size, 0) { }
|
||||
public coeMessageBasic(uint size, uint label) : this(size, label, 0) { }
|
||||
public coeMessageBasic(uint size, uint label, int priority) : base((int)size, label, priority) { }
|
||||
|
||||
~coeMessageBasic()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
new public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
new protected void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
override public void Serialize()
|
||||
{
|
||||
}
|
||||
|
||||
override public void Deserialize()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// **********************************************************************************************************
|
||||
// coeMessageFormatted.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Message: formatted option; This class provides automatic serialization
|
||||
// of all defined public members with an attribute describing the order and
|
||||
// placement in the binary buffer in which the message fields will be serialized.
|
||||
// All members not defined as public or without a MessageOffset attribute will be
|
||||
// ignored during serialization.
|
||||
//
|
||||
// Types currently supported include all scalar types and arrays of scalar types.
|
||||
// Structures are also supported, which can contain single dimension arrays of scalar types.
|
||||
// Structures can also be nested. The only restriction on all these elements is that arrays
|
||||
// cannot contain structures, however, structures can contain arrays of scalar elements.
|
||||
//
|
||||
// Specifying a 0 size will cause the constructor to try to automatically size the
|
||||
// message buffer, however since fields are individually specified, this may cause
|
||||
// difficulties in assuming what is actually needed. It is recommended that this
|
||||
// class be manually specified as to its internal buffer size.
|
||||
//
|
||||
// The same provision for arrays of classes that was described for the serialized option
|
||||
// holds for the formatted option. All arrays of classes must have all objects in the array
|
||||
// created with a new before sizing or serialization can be successfully done.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// public class exampleMessage : coeMessageFormatted
|
||||
// {
|
||||
// [MessageOffset(0)]
|
||||
// public uint field1;
|
||||
// [MessageOffset(4)]
|
||||
// public ushort field2;
|
||||
// [MessageOffset(6)]
|
||||
// public ushort field3;
|
||||
// [MessageOffset(8)]
|
||||
// public uint field4;
|
||||
// [MessageOffset(12)]
|
||||
// public uint field5;
|
||||
// [MessageOffset(16)]
|
||||
// public uint field6;
|
||||
// public exampleMessage(uint size) : base(size) { }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
public abstract class coeMessageFormatted : coeMessage, IDisposable
|
||||
{
|
||||
protected coeMessageFormatted(uint size) : this(size, 0) { }
|
||||
protected coeMessageFormatted(uint size, uint label) : this(size, label, 0) { }
|
||||
protected coeMessageFormatted(uint size, uint label, int priority) : base((int)size, label, priority) { }
|
||||
|
||||
~coeMessageFormatted()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
new public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
new protected void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private bool SerializeGetOffset(FieldInfo field, out int dataIndex)
|
||||
{
|
||||
MessageOffset offsetAttribute = null;
|
||||
dataIndex = 0;
|
||||
|
||||
//
|
||||
// The following line is for .NET 4.5 or later
|
||||
//
|
||||
// MessageOffset offsetAttribute = (MessageOffset)field.GetCustomAttribute(typeof(MessageOffset));
|
||||
//
|
||||
// The following lines are for earlier versions of .NET
|
||||
var attributes = field.GetCustomAttributes(typeof(MessageOffset), true);
|
||||
if (attributes.Length > 0)
|
||||
{
|
||||
offsetAttribute = (MessageOffset)attributes[0];
|
||||
}
|
||||
//
|
||||
//
|
||||
if (offsetAttribute != null)
|
||||
{
|
||||
dataIndex = (int)offsetAttribute.Offset;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
override public void Serialize()
|
||||
{
|
||||
uint dataSize = 0;
|
||||
int dataIndex = 0;
|
||||
FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo field in fields)
|
||||
{
|
||||
if (SerializeGetOffset(field, out dataIndex))
|
||||
{
|
||||
serializationSupport.serializeField(field, m_Buffer, ref dataIndex, this);
|
||||
if (dataIndex > dataSize) dataSize = (uint)dataIndex;
|
||||
}
|
||||
}
|
||||
Size = dataSize;
|
||||
if (dataSize > 0)
|
||||
{
|
||||
Marshal.Copy(m_Buffer, 0, m_UnmanagedBuffer, (int)dataSize);
|
||||
}
|
||||
}
|
||||
|
||||
override public void Deserialize()
|
||||
{
|
||||
byte[] data = copyFromMessageBuffer();
|
||||
int dataIndex = 0;
|
||||
FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo field in fields)
|
||||
{
|
||||
if (SerializeGetOffset(field, out dataIndex))
|
||||
{
|
||||
serializationSupport.deserializeField(field, data, ref dataIndex, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
@@ -0,0 +1,197 @@
|
||||
// **********************************************************************************************************
|
||||
// coeMessageSerialized.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Message: serializable option; This class provides automatic serialization
|
||||
// of all defined public members. All members not defined as public
|
||||
// will be ignored during serialization.
|
||||
//
|
||||
// Types currently supported include all scalar types and arrays of scalar types.
|
||||
// Structures are also supported, which can contain single dimension arrays of scalar types.
|
||||
// Structures can also be nested. This message class does support arrays of structures.
|
||||
//
|
||||
// The presence of the constructor is optional, and can be used to force a particular size
|
||||
// of a buffer. Omitting the size on the call to the base class, or providing a size value
|
||||
// of 0 will cause the constructor to automatically size the data, as will omitting the
|
||||
// constuctor declaration entirely.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// public class exampleMessage : coeMessageSerialized
|
||||
// {
|
||||
// public uint field1;
|
||||
// public ushort field2;
|
||||
// public ushort field3;
|
||||
// public uint field4;
|
||||
// public uint field5;
|
||||
// public uint field6;
|
||||
//
|
||||
// public exampleMessage() : base(SIZE) { }
|
||||
// }
|
||||
//
|
||||
// Special care needs to be taken when using arrays in a message definition, or in any class
|
||||
// that is used as a member of a message. Since C# arrays are dynamic, the array member must
|
||||
// be initialized with a new directive to declare the specific size of the array. This must
|
||||
// also be done for any sequences or strings used as message or class members. In addition,
|
||||
// any objects in that array must be specifically created and added to the array in the
|
||||
// constructor, if auto-sizing of the using message is being done. This initialization only
|
||||
// needs to be done for classes, not for data types. However, before the message can be
|
||||
// serialized for transmission, the array must be completely filled with the total number
|
||||
// of objects for which it was created.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// public class nestedStructure
|
||||
// {
|
||||
// public uint field1;
|
||||
// }
|
||||
//
|
||||
// public class exampleStructure
|
||||
// {
|
||||
// public uint field1;
|
||||
// public uint[] field2 = new uint[4];
|
||||
// public nestedStructure[] field3 = new nestedStructure[3];
|
||||
//
|
||||
// public exampleStructure()
|
||||
// {
|
||||
// field3[0] = new nestedStructure();
|
||||
// field3[1] = new nestedStructure();
|
||||
// field3[2] = new nestedStructure();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public class exampleMessage : coeMessageSerialized
|
||||
// {
|
||||
// public uint field1;
|
||||
// public coeSequence<uint> mySequence = new coeSequence<uint>(8);
|
||||
// public coeString myString = new coeString(12);
|
||||
// public exampleStructure mystructure = new exampleStructure();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
public abstract class coeMessageSerialized : coeMessage, IDisposable
|
||||
{
|
||||
protected coeMessageSerialized() : this(0) { }
|
||||
protected coeMessageSerialized(uint size) : this(size, 0) { }
|
||||
protected coeMessageSerialized(uint size, uint label) : this(size, label, 0) { }
|
||||
protected coeMessageSerialized(uint size, uint label, int priority) : base((int)size, label, priority) { }
|
||||
|
||||
~coeMessageSerialized()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
new public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
new protected void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
override public void Serialize()
|
||||
{
|
||||
FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
int dataIndex = 0;
|
||||
foreach (FieldInfo field in fields)
|
||||
{
|
||||
Type myType = field.GetType();
|
||||
object myObject = field.GetValue(this);
|
||||
serializationSupport.serializeField(field, m_Buffer, ref dataIndex, this);
|
||||
}
|
||||
Size = (uint)dataIndex;
|
||||
Marshal.Copy(m_Buffer, 0, m_UnmanagedBuffer, m_Buffer.Length);
|
||||
}
|
||||
|
||||
override public void Deserialize()
|
||||
{
|
||||
byte[] data = copyFromMessageBuffer();
|
||||
int dataIndex = 0;
|
||||
FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo field in fields)
|
||||
{
|
||||
serializationSupport.deserializeField(field, data, ref dataIndex, this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
@@ -0,0 +1,150 @@
|
||||
// **********************************************************************************************************
|
||||
// coeSequence.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Sequences and Strings
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
public class coeSequence<T>
|
||||
{
|
||||
private ushort _numberOfElements;
|
||||
private readonly ushort _maximumNumberOfElements;
|
||||
private readonly ushort _sizeOfElement;
|
||||
private readonly T[] _data;
|
||||
|
||||
public coeSequence(ushort length)
|
||||
{
|
||||
_maximumNumberOfElements = length;
|
||||
_numberOfElements = 0;
|
||||
_data = new T[length];
|
||||
int mySize = 0;
|
||||
serializationSupport.getPayloadSize(this, GetType(), ref mySize);
|
||||
_sizeOfElement = (ushort)((mySize - 8) / length);
|
||||
}
|
||||
|
||||
public Type ElementType
|
||||
{
|
||||
get
|
||||
{
|
||||
return typeof(T);
|
||||
}
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
_numberOfElements = 0;
|
||||
}
|
||||
|
||||
public uint Count()
|
||||
{
|
||||
return _numberOfElements;
|
||||
}
|
||||
|
||||
public uint MaximumCount()
|
||||
{
|
||||
return _maximumNumberOfElements;
|
||||
}
|
||||
|
||||
public ushort SizeOfElement
|
||||
{
|
||||
get { return _sizeOfElement; }
|
||||
}
|
||||
|
||||
public uint AddItem(T item)
|
||||
{
|
||||
if (_numberOfElements < _maximumNumberOfElements)
|
||||
{
|
||||
_data[_numberOfElements++] = item;
|
||||
}
|
||||
return _numberOfElements;
|
||||
}
|
||||
|
||||
public T Get(ushort index)
|
||||
{
|
||||
if (index < _numberOfElements)
|
||||
{
|
||||
return _data[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NullReferenceException("Index does not reference a valid value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
// **********************************************************************************************************
|
||||
// coeString.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
public class coeString
|
||||
{
|
||||
private ushort _numberOfElements;
|
||||
private readonly ushort _maximumNumberOfElements;
|
||||
private readonly ushort _sizeOfElement;
|
||||
private readonly byte[] _data;
|
||||
|
||||
public coeString(ushort length)
|
||||
{
|
||||
_maximumNumberOfElements = length;
|
||||
_numberOfElements = 0;
|
||||
_sizeOfElement = 1;
|
||||
_data = new byte[length + 2];
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_numberOfElements = 0;
|
||||
}
|
||||
|
||||
public uint Count()
|
||||
{
|
||||
return _numberOfElements;
|
||||
}
|
||||
|
||||
public uint MaximumCount()
|
||||
{
|
||||
return _maximumNumberOfElements;
|
||||
}
|
||||
|
||||
public ushort SizeOfElement
|
||||
{
|
||||
get { return _sizeOfElement; }
|
||||
}
|
||||
|
||||
public uint AddString(string item)
|
||||
{
|
||||
int index = 0;
|
||||
while (_numberOfElements < _maximumNumberOfElements &&
|
||||
index < item.Length)
|
||||
{
|
||||
_data[_numberOfElements++] = (byte)item[index++];
|
||||
}
|
||||
_data[_numberOfElements] = 0;
|
||||
return _numberOfElements;
|
||||
}
|
||||
|
||||
public string Get()
|
||||
{
|
||||
return Encoding.UTF8.GetString(_data, 0, _numberOfElements);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
// **********************************************************************************************************
|
||||
// coeTimer.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Timer
|
||||
//
|
||||
//
|
||||
//
|
||||
public class coeTimer : IDisposable
|
||||
{
|
||||
|
||||
#region DLLImports
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Create_Dynamic")]
|
||||
private static extern IntPtr OE_Timer_Create_Dynamic(IntPtr Name,
|
||||
coe.ScopeType Scope,
|
||||
uint TimerFormat,
|
||||
TimerType TimerKind,
|
||||
IntPtr Clock,
|
||||
IntPtr ApplicationContext,
|
||||
out coe.Status Status);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Delete")]
|
||||
public static extern coe.Status OE_Timer_Delete(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Associate")]
|
||||
private static extern coe.Status OE_Timer_Associate(IntPtr _obj,
|
||||
IntPtr Event,
|
||||
TriggerType Trigger);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Set_Relative")]
|
||||
private static extern coe.Status OE_Timer_Set_Relative(IntPtr _obj,
|
||||
uint TimeInterval);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Resume")]
|
||||
private static extern coe.Status OE_Timer_Resume(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Cancel")]
|
||||
private static extern coe.Status OE_Timer_Cancel(IntPtr _obj);
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Environment_get_The_System_Clock_Handler")]
|
||||
private static extern IntPtr OE_Environment_get_The_System_Clock_Handler();
|
||||
|
||||
[DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Clock_Handler_Convert_To_Time_Interval")]
|
||||
private static extern IntPtr OE_Clock_Handler_Convert_To_Time_Interval(IntPtr _obj,
|
||||
uint Interval,
|
||||
TimerResolutionType Resolution,
|
||||
out uint TimeInterval);
|
||||
#endregion
|
||||
|
||||
public enum TriggerType : int
|
||||
{
|
||||
TIMER_EXPIRED = 1
|
||||
};
|
||||
|
||||
public enum TimerType : int
|
||||
{
|
||||
PERIODIC = 0,
|
||||
ONE_SHOT = 1
|
||||
};
|
||||
|
||||
public enum TimerResolutionType : int
|
||||
{
|
||||
MINUTE = 0,
|
||||
SECOND = 1,
|
||||
MILLISECOND = 2,
|
||||
MICROSECOND = 3,
|
||||
FRAME = 4
|
||||
};
|
||||
|
||||
private bool _disposed = false;
|
||||
private IntPtr _handle = IntPtr.Zero;
|
||||
private const uint _timerRelative = 1;
|
||||
private readonly coeEvent _timerEvent;
|
||||
|
||||
public coeTimer(TimerType Type)
|
||||
{
|
||||
_handle = OE_Timer_Create_Dynamic(IntPtr.Zero, coe.ScopeType.OE_Local, _timerRelative, Type, OE_Environment_get_The_System_Clock_Handler(), IntPtr.Zero, out coe.Status oe_status);
|
||||
if (oe_status != coe.Status.SUCCESS)
|
||||
{
|
||||
_handle = IntPtr.Zero;
|
||||
throw new Exception("Unable to create OE_Timer. Error = " + oe_status);
|
||||
}
|
||||
else
|
||||
{
|
||||
_timerEvent = new coeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
~coeTimer()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed) return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
if (_handle != IntPtr.Zero)
|
||||
{
|
||||
_timerEvent.Disable();
|
||||
OE_Timer_Delete(_handle);
|
||||
_handle = IntPtr.Zero;
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
internal IntPtr Handle
|
||||
{
|
||||
get { return _handle; }
|
||||
}
|
||||
|
||||
public coe.Status Set(uint interval, TimerResolutionType resolution)
|
||||
{
|
||||
OE_Clock_Handler_Convert_To_Time_Interval(OE_Environment_get_The_System_Clock_Handler(), interval, resolution, out uint timerInterval);
|
||||
return OE_Timer_Set_Relative(_handle, timerInterval);
|
||||
}
|
||||
|
||||
public coe.Status Set(uint Interval)
|
||||
{
|
||||
return Set(Interval, TimerResolutionType.MILLISECOND);
|
||||
}
|
||||
|
||||
public coe.Status Resume()
|
||||
{
|
||||
return OE_Timer_Resume(_handle);
|
||||
}
|
||||
|
||||
public coe.Status Cancel()
|
||||
{
|
||||
return OE_Timer_Cancel(_handle);
|
||||
}
|
||||
|
||||
public coe.Status Associate(coeEventFlag eventFlag, uint mask, TriggerType trigger)
|
||||
{
|
||||
coe.Status Status;
|
||||
|
||||
_timerEvent.SetNotification(eventFlag, mask);
|
||||
Status = OE_Timer_Associate(_handle, _timerEvent.Handle, trigger);
|
||||
_timerEvent.Enable();
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,647 @@
|
||||
// **********************************************************************************************************
|
||||
// serializationSupport.cs
|
||||
// 6/1/2022
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// Copyright %(copyright)s Raytheon Company. //
|
||||
// This software was developed pursuant to Contract Number %(contractNumber)s //
|
||||
// with the U.S. government. The U.S. government's rights in and to this //
|
||||
// copyrighted software are as specified in DFARS 252.227-7014 which was made //
|
||||
// part of the above contract. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\UnlimitedRights>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// WARNING - This document contains technical data and / or technology whose //
|
||||
// export or disclosure to Non-U.S. Persons, wherever located, is restricted //
|
||||
// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. //
|
||||
// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. //
|
||||
// Section 730-774). This document CANNOT be exported (e.g., provided to a //
|
||||
// supplier outside of the United States) or disclosed to a Non-U.S. Person, //
|
||||
// wherever located, until a final jurisdiction and classification //
|
||||
// determination has been completed and approved by Raytheon, and any //
|
||||
// required U.S. Government approvals have been obtained. Violations are //
|
||||
// subject to severe criminal penalties. //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\EximUndetermined>
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Raytheon.Instruments.coeCSharp
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
// Serialization Support
|
||||
//
|
||||
//
|
||||
//
|
||||
public class serializationSupport
|
||||
{
|
||||
public static int getPayloadSize(object target, Type targetType, ref int size)
|
||||
{
|
||||
FieldInfo[] fields = targetType.GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo field in fields)
|
||||
{
|
||||
getFieldSize(field, target, ref size);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
public static int getFieldSize(FieldInfo field, object target, ref int size)
|
||||
{
|
||||
if (field.FieldType == typeof(char) ||
|
||||
field.FieldType == typeof(byte) ||
|
||||
field.FieldType == typeof(byte) ||
|
||||
field.FieldType == typeof(sbyte))
|
||||
{
|
||||
size += 1;
|
||||
}
|
||||
else if (field.FieldType == typeof(char[]) ||
|
||||
field.FieldType == typeof(byte[]) ||
|
||||
field.FieldType == typeof(byte[]) ||
|
||||
field.FieldType == typeof(sbyte[]))
|
||||
{
|
||||
byte[] values = (byte[])field.GetValue(target);
|
||||
size += 1 * ((Array)field.GetValue(target)).Length;
|
||||
}
|
||||
else if (field.FieldType == typeof(short) ||
|
||||
field.FieldType == typeof(ushort) ||
|
||||
field.FieldType == typeof(short) ||
|
||||
field.FieldType == typeof(ushort))
|
||||
{
|
||||
alignIndex(ref size, 2);
|
||||
size += 2;
|
||||
}
|
||||
else if (field.FieldType == typeof(short[]) ||
|
||||
field.FieldType == typeof(ushort[]) ||
|
||||
field.FieldType == typeof(short[]) ||
|
||||
field.FieldType == typeof(ushort[]))
|
||||
{
|
||||
alignIndex(ref size, 2);
|
||||
size += 2 * ((Array)field.GetValue(target)).Length;
|
||||
}
|
||||
else if (field.FieldType == typeof(int) ||
|
||||
field.FieldType == typeof(uint) ||
|
||||
field.FieldType == typeof(int) ||
|
||||
field.FieldType == typeof(uint) ||
|
||||
field.FieldType == typeof(float))
|
||||
{
|
||||
alignIndex(ref size, 4);
|
||||
size += 4;
|
||||
}
|
||||
else if (field.FieldType == typeof(int[]) ||
|
||||
field.FieldType == typeof(uint[]) ||
|
||||
field.FieldType == typeof(int[]) ||
|
||||
field.FieldType == typeof(uint[]) ||
|
||||
field.FieldType == typeof(float[]))
|
||||
{
|
||||
alignIndex(ref size, 4);
|
||||
size += 4 * ((Array)field.GetValue(target)).Length;
|
||||
}
|
||||
else if (field.FieldType == typeof(long) ||
|
||||
field.FieldType == typeof(ulong) ||
|
||||
field.FieldType == typeof(long) ||
|
||||
field.FieldType == typeof(ulong) ||
|
||||
field.FieldType == typeof(double))
|
||||
{
|
||||
alignIndex(ref size, 8);
|
||||
size += 8;
|
||||
}
|
||||
else if (field.FieldType == typeof(long[]) ||
|
||||
field.FieldType == typeof(ulong[]) ||
|
||||
field.FieldType == typeof(long[]) ||
|
||||
field.FieldType == typeof(ulong[]) ||
|
||||
field.FieldType == typeof(double[]))
|
||||
{
|
||||
alignIndex(ref size, 8);
|
||||
size += 8 * ((Array)field.GetValue(target)).Length;
|
||||
}
|
||||
else if (field.FieldType.IsArray) // Array of classes
|
||||
{
|
||||
alignIndex(ref size, 4);
|
||||
Array targetArray = (Array)field.GetValue(target);
|
||||
int arraySize = targetArray.Length;
|
||||
object[] objectArray = (object[])field.GetValue(target);
|
||||
var arrayElementType = objectArray.GetType().GetElementType();
|
||||
for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
|
||||
{
|
||||
object arrayItem = objectArray[arrayIndex];
|
||||
Type arrayItemType = arrayItem.GetType();
|
||||
FieldInfo[] subfields = arrayItemType.GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo subfield in subfields)
|
||||
{
|
||||
Type subfieldType = subfield.GetType();
|
||||
Type elementType = subfield.FieldType.GetElementType();
|
||||
getFieldSize(subfield, arrayItem, ref size);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Class
|
||||
{
|
||||
alignIndex(ref size, 4);
|
||||
object objectItem = field.GetValue(target);
|
||||
FieldInfo[] subfields = field.FieldType.GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo subfield in subfields)
|
||||
{
|
||||
Type subfieldType = subfield.GetType();
|
||||
Type elementType = subfield.FieldType.GetElementType();
|
||||
getFieldSize(subfield, objectItem, ref size);
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public static void alignIndex(ref int dataBufferIndex, int alignment)
|
||||
{
|
||||
int indexMisalignment = dataBufferIndex % alignment;
|
||||
if (indexMisalignment > 0)
|
||||
{
|
||||
dataBufferIndex += alignment - indexMisalignment;
|
||||
}
|
||||
}
|
||||
public static void serializeField(FieldInfo field,
|
||||
byte[] dataBuffer,
|
||||
ref int dataBufferIndex,
|
||||
object target)
|
||||
{
|
||||
Type fieldType = field.GetType();
|
||||
object fieldObject = field.GetValue(target);
|
||||
|
||||
if (field.FieldType == typeof(char) ||
|
||||
field.FieldType == typeof(byte) ||
|
||||
field.FieldType == typeof(byte) ||
|
||||
field.FieldType == typeof(sbyte))
|
||||
{
|
||||
byte value = Convert.ToByte(field.GetValue(target));
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
}
|
||||
else if (field.FieldType == typeof(char[]))
|
||||
{
|
||||
char[] values = (char[])field.GetValue(target);
|
||||
foreach (char value in values)
|
||||
{
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(byte[]) ||
|
||||
field.FieldType == typeof(byte[]) ||
|
||||
field.FieldType == typeof(sbyte[]))
|
||||
{
|
||||
byte[] values = (byte[])field.GetValue(target);
|
||||
foreach (byte value in values)
|
||||
{
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(short) ||
|
||||
field.FieldType == typeof(ushort) ||
|
||||
field.FieldType == typeof(short) ||
|
||||
field.FieldType == typeof(ushort))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 2);
|
||||
ushort value = Convert.ToUInt16(field.GetValue(target));
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF);
|
||||
}
|
||||
else if (field.FieldType == typeof(short[]) ||
|
||||
field.FieldType == typeof(ushort[]) ||
|
||||
field.FieldType == typeof(short[]) ||
|
||||
field.FieldType == typeof(ushort[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 2);
|
||||
ushort[] values = (ushort[])field.GetValue(target);
|
||||
foreach (char value in values)
|
||||
{
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(int) ||
|
||||
field.FieldType == typeof(uint) ||
|
||||
field.FieldType == typeof(int) ||
|
||||
field.FieldType == typeof(uint))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
uint value = Convert.ToUInt32(field.GetValue(target));
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF);
|
||||
}
|
||||
else if (field.FieldType == typeof(float))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
float floatValue = (float)field.GetValue(target);
|
||||
byte[] valueArray = BitConverter.GetBytes(floatValue);
|
||||
dataBuffer[dataBufferIndex++] = valueArray[0];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[1];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[2];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[3];
|
||||
}
|
||||
else if (field.FieldType == typeof(int[]) ||
|
||||
field.FieldType == typeof(uint[]) ||
|
||||
field.FieldType == typeof(int[]) ||
|
||||
field.FieldType == typeof(uint[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
uint[] values = (uint[])field.GetValue(target);
|
||||
foreach (uint value in values)
|
||||
{
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(float[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
float[] values = (float[])field.GetValue(target);
|
||||
foreach (float floatValue in values)
|
||||
{
|
||||
byte[] valueArray = BitConverter.GetBytes(floatValue);
|
||||
dataBuffer[dataBufferIndex++] = valueArray[0];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[1];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[2];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[3];
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(long) ||
|
||||
field.FieldType == typeof(ulong) ||
|
||||
field.FieldType == typeof(long) ||
|
||||
field.FieldType == typeof(ulong))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
ulong value = Convert.ToUInt64(field.GetValue(target));
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 32 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 40 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 48 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 56 & 0xFF);
|
||||
}
|
||||
else if (field.FieldType == typeof(double))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
double doubleValue = (double)field.GetValue(target);
|
||||
byte[] valueArray = BitConverter.GetBytes(doubleValue);
|
||||
dataBuffer[dataBufferIndex++] = valueArray[0];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[1];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[2];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[3];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[4];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[5];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[6];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[7];
|
||||
}
|
||||
else if (field.FieldType == typeof(long[]) ||
|
||||
field.FieldType == typeof(ulong[]) ||
|
||||
field.FieldType == typeof(long[]) ||
|
||||
field.FieldType == typeof(ulong[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
ulong[] values = (ulong[])field.GetValue(target);
|
||||
foreach (ulong value in values)
|
||||
{
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 32 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 40 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 48 & 0xFF);
|
||||
dataBuffer[dataBufferIndex++] = (byte)(value >> 56 & 0xFF);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(double[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
double[] values = (double[])field.GetValue(target);
|
||||
foreach (double doubleValue in values)
|
||||
{
|
||||
byte[] valueArray = BitConverter.GetBytes(doubleValue);
|
||||
dataBuffer[dataBufferIndex++] = valueArray[0];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[1];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[2];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[3];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[4];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[5];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[6];
|
||||
dataBuffer[dataBufferIndex++] = valueArray[7];
|
||||
}
|
||||
}
|
||||
else if (field.FieldType.IsArray) // Array of classes
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
Array targetArray = (Array)field.GetValue(target);
|
||||
int arraySize = targetArray.Length;
|
||||
object[] objectArray = (object[])field.GetValue(target);
|
||||
Type arrayElementType = objectArray.GetType().GetElementType();
|
||||
for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
|
||||
{
|
||||
object arrayItem = objectArray[arrayIndex];
|
||||
Type arrayItemType = arrayItem.GetType();
|
||||
FieldInfo[] subfields = arrayItemType.GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo subfield in subfields)
|
||||
{
|
||||
Type subfieldType = subfield.GetType();
|
||||
Type elementType = subfield.FieldType.GetElementType();
|
||||
serializeField(subfield, dataBuffer, ref dataBufferIndex, arrayItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Class
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
FieldInfo[] subfields = fieldObject.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo subfield in subfields)
|
||||
{
|
||||
Type subfieldType = subfield.GetType();
|
||||
Type elementType = subfield.FieldType.GetElementType();
|
||||
serializeField(subfield, dataBuffer, ref dataBufferIndex, fieldObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void deserializeField(FieldInfo field,
|
||||
byte[] dataBuffer,
|
||||
ref int dataBufferIndex,
|
||||
object target)
|
||||
{
|
||||
Type fieldType = field.GetType();
|
||||
object fieldObject = field.GetValue(target);
|
||||
|
||||
if (field.FieldType == typeof(char))
|
||||
{
|
||||
char value = Convert.ToChar(dataBuffer[dataBufferIndex++]);
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
else if (field.FieldType == typeof(byte) ||
|
||||
field.FieldType == typeof(byte))
|
||||
{
|
||||
byte value = dataBuffer[dataBufferIndex++];
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
else if (field.FieldType == typeof(sbyte))
|
||||
{
|
||||
sbyte value = Convert.ToSByte(dataBuffer[dataBufferIndex++]);
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
else if (field.FieldType == typeof(char[]))
|
||||
{
|
||||
char[] values = (char[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = (char)dataBuffer[dataBufferIndex++];
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType == typeof(byte[]) ||
|
||||
field.FieldType == typeof(byte[]))
|
||||
{
|
||||
byte[] values = (byte[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = dataBuffer[dataBufferIndex++];
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType == typeof(sbyte[]))
|
||||
{
|
||||
sbyte[] values = (sbyte[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = (sbyte)dataBuffer[dataBufferIndex++];
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType == typeof(short) ||
|
||||
field.FieldType == typeof(ushort) ||
|
||||
field.FieldType == typeof(short) ||
|
||||
field.FieldType == typeof(ushort))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 2);
|
||||
ushort value = (ushort)(dataBuffer[dataBufferIndex++] +
|
||||
(ushort)(dataBuffer[dataBufferIndex++] << 8));
|
||||
if (field.FieldType == typeof(short) ||
|
||||
field.FieldType == typeof(short))
|
||||
{
|
||||
field.SetValue(target, Convert.ToInt16(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(short[]) ||
|
||||
field.FieldType == typeof(ushort[]) ||
|
||||
field.FieldType == typeof(short[]) ||
|
||||
field.FieldType == typeof(ushort[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 2);
|
||||
ushort[] values = (ushort[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = (ushort)(dataBuffer[dataBufferIndex++] +
|
||||
(ushort)(dataBuffer[dataBufferIndex++] << 8));
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType == typeof(int) ||
|
||||
field.FieldType == typeof(uint) ||
|
||||
field.FieldType == typeof(int) ||
|
||||
field.FieldType == typeof(uint))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
uint value = dataBuffer[dataBufferIndex++] +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 8) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 16) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 24);
|
||||
if (field.FieldType == typeof(int) ||
|
||||
field.FieldType == typeof(int))
|
||||
{
|
||||
field.SetValue(target, Convert.ToInt32(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(int[]) ||
|
||||
field.FieldType == typeof(uint[]) ||
|
||||
field.FieldType == typeof(int[]) ||
|
||||
field.FieldType == typeof(uint[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
uint[] values = (uint[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = dataBuffer[dataBufferIndex++] +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 8) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 16) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 24);
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType == typeof(float))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
float singleValue = BitConverter.ToSingle(dataBuffer, dataBufferIndex);
|
||||
dataBufferIndex += 4;
|
||||
field.SetValue(target, singleValue);
|
||||
}
|
||||
else if (field.FieldType == typeof(float[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
float[] values = (float[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = BitConverter.ToSingle(dataBuffer, dataBufferIndex);
|
||||
dataBufferIndex += 4;
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType == typeof(long) ||
|
||||
field.FieldType == typeof(ulong) ||
|
||||
field.FieldType == typeof(long) ||
|
||||
field.FieldType == typeof(ulong))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
uint value = dataBuffer[dataBufferIndex++] +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 8) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 16) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 24) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 32) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 40) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 48) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 56);
|
||||
if (field.FieldType == typeof(long) ||
|
||||
field.FieldType == typeof(long))
|
||||
{
|
||||
field.SetValue(target, Convert.ToInt64(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
}
|
||||
else if (field.FieldType == typeof(long[]) ||
|
||||
field.FieldType == typeof(ulong[]) ||
|
||||
field.FieldType == typeof(long[]) ||
|
||||
field.FieldType == typeof(ulong[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
ulong[] values = (ulong[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = dataBuffer[dataBufferIndex++] +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 8) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 16) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 24) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 32) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 40) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 48) +
|
||||
((uint)dataBuffer[dataBufferIndex++] << 56);
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType == typeof(double))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
field.SetValue(target, BitConverter.ToDouble(dataBuffer, dataBufferIndex));
|
||||
dataBufferIndex += 8;
|
||||
}
|
||||
else if (field.FieldType == typeof(double[]))
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 8);
|
||||
double[] values = (double[])field.GetValue(target);
|
||||
for (int index = 0; index < values.Length; index++)
|
||||
{
|
||||
values[index] = BitConverter.ToDouble(dataBuffer, dataBufferIndex);
|
||||
dataBufferIndex += 8;
|
||||
}
|
||||
field.SetValue(target, values);
|
||||
}
|
||||
else if (field.FieldType.IsArray)
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
Array targetArray = (Array)field.GetValue(target);
|
||||
int arraySize = targetArray.Length;
|
||||
object[] objectArray = (object[])field.GetValue(target);
|
||||
Type arrayElementType = objectArray.GetType().GetElementType();
|
||||
for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
|
||||
{
|
||||
object arrayItem = objectArray[arrayIndex];
|
||||
Type arrayItemType = arrayItem.GetType();
|
||||
FieldInfo[] subfields = arrayItemType.GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo subfield in subfields)
|
||||
{
|
||||
Type subfieldType = subfield.GetType();
|
||||
Type elementType = subfield.FieldType.GetElementType();
|
||||
deserializeField(subfield, dataBuffer, ref dataBufferIndex, arrayItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alignIndex(ref dataBufferIndex, 4);
|
||||
FieldInfo[] subfields = fieldObject.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (FieldInfo subfield in subfields)
|
||||
{
|
||||
Type subfieldType = subfield.GetType();
|
||||
object subfieldObject = subfield.GetValue(fieldObject);
|
||||
Type elementType = subfield.FieldType.GetElementType();
|
||||
deserializeField(subfield, dataBuffer, ref dataBufferIndex, fieldObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//\\<Unclassified>
|
||||
//----------------------------------------------------------------------------//
|
||||
// UNCLASSIFIED //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
Reference in New Issue
Block a user