CigiSOFV3 Class Reference

#include <CigiSOFV3.h>

Inheritance diagram for CigiSOFV3:

CigiBaseSOF CigiBasePacket List of all members.

Public Member Functions

 CigiSOFV3 ()
virtual ~CigiSOFV3 ()
virtual int Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const
virtual int Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec)
Cigi_uint32 GetFrameCntr (void) const
int SetFrameCntr (const Cigi_uint32 FrameCntrIn, bool bndchk=true)
Cigi_uint32 GetTimeStamp (void) const
int SetTimeStamp (const Cigi_uint32 TimeStamp, bool bndchk=true)
bool GetTimeStampValid (void) const
int SetTimeStampValid (const bool TimeStampValidIn, bool bndchk=true)
EarthRefModelGrp GetEarthRefModel (void) const
int SetEarthRefModel (const EarthRefModelGrp EarthRefModelIn, bool bndchk=true)

Detailed Description

The class for the Start Of Frame packet for CIGI version 3

Definition at line 69 of file CigiSOFV3.h.


Constructor & Destructor Documentation

CigiSOFV3::CigiSOFV3 (  ) 

Definition at line 83 of file CigiSOFV3.cpp.

References CigiBaseSOF::BSwapEn, CigiBaseSOF::ByteSwap, CIGI_SOF_PACKET_ID_V3, CIGI_SOF_PACKET_SIZE_V3, CigiBaseSOF::DatabaseID, CigiBaseSOF::EarthRefModel, CigiBaseSOF::FrameCntr, CigiBaseSOF::IGMode, CigiBaseSOF::LastRcvdHostFrame, CigiBasePacket::MinorVersion, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseSOF::Standby, CigiBaseSOF::TimeStampV2, CigiBaseSOF::TimeStampV3, CigiBaseSOF::TimestampValid, CigiBasePacket::Version, and CigiBaseSOF::WGS84.

00084 {
00085 
00086    PacketID = CIGI_SOF_PACKET_ID_V3;
00087    PacketSize = CIGI_SOF_PACKET_SIZE_V3;
00088    Version = 3;
00089    MinorVersion = 0;
00090 
00091    BSwapEn = false;
00092    DatabaseID = 0;
00093    FrameCntr = 0;
00094    TimeStampV2 = 0.0f;
00095    TimeStampV3 = 0;
00096    ByteSwap = 0x8000;
00097    IGMode = Standby;
00098    TimestampValid = false;
00099    EarthRefModel = WGS84;
00100    LastRcvdHostFrame = 0;
00101 
00102 }

CigiSOFV3::~CigiSOFV3 (  )  [virtual]

Definition at line 107 of file CigiSOFV3.cpp.

00108 {
00109 
00110 }


Member Function Documentation

EarthRefModelGrp CigiSOFV3::GetEarthRefModel ( void   )  const [inline]

Gets the earth reference model indicator.

Returns:
The earth reference model indicator.
0 - WGS84.
1 - System defined.

Definition at line 188 of file CigiSOFV3.h.

00188 { return(EarthRefModel); }

Cigi_uint32 CigiSOFV3::GetFrameCntr ( void   )  const [inline]

Gets the Frame Counter value

Returns:
Current frame this data represents

Reimplemented from CigiBaseSOF.

Definition at line 114 of file CigiSOFV3.h.

00114 { return(FrameCntr); }

Cigi_uint32 CigiSOFV3::GetTimeStamp ( void   )  const [inline]

Gets the V3 timestamp.

Returns:
The timestamp count in 10 microseconds increments.

Definition at line 139 of file CigiSOFV3.h.

00139 { return(TimeStampV3); }

bool CigiSOFV3::GetTimeStampValid ( void   )  const [inline]

Gets the timestamp valid flag.

Returns:
The timestamp valid flag.

Definition at line 159 of file CigiSOFV3.h.

00159 { return(TimestampValid); }

int CigiSOFV3::Pack ( CigiBasePacket Base,
Cigi_uint8 Buff,
void *  Spec 
) const [virtual]

The virtual Pack function for CIGI 1

Parameters:
Base - A pointer to the instance of the packet to be packed. (Downcast to CigiBasePacket)
Buff - A pointer to the current pack point.
Spec - A pointer to special data - This is not used in this class.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Implements CigiBaseSOF.

Definition at line 123 of file CigiSOFV3.cpp.

References PackPointerUnion::b, PackPointerUnion::c, CigiBaseSOF::DatabaseID, CigiBaseSOF::EarthRefModel, CigiBaseSOF::FrameCntr, CigiBaseSOF::IGMode, CigiBaseSOF::IGStatus, PackPointerUnion::l, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseSOF::TimeStampV3, CigiBaseSOF::TimestampValid, and CigiBasePacket::Version.

00124 {
00125    PackPointer CDta;
00126 
00127    CigiBaseSOF *Data = ( CigiBaseSOF *) Base;
00128 
00129 
00130    CDta.c = Buff;
00131 
00132    *CDta.c++ = PacketID;
00133    *CDta.c++ = PacketSize;
00134    *CDta.c++ = Version;
00135 
00136    *CDta.b++ = Data->DatabaseID;
00137    *CDta.c++ = Data->IGStatus;
00138 
00139    Cigi_uint8 HDta = (Data->TimestampValid) ? 0x04 : 0;
00140    HDta |= (Cigi_uint8)(Data->IGMode & 0x03);
00141    HDta |= (Cigi_uint8)((Data->EarthRefModel << 3) & 0x08);
00142 
00143    *CDta.c++ = HDta;
00144 
00145    *CDta.s++ = 0x8000;  // Byte Swap
00146    *CDta.l++ = Data->FrameCntr;
00147    *CDta.l++ = Data->TimeStampV3;
00148 
00149 
00150    return(PacketSize);
00151 
00152 }

int CigiSOFV3::SetEarthRefModel ( const EarthRefModelGrp  EarthRefModelIn,
bool  bndchk = true 
)

Sets the earth reference model indicator with bound checking control.

Parameters:
EarthRefModelIn - Specifies the earth reference model is valid for use.
0 - WGS84.
1 - System defined.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 224 of file CigiSOFV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseSOF::EarthRefModel.

00226 {
00227 
00228 #ifndef CIGI_NO_BND_CHK
00229    if(bndchk && ((EarthRefModelIn < 0)||(EarthRefModelIn > 1)))
00230    {
00231 #ifndef CIGI_NO_EXCEPT
00232       throw CigiValueOutOfRangeException("EarthRefModel",EarthRefModelIn,0,1);
00233 #endif
00234       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00235    }
00236 #endif
00237 
00238    EarthRefModel = EarthRefModelIn;
00239 
00240    return(CIGI_SUCCESS);
00241 
00242 }

int CigiSOFV3::SetFrameCntr ( const Cigi_uint32  FrameCntrIn,
bool  bndchk = true 
) [inline]

Sets the Frame Counter with bound checking control

Parameters:
FrameCntrIn - Specifies the frame.
bndchk - Enables (true) or disables (false) bounds checking
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Reimplemented from CigiBaseSOF.

Definition at line 124 of file CigiSOFV3.h.

References CIGI_SUCCESS.

00125    {
00126       FrameCntr = FrameCntrIn;
00127       LastRcvdHostFrame = FrameCntrIn;
00128 
00129       return(CIGI_SUCCESS);
00130    }

int CigiSOFV3::SetTimeStamp ( const Cigi_uint32  TimeStamp,
bool  bndchk = true 
)

Sets the timestamp V3 value with bound checking control.

Parameters:
TimeStamp - Specifies the timestamp count in 10 microseconds increments.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 211 of file CigiSOFV3.cpp.

References CIGI_SUCCESS, CigiBaseSOF::TimeStampV2, and CigiBaseSOF::TimeStampV3.

00212 {
00213 
00214    TimeStampV3 = TimeStamp;
00215    TimeStampV2 = ((float)TimeStampV3) * 10.0f;
00216 
00217    return(CIGI_SUCCESS);
00218 
00219 }

int CigiSOFV3::SetTimeStampValid ( const bool  TimeStampValidIn,
bool  bndchk = true 
) [inline]

Sets the timestamp valid flag with bound checking control.

Parameters:
TimeStampValidIn - Specifies whether the timestamp is valid for use.
true - Timestamp is valid.
false - Timestamp is not valid.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 172 of file CigiSOFV3.h.

References CIGI_SUCCESS.

00173    {
00174       TimestampValid = TimeStampValidIn;
00175 
00176       return(CIGI_SUCCESS);
00177    }

int CigiSOFV3::Unpack ( Cigi_uint8 Buff,
bool  Swap,
void *  Spec 
) [virtual]

The virtual Unpack function for CIGI 1

Parameters:
Buff - A pointer to the current pack point.
Swap - Byte swapping required.
Spec - A pointer to special data - This is not used in this class.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Implements CigiBaseSOF.

Definition at line 158 of file CigiSOFV3.cpp.

References PackPointerUnion::b, CigiBaseSOF::BSwapEn, CigiBaseSOF::ByteSwap, PackPointerUnion::c, CIGI_SUCCESS, CigiSwap4(), CigiBaseSOF::DatabaseID, CigiBaseSOF::EarthRefModel, CigiBaseSOF::FrameCntr, CigiBaseSOF::IGMode, CigiBaseSOF::IGStatus, PackPointerUnion::l, CigiBaseSOF::LastRcvdHostFrame, PackPointerUnion::s, CigiBaseSOF::TimeStampV2, CigiBaseSOF::TimeStampV3, and CigiBaseSOF::TimestampValid.

00159 {
00160 
00161    PackPointer CDta;
00162 
00163    CDta.c = Buff;
00164 
00165    CDta.c += 3;
00166 
00167    DatabaseID = *CDta.b++;
00168    IGStatus = *CDta.c++;
00169 
00170    Cigi_uint8 HDta = *CDta.c++;
00171 
00172    IGMode = (IGModeGrp)(HDta & 0x03);
00173    EarthRefModel = (EarthRefModelGrp)((HDta >> 3) & 0x01);
00174    TimestampValid = ((HDta & 0x04) != 0);
00175 
00176    ByteSwap = *CDta.s++;
00177 
00178    BSwapEn = (ByteSwap == 0x0080);
00179 
00180    if(!BSwapEn)
00181    {
00182       FrameCntr = *CDta.l++;
00183       TimeStampV3 = *CDta.l++;
00184    }
00185    else
00186    {
00187       CigiSwap4(&FrameCntr,CDta.l++);
00188       CigiSwap4(&TimeStampV3,CDta.l++);
00189    }
00190 
00191    TimeStampV2 = ((float)TimeStampV3) * 10.0f;
00192 
00193    LastRcvdHostFrame = FrameCntr;
00194 
00195    return(CIGI_SUCCESS);
00196 
00197 }


The documentation for this class was generated from the following files:
Generated on Wed Apr 29 09:00:10 2009 for CCL by  doxygen 1.4.7