00001
00061 #define _EXPORT_CCL_
00062
00063 #include "CigiLosSegReqV2.h"
00064 #include "CigiSwapping.h"
00065 #include "CigiExceptions.h"
00066
00067 #include <memory.h>
00068
00069
00070 #ifdef CIGI_LITTLE_ENDIAN
00071 #define CIGI_SCOPY2 CigiSwap2
00072 #define CIGI_SCOPY4 CigiSwap4
00073 #define CIGI_SCOPY8 CigiSwap8
00074 #else
00075 #define CIGI_SCOPY2 CigiCopy2
00076 #define CIGI_SCOPY4 CigiCopy4
00077 #define CIGI_SCOPY8 CigiCopy8
00078 #endif
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 CigiLosSegReqV2::CigiLosSegReqV2()
00092 {
00093
00094 PacketID = CIGI_LOS_SEG_REQ_PACKET_ID_V2;
00095 PacketSize = CIGI_LOS_SEG_REQ_PACKET_SIZE_V2;
00096 Version = 2;
00097 MinorVersion = 0;
00098
00099 LosID = 0;
00100 ReqType = Extended;
00101 SrcCoordSys = Geodetic;
00102 DstCoordSys = Geodetic;
00103 ResponseCoordSys = Geodetic;
00104 AlphaThresh = 0;
00105 EntityID = 0;
00106 SrcXLat = 0.0;
00107 SrcYLon = 0.0;
00108 SrcZAlt = 0.0;
00109 DstXLat = 0.0;
00110 DstYLon = 0.0;
00111 DstZAlt = 0.0;
00112 Mask = 0;
00113 DestEntityIDValid = false;
00114 UpdatePeriod = 0;
00115 DestEntityID = 0;
00116 ValidV1or2 = true;
00117
00118 }
00119
00120
00121
00122
00123 CigiLosSegReqV2::~CigiLosSegReqV2()
00124 {
00125
00126 }
00127
00128
00129
00130
00131
00132
00133
00134
00135 int CigiLosSegReqV2::Pack(CigiBasePacket * Base, Cigi_uint8 * Buff, void *Spec) const
00136 {
00137 double DBuf[7];
00138
00139 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf;
00140
00141 PackPointer CDta;
00142
00143 CigiBaseLosSegReq * Data = ( CigiBaseLosSegReq *)Base;
00144
00145
00146
00147 if(!Data->ValidV1or2)
00148 return(0);
00149
00150 CDta.d = DBuf;
00151
00152 *CDta.c++ = PacketID;
00153 *CDta.c++ = PacketSize;
00154
00155 CIGI_SCOPY2(CDta.s++, &Data->LosID);
00156 *CDta.l++ = 0;
00157 CIGI_SCOPY8(CDta.d++, &Data->SrcZAlt);
00158 CIGI_SCOPY8(CDta.d++, &Data->SrcXLat);
00159 CIGI_SCOPY8(CDta.d++, &Data->SrcYLon);
00160 CIGI_SCOPY8(CDta.d++, &Data->DstZAlt);
00161 CIGI_SCOPY8(CDta.d++, &Data->DstXLat);
00162 CIGI_SCOPY8(CDta.d++, &Data->DstYLon);
00163
00164 memcpy(Buff,tBuf,CIGI_LOS_SEG_REQ_PACKET_SIZE_V2);
00165
00166 return(PacketSize);
00167
00168 }
00169
00170
00171
00172
00173 int CigiLosSegReqV2::Unpack(Cigi_uint8 * Buff, bool Swap, void *Spec)
00174 {
00175 double DBuf[7];
00176
00177 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf;
00178
00179 PackPointer CDta;
00180
00181 memcpy(tBuf,Buff,CIGI_LOS_SEG_REQ_PACKET_SIZE_V2);
00182
00183 CDta.d = DBuf;
00184
00185 CDta.c += 2;
00186
00187 CIGI_SCOPY2(&LosID, CDta.s++);
00188 CDta.c += 4;
00189 CIGI_SCOPY8(&SrcZAlt, CDta.d++);
00190 CIGI_SCOPY8(&SrcXLat, CDta.d++);
00191 CIGI_SCOPY8(&SrcYLon, CDta.d++);
00192 CIGI_SCOPY8(&DstZAlt, CDta.d++);
00193 CIGI_SCOPY8(&DstXLat, CDta.d++);
00194 CIGI_SCOPY8(&DstYLon, CDta.d++);
00195
00196
00197 DestEntityIDValid = false;
00198 UpdatePeriod = 0;
00199 DestEntityID = 0;
00200
00201 ValidV1or2 = true;
00202
00203 return(PacketSize);
00204
00205 }
00206
00207
00208
00209
00210
00211
00212
00213