#include <CigiViewCtrlV2.h>
Inheritance diagram for CigiViewCtrlV2:
Public Member Functions | |
CigiViewCtrlV2 () | |
virtual | ~CigiViewCtrlV2 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
int | SetViewID (const Cigi_uint8 ViewIDIn, bool bndchk=true) |
Cigi_uint8 | GetViewID (void) const |
int | SetGroupID (const Cigi_uint8 GroupIDIn, bool bndchk=true) |
Cigi_uint8 | GetGroupID (void) const |
int | SetXOffEn (const bool XOffEnIn, bool bndchk=true) |
bool | GetXOffEn (void) const |
int | SetYOffEn (const bool YOffEnIn, bool bndchk=true) |
bool | GetYOffEn (void) const |
int | SetZOffEn (const bool ZOffEnIn, bool bndchk=true) |
bool | GetZOffEn (void) const |
int | SetRollEn (const bool RollEnIn, bool bndchk=true) |
bool | GetRollEn (void) const |
int | SetPitchEn (const bool PitchEnIn, bool bndchk=true) |
bool | GetPitchEn (void) const |
int | SetYawEn (const bool YawEnIn, bool bndchk=true) |
bool | GetYawEn (void) const |
Definition at line 62 of file CigiViewCtrlV2.h.
CigiViewCtrlV2::CigiViewCtrlV2 | ( | ) |
General Constructor
Definition at line 85 of file CigiViewCtrlV2.cpp.
References CIGI_VIEW_CTRL_PACKET_ID_V2, CIGI_VIEW_CTRL_PACKET_SIZE_V2, CigiBaseViewCtrl::EntityID, CigiBaseViewCtrl::GroupID, CigiBasePacket::MinorVersion, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseViewCtrl::Pitch, CigiBaseViewCtrl::PitchEn, CigiBaseViewCtrl::Roll, CigiBaseViewCtrl::RollEn, CigiBasePacket::Version, CigiBaseViewCtrl::ViewID, CigiBaseViewCtrl::XOff, CigiBaseViewCtrl::XOffEn, CigiBaseViewCtrl::Yaw, CigiBaseViewCtrl::YawEn, CigiBaseViewCtrl::YOff, CigiBaseViewCtrl::YOffEn, CigiBaseViewCtrl::ZOff, and CigiBaseViewCtrl::ZOffEn.
00086 { 00087 00088 PacketID = CIGI_VIEW_CTRL_PACKET_ID_V2; 00089 PacketSize = CIGI_VIEW_CTRL_PACKET_SIZE_V2; 00090 Version = 2; 00091 MinorVersion = 0; 00092 00093 EntityID = 0; 00094 ViewID = 0; 00095 GroupID = 0; 00096 XOffEn = false; 00097 YOffEn = false; 00098 ZOffEn = false; 00099 RollEn = false; 00100 PitchEn = false; 00101 YawEn = false; 00102 XOff = 0.0; 00103 YOff = 0.0; 00104 ZOff = 0.0; 00105 Roll = 0.0; 00106 Pitch = 0.0; 00107 Yaw = 0.0; 00108 00109 }
CigiViewCtrlV2::~CigiViewCtrlV2 | ( | ) | [virtual] |
Cigi_uint8 CigiViewCtrlV2::GetGroupID | ( | void | ) | const [inline] |
Gets the GroupID value.
Definition at line 149 of file CigiViewCtrlV2.h.
00150 { 00151 if(GroupID < 8) 00152 return(GroupID); 00153 else 00154 return((Cigi_uint8)0x07); 00155 }
bool CigiViewCtrlV2::GetPitchEn | ( | void | ) | const [inline] |
Gets the PitchEn value.
Definition at line 265 of file CigiViewCtrlV2.h.
00265 { return(PitchEn); }
bool CigiViewCtrlV2::GetRollEn | ( | void | ) | const [inline] |
Gets the RollEn value.
Definition at line 243 of file CigiViewCtrlV2.h.
00243 { return(RollEn); }
Cigi_uint8 CigiViewCtrlV2::GetViewID | ( | void | ) | const [inline] |
Gets the ViewID value.
Definition at line 126 of file CigiViewCtrlV2.h.
00127 { 00128 if(ViewID < 31) 00129 return((Cigi_uint8)ViewID); 00130 else 00131 return((Cigi_uint8)0x1f); 00132 }
bool CigiViewCtrlV2::GetXOffEn | ( | void | ) | const [inline] |
Gets the XOffEn value.
Definition at line 177 of file CigiViewCtrlV2.h.
00177 { return(XOffEn); }
bool CigiViewCtrlV2::GetYawEn | ( | void | ) | const [inline] |
Gets the YawEn value.
Definition at line 287 of file CigiViewCtrlV2.h.
00287 { return(YawEn); }
bool CigiViewCtrlV2::GetYOffEn | ( | void | ) | const [inline] |
Gets the YOffEn value.
Definition at line 199 of file CigiViewCtrlV2.h.
00199 { return(YOffEn); }
bool CigiViewCtrlV2::GetZOffEn | ( | void | ) | const [inline] |
Gets the ZOffEn value.
Definition at line 221 of file CigiViewCtrlV2.h.
00221 { return(ZOffEn); }
int CigiViewCtrlV2::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 2
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. |
Implements CigiBaseViewCtrl.
Definition at line 126 of file CigiViewCtrlV2.cpp.
References PackPointerUnion::c, CIGI_SCOPY2, CIGI_SCOPY4, CIGI_VIEW_CTRL_PACKET_SIZE_V2, PackPointerUnion::d, CigiBaseViewCtrl::EntityID, PackPointerUnion::f, CigiBaseViewCtrl::GroupID, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseViewCtrl::Pitch, CigiBaseViewCtrl::PitchEn, CigiBaseViewCtrl::Roll, CigiBaseViewCtrl::RollEn, PackPointerUnion::s, CigiBaseViewCtrl::ViewID, CigiBaseViewCtrl::XOff, CigiBaseViewCtrl::XOffEn, CigiBaseViewCtrl::Yaw, CigiBaseViewCtrl::YawEn, CigiBaseViewCtrl::YOff, CigiBaseViewCtrl::YOffEn, CigiBaseViewCtrl::ZOff, and CigiBaseViewCtrl::ZOffEn.
00127 { 00128 double DBuf[6]; 00129 00130 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00131 00132 PackPointer CDta; 00133 00134 CigiBaseViewCtrl * Data = ( CigiBaseViewCtrl *)Base; 00135 00136 CDta.d = DBuf; 00137 00138 *CDta.c++ = PacketID; 00139 *CDta.c++ = PacketSize; 00140 00141 CIGI_SCOPY2(CDta.s++, &Data->EntityID); 00142 00143 Cigi_uint8 HDta = 0; 00144 00145 if(Data->ViewID < 32) 00146 HDta = (Cigi_uint8)((Data->ViewID << 3) & 0xf8); 00147 else 00148 HDta = (Cigi_uint8)0xf8; 00149 00150 if(Data->GroupID < 8) 00151 HDta |= (Cigi_uint8)(Data->GroupID & 0x07); 00152 else 00153 HDta |= (Cigi_uint8)0x07; 00154 00155 *CDta.c++ = HDta; 00156 00157 HDta = 0; 00158 00159 if(Data->XOffEn) 00160 HDta |= 0x80; 00161 00162 if(Data->YOffEn) 00163 HDta |= 0x40; 00164 00165 if(Data->ZOffEn) 00166 HDta |= 0x20; 00167 00168 if(Data->RollEn) 00169 HDta |= 0x10; 00170 00171 if(Data->PitchEn) 00172 HDta |= 0x08; 00173 00174 if(Data->YawEn) 00175 HDta |= 0x04; 00176 00177 *CDta.c++ = HDta; 00178 00179 *CDta.c++ = 0; 00180 *CDta.c++ = 0; 00181 00182 CIGI_SCOPY4(CDta.f++, &Data->XOff); 00183 CIGI_SCOPY4(CDta.f++, &Data->YOff); 00184 CIGI_SCOPY4(CDta.f++, &Data->ZOff); 00185 CIGI_SCOPY4(CDta.f++, &Data->Roll); 00186 CIGI_SCOPY4(CDta.f++, &Data->Pitch); 00187 CIGI_SCOPY4(CDta.f++, &Data->Yaw); 00188 00189 memcpy(Buff,tBuf,CIGI_VIEW_CTRL_PACKET_SIZE_V2); 00190 00191 return(PacketSize); 00192 00193 }
int CigiViewCtrlV2::SetGroupID | ( | const Cigi_uint8 | GroupIDIn, | |
bool | bndchk = true | |||
) |
Sets the GroupID with bound checking control
GroupIDIn | - Specifies the view group that this packet controls. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 273 of file CigiViewCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseViewCtrl::GroupID.
00274 { 00275 00276 #ifndef CIGI_NO_BND_CHK 00277 if(bndchk && ((GroupIDIn < 0)||(GroupIDIn > 7))) 00278 { 00279 #ifndef CIGI_NO_EXCEPT 00280 throw CigiValueOutOfRangeException("GroupID",(Cigi_uint8)GroupIDIn,0,7); 00281 #endif 00282 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00283 } 00284 #endif 00285 00286 GroupID = GroupIDIn; 00287 return(CIGI_SUCCESS); 00288 00289 }
int CigiViewCtrlV2::SetPitchEn | ( | const bool | PitchEnIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the PitchEn with bound checking control
PitchEnIn | - Specifies if the pitch data is valid and to be used. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 256 of file CigiViewCtrlV2.h.
References CIGI_SUCCESS.
00257 { 00258 PitchEn = PitchEnIn; 00259 return(CIGI_SUCCESS); 00260 }
int CigiViewCtrlV2::SetRollEn | ( | const bool | RollEnIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the RollEn with bound checking control
RollEnIn | - Specifies if the roll data is valid and to be used. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 234 of file CigiViewCtrlV2.h.
References CIGI_SUCCESS.
00235 { 00236 RollEn = RollEnIn; 00237 return(CIGI_SUCCESS); 00238 }
int CigiViewCtrlV2::SetViewID | ( | const Cigi_uint8 | ViewIDIn, | |
bool | bndchk = true | |||
) |
Sets the ViewID with bound checking control
ViewIDIn | - Specifies the view that this packet controls. If The Group ID is not 0, ViewID is ignored. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 251 of file CigiViewCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseViewCtrl::ViewID.
00252 { 00253 00254 #ifndef CIGI_NO_BND_CHK 00255 if(bndchk && ((ViewIDIn < 0)||(ViewIDIn > 31))) 00256 { 00257 #ifndef CIGI_NO_EXCEPT 00258 throw CigiValueOutOfRangeException("ViewID",(Cigi_uint16)ViewIDIn,0,31); 00259 #endif 00260 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00261 } 00262 #endif 00263 00264 ViewID = (Cigi_uint16)ViewIDIn; 00265 return(CIGI_SUCCESS); 00266 00267 }
int CigiViewCtrlV2::SetXOffEn | ( | const bool | XOffEnIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the XOffEn with bound checking control
XOffEnIn | - Specifies if the X Offset data is valid and to be used. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 168 of file CigiViewCtrlV2.h.
References CIGI_SUCCESS.
00169 { 00170 XOffEn = XOffEnIn; 00171 return(CIGI_SUCCESS); 00172 }
int CigiViewCtrlV2::SetYawEn | ( | const bool | YawEnIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the YawEn with bound checking control
YawEnIn | - Specifies if the yaw data is valid and to be used. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 278 of file CigiViewCtrlV2.h.
References CIGI_SUCCESS.
00279 { 00280 YawEn = YawEnIn; 00281 return(CIGI_SUCCESS); 00282 }
int CigiViewCtrlV2::SetYOffEn | ( | const bool | YOffEnIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the YOffEn with bound checking control
YOffEnIn | - Specifies if the Y Offset data is valid and to be used. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 190 of file CigiViewCtrlV2.h.
References CIGI_SUCCESS.
00191 { 00192 YOffEn = YOffEnIn; 00193 return(CIGI_SUCCESS); 00194 }
int CigiViewCtrlV2::SetZOffEn | ( | const bool | ZOffEnIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the ZOffEn with bound checking control
ZOffEnIn | - Specifies if the Z Offset data is valid and to be used. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 212 of file CigiViewCtrlV2.h.
References CIGI_SUCCESS.
00213 { 00214 ZOffEn = ZOffEnIn; 00215 return(CIGI_SUCCESS); 00216 }
int CigiViewCtrlV2::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 2
Buff | - A pointer to the current pack point. | |
Swap | - N/A for V1 & V2 | |
Spec | - A pointer to special data - This is not used in this class. |
Implements CigiBaseViewCtrl.
Definition at line 198 of file CigiViewCtrlV2.cpp.
References PackPointerUnion::c, CIGI_SCOPY2, CIGI_SCOPY4, CIGI_VIEW_CTRL_PACKET_SIZE_V2, PackPointerUnion::d, CigiBaseViewCtrl::EntityID, PackPointerUnion::f, CigiBaseViewCtrl::GroupID, CigiBasePacket::PacketSize, CigiBaseViewCtrl::Pitch, CigiBaseViewCtrl::PitchEn, CigiBaseViewCtrl::Roll, CigiBaseViewCtrl::RollEn, PackPointerUnion::s, CigiBaseViewCtrl::ViewID, CigiBaseViewCtrl::XOff, CigiBaseViewCtrl::XOffEn, CigiBaseViewCtrl::Yaw, CigiBaseViewCtrl::YawEn, CigiBaseViewCtrl::YOff, CigiBaseViewCtrl::YOffEn, CigiBaseViewCtrl::ZOff, and CigiBaseViewCtrl::ZOffEn.
00199 { 00200 double DBuf[6]; 00201 00202 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00203 00204 PackPointer CDta; 00205 00206 memcpy(tBuf,Buff,CIGI_VIEW_CTRL_PACKET_SIZE_V2); 00207 00208 CDta.d = DBuf; 00209 00210 CDta.c += 2; // Step over packet id and size 00211 00212 CIGI_SCOPY2(&EntityID, CDta.s++); 00213 00214 Cigi_uint8 HDta = *CDta.c++; 00215 00216 ViewID = (Cigi_uint16)((HDta >> 3) & 0x1f); 00217 GroupID = (Cigi_uint8)(HDta & 0x07); 00218 00219 HDta = *CDta.c++; 00220 00221 XOffEn = ((HDta & 0x80) != 0); 00222 YOffEn = ((HDta & 0x40) != 0); 00223 ZOffEn = ((HDta & 0x20) != 0); 00224 RollEn = ((HDta & 0x10) != 0); 00225 PitchEn = ((HDta & 0x08) != 0); 00226 YawEn = ((HDta & 0x04) != 0); 00227 00228 CDta.c += 2; 00229 00230 CIGI_SCOPY4(&XOff, CDta.f++); 00231 CIGI_SCOPY4(&YOff, CDta.f++); 00232 CIGI_SCOPY4(&ZOff, CDta.f++); 00233 CIGI_SCOPY4(&Roll, CDta.f++); 00234 CIGI_SCOPY4(&Pitch, CDta.f++); 00235 CIGI_SCOPY4(&Yaw, CDta.f++); 00236 00237 return(PacketSize); 00238 00239 }