CigiCelestialCtrlV3 Class Reference

#include <CigiCelestialCtrl.h>

Inheritance diagram for CigiCelestialCtrlV3:

CigiBaseEnvCtrl CigiBasePacket List of all members.

Public Member Functions

 CigiCelestialCtrlV3 ()
virtual ~CigiCelestialCtrlV3 ()
virtual int Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const
virtual int Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec)
virtual void FillHold (CigiBaseEnvCtrl *Hold) const
int SetHour (const Cigi_uint8 HourIn, bool bndchk=true)
Cigi_uint8 GetHour (void) const
int SetMinute (const Cigi_uint8 MinuteIn, bool bndchk=true)
Cigi_uint8 GetMinute (void) const
int SetMonth (const Cigi_uint8 MonthIn, bool bndchk=true)
Cigi_uint8 GetMonth (void) const
int SetDay (const Cigi_uint8 DayIn, bool bndchk=true)
Cigi_uint8 GetDay (void) const
int SetYear (const Cigi_uint16 YearIn, bool bndchk=true)
Cigi_uint16 GetYear (void) const
int SetStarInt (const float StarIntIn, bool bndchk=true)
float GetStarInt (void) const
int SetEphemerisEn (const bool EphemerisEnIn, bool bndchk=true)
bool GetEphemerisEn (void) const
int SetSunEn (const bool SunEnIn, bool bndchk=true)
bool GetSunEn (void) const
int SetMoonEn (const bool MoonEnIn, bool bndchk=true)
bool GetMoonEn (void) const
int SetStarEn (const bool StarEnIn, bool bndchk=true)
bool GetStarEn (void) const
int SetDateVld (const bool DateVldIn, bool bndchk=true)
bool GetDateVld (void) const

Detailed Description

Definition at line 61 of file CigiCelestialCtrl.h.


Constructor & Destructor Documentation

CigiCelestialCtrlV3::CigiCelestialCtrlV3 (  ) 

General Constructor

Definition at line 70 of file CigiCelestialCtrl.cpp.

References CigiBaseEnvCtrl::Aerosol, CigiBaseEnvCtrl::AirTemp, CigiBaseEnvCtrl::AtmosEn, CigiBaseEnvCtrl::BaroPress, CIGI_CELESTIAL_CTRL_PACKET_ID_V3, CIGI_CELESTIAL_CTRL_PACKET_SIZE_V3, CigiBaseEnvCtrl::DateVld, CigiBaseEnvCtrl::Day, CigiBaseEnvCtrl::EphemerisEn, CigiBaseEnvCtrl::HorizWindSp, CigiBaseEnvCtrl::Hour, CigiBaseEnvCtrl::Humidity, CigiBasePacket::MinorVersion, CigiBaseEnvCtrl::Minute, CigiBaseEnvCtrl::Month, CigiBaseEnvCtrl::MoonEn, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseEnvCtrl::StarEn, CigiBaseEnvCtrl::StarInt, CigiBaseEnvCtrl::SunEn, CigiBasePacket::Version, CigiBaseEnvCtrl::VertWindSp, CigiBaseEnvCtrl::Visibility, CigiBaseEnvCtrl::WindDir, and CigiBaseEnvCtrl::Year.

00071 {
00072 
00073    PacketID = CIGI_CELESTIAL_CTRL_PACKET_ID_V3;
00074    PacketSize = CIGI_CELESTIAL_CTRL_PACKET_SIZE_V3;
00075    Version = 3;
00076    MinorVersion = 0;
00077 
00078    Hour = 0;
00079    Minute = 0;
00080    Month = 1;
00081    Day = 1;
00082    Year = 2000;
00083    StarInt = 0.0;
00084    EphemerisEn = false;
00085    SunEn = false;
00086    MoonEn = false;
00087    StarEn = false;
00088    DateVld = false;
00089    AtmosEn = false;
00090    Aerosol = 0.0;
00091    Humidity = 30;
00092    AirTemp = 0.0;
00093    Visibility = 64373.76f;
00094    HorizWindSp = 0.0;
00095    VertWindSp = 0.0;
00096    WindDir = 0.0;
00097    BaroPress = 1013.25;
00098 
00099 
00100 }

CigiCelestialCtrlV3::~CigiCelestialCtrlV3 (  )  [virtual]

General Destructor

Definition at line 105 of file CigiCelestialCtrl.cpp.

00106 {
00107 
00108 }


Member Function Documentation

void CigiCelestialCtrlV3::FillHold ( CigiBaseEnvCtrl Hold  )  const [virtual]

The virtual FillHold function.

Parameters:
Hold - A pointer to the Hold object. (Downcast to CigiBaseEnvCtrl)

Implements CigiBaseEnvCtrl.

Definition at line 255 of file CigiCelestialCtrl.cpp.

References CigiBaseEnvCtrl::DateVld, CigiBaseEnvCtrl::Day, CigiBaseEnvCtrl::EphemerisEn, CigiBaseEnvCtrl::Hour, CigiBaseEnvCtrl::Minute, CigiBaseEnvCtrl::Month, CigiBaseEnvCtrl::MoonEn, CigiBaseEnvCtrl::StarEn, CigiBaseEnvCtrl::StarInt, CigiBaseEnvCtrl::SunEn, and CigiBaseEnvCtrl::Year.

00256 {
00257    Hold->Hour = Hour;
00258    Hold->Minute = Minute;
00259    Hold->EphemerisEn = EphemerisEn;
00260    Hold->SunEn = SunEn;
00261    Hold->MoonEn = MoonEn;
00262    Hold->StarEn = StarEn;
00263    Hold->DateVld = DateVld;
00264    Hold->Month = Month;
00265    Hold->Day = Day;
00266    Hold->Year = Year;
00267    Hold->StarInt = StarInt;
00268 }

bool CigiCelestialCtrlV3::GetDateVld ( void   )  const [inline]

Gets the DateVld value.

Returns:
the current DateVld.

Definition at line 329 of file CigiCelestialCtrl.h.

00329 { return(DateVld); }

Cigi_uint8 CigiCelestialCtrlV3::GetDay ( void   )  const [inline]

Gets the Day value.

Returns:
the current Day.

Definition at line 186 of file CigiCelestialCtrl.h.

00186 { return(Day); }

bool CigiCelestialCtrlV3::GetEphemerisEn ( void   )  const [inline]

Gets the EphemerisEn value.

Returns:
the current EphemerisEn.

Definition at line 245 of file CigiCelestialCtrl.h.

00245 { return(EphemerisEn); }

Cigi_uint8 CigiCelestialCtrlV3::GetHour ( void   )  const [inline]

Gets the Hour value.

Returns:
the current Hour.

Definition at line 135 of file CigiCelestialCtrl.h.

00135 { return(Hour); }

Cigi_uint8 CigiCelestialCtrlV3::GetMinute ( void   )  const [inline]

Gets the Minute value.

Returns:
the current Minute.

Definition at line 152 of file CigiCelestialCtrl.h.

00152 { return(Minute); }

Cigi_uint8 CigiCelestialCtrlV3::GetMonth ( void   )  const [inline]

Gets the Month value.

Returns:
the current Month.

Definition at line 169 of file CigiCelestialCtrl.h.

00169 { return(Month); }

bool CigiCelestialCtrlV3::GetMoonEn ( void   )  const [inline]

Gets the MoonEn value.

Returns:
the current MoonEn.

Definition at line 287 of file CigiCelestialCtrl.h.

00287 { return(MoonEn); }

bool CigiCelestialCtrlV3::GetStarEn ( void   )  const [inline]

Gets the StarEn value.

Returns:
the current StarEn.

Definition at line 308 of file CigiCelestialCtrl.h.

00308 { return(StarEn); }

float CigiCelestialCtrlV3::GetStarInt ( void   )  const [inline]

Gets the StarInt value.

Returns:
the current StarInt.

Definition at line 224 of file CigiCelestialCtrl.h.

00224 { return(StarInt); }

bool CigiCelestialCtrlV3::GetSunEn ( void   )  const [inline]

Gets the SunEn value.

Returns:
the current SunEn.

Definition at line 266 of file CigiCelestialCtrl.h.

00266 { return(SunEn); }

Cigi_uint16 CigiCelestialCtrlV3::GetYear ( void   )  const [inline]

Gets the Year value.

Returns:
the current Year.

Definition at line 207 of file CigiCelestialCtrl.h.

00207 { return(Year); }

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

The virtual Pack function for CIGI 3

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 the Hold object
Spec - A pointer to special data - This is used to point to the Environmental Control holding object when going between V3 and V1 or V2.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Implements CigiBaseEnvCtrl.

Definition at line 117 of file CigiCelestialCtrl.cpp.

References PackPointerUnion::c, CigiBaseEnvCtrl::DateVld, CigiBaseEnvCtrl::Day, CigiBaseEnvCtrl::EphemerisEn, PackPointerUnion::f, CigiBaseEnvCtrl::Hour, PackPointerUnion::l, CigiBaseEnvCtrl::Minute, CigiBaseEnvCtrl::Month, CigiBaseEnvCtrl::MoonEn, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseEnvCtrl::StarEn, CigiBaseEnvCtrl::StarInt, CigiBaseEnvCtrl::SunEn, and CigiBaseEnvCtrl::Year.

00118 {
00119    PackPointer CDta;
00120 
00121    CigiBaseEnvCtrl * Data;
00122    if(Spec == NULL)
00123       Data = ( CigiBaseEnvCtrl *)Base;
00124    else
00125       Data = ( CigiBaseEnvCtrl *)Spec;
00126 
00127 
00128    CDta.c = Buff;
00129 
00130    *CDta.c++ = PacketID;
00131    *CDta.c++ = PacketSize;
00132 
00133    *CDta.c++ = Data->Hour;
00134    *CDta.c++ = Data->Minute;
00135 
00136    Cigi_uint8 HDta = (Data->EphemerisEn) ? 0x01 : 0;
00137    HDta |= (Data->SunEn) ? 0x02 : 0;
00138    HDta |= (Data->MoonEn) ? 0x04 : 0;
00139    HDta |= (Data->StarEn) ? 0x08 : 0;
00140    HDta |= (Data->DateVld) ? 0x10 : 0;
00141    *CDta.c++ = HDta;
00142 
00143    *CDta.c++ = 0;
00144    *CDta.s++ = 0;
00145 
00146    // Determine date
00147    Cigi_uint32 date = ((Cigi_uint32)Data->Month * 1000000) +
00148                         ((Cigi_uint32)Data->Day   *   10000) + (Cigi_uint32)Data->Year;
00149    *CDta.l++ = date;
00150 
00151    *CDta.f++ = Data->StarInt;
00152 
00153 
00154    return(PacketSize);
00155 
00156 }

int CigiCelestialCtrlV3::SetDateVld ( const bool  DateVldIn,
bool  bndchk = true 
) [inline]

Sets the DateVld with bound checking control

Parameters:
DateVldIn - Date 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 320 of file CigiCelestialCtrl.h.

References CIGI_SUCCESS.

00321    {
00322       DateVld = DateVldIn;
00323       return(CIGI_SUCCESS);
00324    }

int CigiCelestialCtrlV3::SetDay ( const Cigi_uint8  DayIn,
bool  bndchk = true 
)

Sets the Day with bound checking control

Parameters:
DayIn - Current day of the month
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 347 of file CigiCelestialCtrl.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEnvCtrl::Day.

00348 {
00349 
00350 #ifndef CIGI_NO_BND_CHK
00351    if(bndchk && ((DayIn < 1)||(DayIn > 31)))
00352    {
00353 #ifndef CIGI_NO_EXCEPT
00354       throw CigiValueOutOfRangeException("Day",(Cigi_uint8)DayIn,1,31);
00355 #endif
00356       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00357    }
00358 #endif
00359 
00360    Day = DayIn;
00361    return(CIGI_SUCCESS);
00362 
00363 }

int CigiCelestialCtrlV3::SetEphemerisEn ( const bool  EphemerisEnIn,
bool  bndchk = true 
) [inline]

Sets the EphemerisEn with bound checking control

Parameters:
EphemerisEnIn - Ephereris model enable
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 236 of file CigiCelestialCtrl.h.

References CIGI_SUCCESS.

00237    {
00238       EphemerisEn = EphemerisEnIn;
00239       return(CIGI_SUCCESS);
00240    }

int CigiCelestialCtrlV3::SetHour ( const Cigi_uint8  HourIn,
bool  bndchk = true 
)

Sets the Hour with bound checking control

Parameters:
HourIn - Current Hour
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 281 of file CigiCelestialCtrl.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEnvCtrl::Hour.

00282 {
00283 
00284 #ifndef CIGI_NO_BND_CHK
00285    if(bndchk && ((HourIn < 0)||(HourIn > 23)))
00286    {
00287 #ifndef CIGI_NO_EXCEPT
00288       throw CigiValueOutOfRangeException("Hour",(Cigi_uint8)HourIn,0,23);
00289 #endif
00290       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00291    }
00292 #endif
00293 
00294    Hour = HourIn;
00295    return(CIGI_SUCCESS);
00296 
00297 }

int CigiCelestialCtrlV3::SetMinute ( const Cigi_uint8  MinuteIn,
bool  bndchk = true 
)

Sets the Minute with bound checking control

Parameters:
MinuteIn - Current minute
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 303 of file CigiCelestialCtrl.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEnvCtrl::Minute.

00304 {
00305 
00306 #ifndef CIGI_NO_BND_CHK
00307    if(bndchk && ((MinuteIn < 0)||(MinuteIn > 59)))
00308    {
00309 #ifndef CIGI_NO_EXCEPT
00310       throw CigiValueOutOfRangeException("Minute",(Cigi_uint8)MinuteIn,0,59);
00311 #endif
00312       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00313    }
00314 #endif
00315 
00316    Minute = MinuteIn;
00317    return(CIGI_SUCCESS);
00318 
00319 }

int CigiCelestialCtrlV3::SetMonth ( const Cigi_uint8  MonthIn,
bool  bndchk = true 
)

Sets the Month with bound checking control

Parameters:
MonthIn - Current month
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 325 of file CigiCelestialCtrl.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEnvCtrl::Month.

00326 {
00327 
00328 #ifndef CIGI_NO_BND_CHK
00329    if(bndchk && ((MonthIn < 1)||(MonthIn > 12)))
00330    {
00331 #ifndef CIGI_NO_EXCEPT
00332       throw CigiValueOutOfRangeException("Month",(Cigi_uint8)MonthIn,1,12);
00333 #endif
00334       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00335    }
00336 #endif
00337 
00338    Month = MonthIn;
00339    return(CIGI_SUCCESS);
00340 
00341 }

int CigiCelestialCtrlV3::SetMoonEn ( const bool  MoonEnIn,
bool  bndchk = true 
) [inline]

Sets the MoonEn with bound checking control

Parameters:
MoonEnIn - Moon enable
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 278 of file CigiCelestialCtrl.h.

References CIGI_SUCCESS.

00279    {
00280       MoonEn = MoonEnIn;
00281       return(CIGI_SUCCESS);
00282    }

int CigiCelestialCtrlV3::SetStarEn ( const bool  StarEnIn,
bool  bndchk = true 
) [inline]

Sets the StarEn with bound checking control

Parameters:
StarEnIn - Star field enable
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 299 of file CigiCelestialCtrl.h.

References CIGI_SUCCESS.

00300    {
00301       StarEn = StarEnIn;
00302       return(CIGI_SUCCESS);
00303    }

int CigiCelestialCtrlV3::SetStarInt ( const float  StarIntIn,
bool  bndchk = true 
)

Sets the StarInt with bound checking control

Parameters:
StarIntIn - Star field Intensity
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 370 of file CigiCelestialCtrl.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEnvCtrl::StarInt.

00371 {
00372 
00373 #ifndef CIGI_NO_BND_CHK
00374    if(bndchk && ((StarIntIn < 0.0)||(StarIntIn > 100.0)))
00375    {
00376 #ifndef CIGI_NO_EXCEPT
00377       throw CigiValueOutOfRangeException("StarInt",StarIntIn,0.0,100.0);
00378 #endif
00379       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00380    }
00381 #endif
00382 
00383    StarInt = StarIntIn;
00384    return(CIGI_SUCCESS);
00385 
00386 }

int CigiCelestialCtrlV3::SetSunEn ( const bool  SunEnIn,
bool  bndchk = true 
) [inline]

Sets the SunEn with bound checking control

Parameters:
SunEnIn - Sun enable
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 257 of file CigiCelestialCtrl.h.

References CIGI_SUCCESS.

00258    {
00259       SunEn = SunEnIn;
00260       return(CIGI_SUCCESS);
00261    }

int CigiCelestialCtrlV3::SetYear ( const Cigi_uint16  YearIn,
bool  bndchk = true 
) [inline]

Sets the Year with bound checking control

Parameters:
YearIn - Current year
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 198 of file CigiCelestialCtrl.h.

References CIGI_SUCCESS.

00199    {
00200       Year = YearIn;
00201       return(CIGI_SUCCESS);
00202    }

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

The virtual Unpack function for CIGI 3

Parameters:
Buff - A pointer to the current pack point.
Swap - N/A for V1 & V2
Spec - A pointer to special data - This is used to point to the Environmental Control holding object when going between V3 and V1 or V2.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Implements CigiBaseEnvCtrl.

Definition at line 161 of file CigiCelestialCtrl.cpp.

References PackPointerUnion::c, CigiSwap4(), CigiBaseEnvCtrl::DateVld, CigiBaseEnvCtrl::Day, CigiBaseEnvCtrl::EphemerisEn, PackPointerUnion::f, CigiBaseEnvCtrl::Hour, PackPointerUnion::l, CigiBaseEnvCtrl::Minute, CigiBaseEnvCtrl::Month, CigiBaseEnvCtrl::MoonEn, CigiBasePacket::PacketSize, CigiBaseEnvCtrl::StarEn, CigiBaseEnvCtrl::StarInt, CigiBaseEnvCtrl::SunEn, and CigiBaseEnvCtrl::Year.

00162 {
00163    PackPointer CDta;
00164 
00165    Cigi_uint32 date;
00166 
00167    CDta.c = Buff;
00168 
00169    CDta.c += 2;  // Step over packet id and size
00170 
00171    if(!Swap)
00172    {
00173       Hour = *CDta.c++;
00174       Minute = *CDta.c++;
00175 
00176       Cigi_uint8 HDta = *CDta.c++;
00177       EphemerisEn = ((HDta & 0x01) != 0);
00178       SunEn = ((HDta & 0x02) != 0);
00179       MoonEn = ((HDta & 0x04) != 0);
00180       StarEn = ((HDta & 0x08) != 0);
00181       DateVld = ((HDta & 0x10) != 0);
00182 
00183       CDta.c += 3;
00184 
00185       date = *CDta.l++;
00186 
00187       StarInt = *CDta.f++;
00188    }
00189    else
00190    {
00191       Hour = *CDta.c++;
00192       Minute = *CDta.c++;
00193 
00194       Cigi_uint8 HDta = *CDta.c++;
00195       EphemerisEn = ((HDta & 0x01) != 0);
00196       SunEn = ((HDta & 0x02) != 0);
00197       MoonEn = ((HDta & 0x04) != 0);
00198       StarEn = ((HDta & 0x08) != 0);
00199       DateVld = ((HDta & 0x10) != 0);
00200 
00201       CDta.c += 3;
00202 
00203       CigiSwap4(&date, CDta.l++);
00204       CigiSwap4(&StarInt, CDta.f++);
00205    }
00206 
00207    // Determine date
00208    Month = (Cigi_uint8)(date / 1000000);
00209    date -= ((Cigi_uint32)Month * 1000000);
00210 
00211    Day = (Cigi_uint8)(date / 10000);
00212    date -= ((Cigi_uint32)Day * 10000);
00213 
00214    Year = (Cigi_uint16)date;
00215 
00216 
00217 
00218    if(Spec != NULL)
00219    {
00220 
00221       CigiBaseEnvCtrl * Data = (CigiBaseEnvCtrl *)Spec;
00222 
00223       Data->Hour = Hour;
00224       Data->Minute = Minute;
00225 
00226       Data->EphemerisEn = EphemerisEn;
00227       Data->SunEn = SunEn;
00228       Data->MoonEn = MoonEn;
00229       Data->StarEn = StarEn;
00230       Data->DateVld = DateVld;
00231 
00232       Data->StarInt = StarInt;
00233 
00234       Data->Month = Month;
00235       Data->Day = Day;
00236       Data->Year = Year;
00237 
00238    }
00239 
00240 
00241 
00242    return(PacketSize);
00243 
00244 }


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