CigiMaritimeSurfaceRespV3.cpp

Go to the documentation of this file.
00001 
00052 #define _EXPORT_CCL_
00053 
00054 #include "CigiMaritimeSurfaceRespV3.h"
00055 #include "CigiSwapping.h"
00056 #include "CigiExceptions.h"
00057 
00058 
00059 // ====================================================================
00060 // Construction/Destruction
00061 // ====================================================================
00062 
00063 
00064 // ================================================
00065 // CigiMaritimeSurfaceRespV3
00066 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00067 CigiMaritimeSurfaceRespV3::CigiMaritimeSurfaceRespV3()
00068 {
00069 
00070    PacketID = CIGI_MARITIME_SURFACE_RESP_PACKET_ID_V3;
00071    PacketSize = CIGI_MARITIME_SURFACE_RESP_PACKET_SIZE_V3;
00072    Version = 3;
00073    MinorVersion = 0;
00074 
00075    RequestID = 0;
00076    SurfaceHeight = 0.0;
00077    WaterTemp = 0.0;
00078    Clarity = 0.0;
00079 
00080 }
00081 
00082 // ================================================
00083 // ~CigiMaritimeSurfaceRespV3
00084 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00085 CigiMaritimeSurfaceRespV3::~CigiMaritimeSurfaceRespV3()
00086 {
00087 
00088 }
00089 
00090 // ====================================================================
00091 // Pack and Unpack
00092 // ====================================================================
00093 
00094 // ================================================
00095 // Pack
00096 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00097 int CigiMaritimeSurfaceRespV3::Pack(CigiBasePacket * Base, Cigi_uint8 * Buff, void *Spec) const
00098 {
00099    PackPointer CDta;
00100 
00101    CigiBaseMaritimeSurfaceResp * Data = ( CigiBaseMaritimeSurfaceResp *)Base;
00102 
00103    CDta.c = Buff;
00104 
00105    *CDta.c++ = PacketID;
00106    *CDta.c++ = PacketSize;
00107 
00108    *CDta.c++ = Data->RequestID;
00109 
00110    *CDta.c++ = 0;
00111 
00112    *CDta.f++ = Data->SurfaceHeight;
00113    *CDta.f++ = Data->WaterTemp;
00114    *CDta.f++ = Data->Clarity;
00115 
00116    return(PacketSize);
00117 
00118 }
00119 
00120 // ================================================
00121 // Unpack
00122 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00123 int CigiMaritimeSurfaceRespV3::Unpack(Cigi_uint8 * Buff, bool Swap, void *Spec)
00124 {
00125    PackPointer CDta;
00126 
00127    CDta.c = Buff;
00128 
00129    CDta.c += 2;  // Step over packet id and size
00130 
00131    RequestID = *CDta.c++;
00132 
00133    CDta.c++;
00134 
00135    if(!Swap)
00136    {
00137       SurfaceHeight = *CDta.f++;
00138       WaterTemp = *CDta.f++;
00139       Clarity = *CDta.f++;
00140    }
00141    else
00142    {
00143       CigiSwap4(&SurfaceHeight, CDta.f++);
00144       CigiSwap4(&WaterTemp, CDta.f++);
00145       CigiSwap4(&Clarity, CDta.f++);
00146    }
00147 
00148    return(PacketSize);
00149 
00150 }
00151 
00152 
00153 
00154 // ====================================================================
00155 // Accessors
00156 // ====================================================================
00157 
00158 

Generated on Wed Apr 29 08:59:59 2009 for CCL by  doxygen 1.4.7