155 lines
3.8 KiB
C#
155 lines
3.8 KiB
C#
// UNCLASSIFIED
|
|
/*-------------------------------------------------------------------------
|
|
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.
|
|
|
|
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
|
GOVERNMENT.
|
|
|
|
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
|
-------------------------------------------------------------------------*/
|
|
|
|
using System;
|
|
|
|
namespace FpgaMeasurementInstrumentsLib
|
|
{
|
|
/// <summary>
|
|
/// The header for the response messages
|
|
/// </summary>
|
|
internal class FPGARspMessageHeader
|
|
{
|
|
#region PrivateClassMembers
|
|
private const int m_HEADER_SIZE = 0;
|
|
private const uint m_ENTIRE_MSG_SIZE = 8;
|
|
#endregion
|
|
|
|
#region PublicFunctions
|
|
|
|
/// <summary>
|
|
/// Copy constructor
|
|
/// </summary>
|
|
/// <param name="header">The header to copy</param>
|
|
public FPGARspMessageHeader(FPGARspMessageHeader header)
|
|
{
|
|
try
|
|
{
|
|
// m_data = header.m_data;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Constructor for when receiving data.
|
|
/// Use this constructor and then parse to populate it
|
|
/// </summary>
|
|
public FPGARspMessageHeader()
|
|
{
|
|
try
|
|
{
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Constructor for sending
|
|
/// </summary>
|
|
/// <param name="commandType">the type of the message</param>
|
|
public FPGARspMessageHeader(FPGARspMsgIds commandType)
|
|
{
|
|
try
|
|
{
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Encode the header into a byte array for sending
|
|
/// </summary>
|
|
/// <param name="pData">The buffer to put the message items</param>
|
|
public void Format(IntPtr pData)
|
|
{
|
|
try
|
|
{
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Getter for the entire message length in bytes
|
|
/// </summary>
|
|
/// <returns>The number of bytes in the message, including header</returns>
|
|
public uint GetEntireMsgLength()
|
|
{
|
|
try
|
|
{
|
|
return m_ENTIRE_MSG_SIZE;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// getter for the header length in bytes
|
|
/// </summary>
|
|
/// <returns>The header length in bytes</returns>
|
|
public uint GetHeaderLength()
|
|
{
|
|
try
|
|
{
|
|
return m_HEADER_SIZE;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Takes an array of bytes and populates the header object
|
|
/// </summary>
|
|
/// <param name="pData">The header in byte form</param>
|
|
public void Parse(IntPtr pData)
|
|
{
|
|
try
|
|
{
|
|
// copy data into our structure and byte swap
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a string version of the header members
|
|
/// </summary>
|
|
/// <returns>A string containning the header data</returns>
|
|
public override string ToString()
|
|
{
|
|
string msg = "Header Data:\r\n\r\n";
|
|
return msg;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|