00001
00053 #define _EXPORT_CCL_
00054
00055 #include "CigiHatHotReqV3_2.h"
00056 #include "CigiSwapping.h"
00057 #include "CigiExceptions.h"
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 CigiHatHotReqV3_2::CigiHatHotReqV3_2()
00069 {
00070
00071 PacketID = CIGI_HAT_HOT_REQ_PACKET_ID_V3_2;
00072 PacketSize = CIGI_HAT_HOT_REQ_PACKET_SIZE_V3_2;
00073 Version = 3;
00074 MinorVersion = 2;
00075
00076 HatHotID = 0;
00077 ReqType = HAT;
00078 SrcCoordSys = Geodetic;
00079 UpdatePeriod = 0;
00080 EntityID = 0;
00081 LatOrXoff = 0.0;
00082 LonOrYoff = 0.0;
00083 AltOrZoff = 0.0;
00084 IsValidV1or2 = true;
00085
00086 }
00087
00088
00089
00090
00091 CigiHatHotReqV3_2::~CigiHatHotReqV3_2()
00092 {
00093
00094 }
00095
00096
00097
00098
00099
00100
00101
00102
00103 int CigiHatHotReqV3_2::Pack(CigiBasePacket * Base, Cigi_uint8 * Buff, void *Spec) const
00104 {
00105 PackPointer CDta;
00106
00107 CigiBaseHatHotReq * Data = ( CigiBaseHatHotReq *)Base;
00108
00109 CDta.c = Buff;
00110
00111 *CDta.c++ = PacketID;
00112 *CDta.c++ = PacketSize;
00113
00114 *CDta.s++ = Data->HatHotID;
00115
00116 Cigi_uint8 HDta = (Cigi_uint8)(Data->ReqType & 0x03);
00117 HDta |= (Cigi_uint8)((Data->SrcCoordSys << 2) & 0x04);
00118 *CDta.c++ = HDta;
00119
00120 *CDta.c++ = Data->UpdatePeriod;
00121
00122 *CDta.s++ = Data->EntityID;
00123 *CDta.d++ = Data->LatOrXoff;
00124 *CDta.d++ = Data->LonOrYoff;
00125 *CDta.d++ = Data->AltOrZoff;
00126
00127 return(PacketSize);
00128
00129 }
00130
00131
00132
00133
00134 int CigiHatHotReqV3_2::Unpack(Cigi_uint8 * Buff, bool Swap, void *Spec)
00135 {
00136 PackPointer CDta;
00137
00138 CDta.c = Buff;
00139
00140 CDta.c += 2;
00141
00142 if(!Swap)
00143 {
00144 HatHotID = *CDta.s++;
00145
00146 Cigi_uint8 HDta = *CDta.c++;
00147 ReqType = (ReqTypeGrp)(HDta & 0x03);
00148 SrcCoordSys = (CoordSysGrp)((HDta >> 2) & 0x01);
00149
00150 UpdatePeriod = *CDta.c++;
00151
00152 EntityID = *CDta.s++;
00153 LatOrXoff = *CDta.d++;
00154 LonOrYoff = *CDta.d++;
00155 AltOrZoff = *CDta.d++;
00156 }
00157 else
00158 {
00159 CigiSwap2(&HatHotID, CDta.s++);
00160
00161 Cigi_uint8 HDta = *CDta.c++;
00162 ReqType = (ReqTypeGrp)(HDta & 0x03);
00163 SrcCoordSys = (CoordSysGrp)((HDta >> 2) & 0x01);
00164
00165 UpdatePeriod = *CDta.c++;
00166
00167 CigiSwap2(&EntityID, CDta.s++);
00168 CigiSwap8(&LatOrXoff, CDta.d++);
00169 CigiSwap8(&LonOrYoff, CDta.d++);
00170 CigiSwap8(&AltOrZoff, CDta.d++);
00171 }
00172
00173 IsValidV1or2 = (SrcCoordSys == Geodetic);
00174
00175 return(PacketSize);
00176
00177 }
00178
00179
00180
00181
00182
00183 int CigiHatHotReqV3_2::GetCnvt(CigiVersionID &CnvtVersion,
00184 CigiCnvtInfoType::Type &CnvtInfo)
00185 {
00186 CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00187
00188 switch(CnvtVersion.CigiMajorVersion)
00189 {
00190 case 1:
00191 CnvtInfo.CnvtPacketID = CIGI_HAT_REQ_PACKET_ID_V1;
00192 break;
00193 case 2:
00194 if(ReqType == CigiBaseHatHotReq::HAT)
00195 CnvtInfo.CnvtPacketID = CIGI_HAT_REQ_PACKET_ID_V2;
00196 else
00197 CnvtInfo.CnvtPacketID = CIGI_HOT_REQ_PACKET_ID_V2;
00198 break;
00199 default:
00200
00201 CnvtInfo.CnvtPacketID = CIGI_HAT_HOT_REQ_PACKET_ID_V3;
00202 break;
00203 }
00204
00205 return(CIGI_SUCCESS);
00206 }
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218 int CigiHatHotReqV3_2::SetReqType(const ReqTypeGrp ReqTypeIn, bool bndchk)
00219 {
00220
00221 #ifndef CIGI_NO_BND_CHK
00222 if(bndchk && ((ReqTypeIn < 0)||(ReqTypeIn > 2)))
00223 {
00224 #ifndef CIGI_NO_EXCEPT
00225 throw CigiValueOutOfRangeException("ReqType",(ReqTypeGrp)ReqTypeIn,0,2);
00226 #endif
00227 return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00228 }
00229 #endif
00230
00231 ReqType = ReqTypeIn;
00232 return(CIGI_SUCCESS);
00233
00234 }
00235
00236
00237
00238
00239
00240 int CigiHatHotReqV3_2::SetSrcCoordSys(const CoordSysGrp SrcCoordSysIn, bool bndchk)
00241 {
00242
00243 #ifndef CIGI_NO_BND_CHK
00244 if(bndchk && ((SrcCoordSysIn < 0)||(SrcCoordSysIn > 1)))
00245 {
00246 #ifndef CIGI_NO_EXCEPT
00247 throw CigiValueOutOfRangeException("SrcCoordSys",(CoordSysGrp)SrcCoordSysIn,0,1);
00248 #endif
00249 return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00250 }
00251 #endif
00252
00253 SrcCoordSys = SrcCoordSysIn;
00254 return(CIGI_SUCCESS);
00255
00256 }
00257
00258