#include <CigiSensorCtrlV3.h>
Inheritance diagram for CigiSensorCtrlV3:
Public Member Functions | |
CigiSensorCtrlV3 () | |
virtual | ~CigiSensorCtrlV3 () |
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_uint16 ViewIDIn, bool bndchk=true) |
Cigi_uint16 | GetViewID (void) const |
int | SetResponseType (const ResponseTypeGrp ResponseTypeIn, bool bndchk=true) |
ResponseTypeGrp | GetResponseType (void) const |
int | SetGain (const float GainIn, bool bndchk=true) |
float | GetGain (void) const |
Definition at line 61 of file CigiSensorCtrlV3.h.
CigiSensorCtrlV3::CigiSensorCtrlV3 | ( | ) |
General Constructor
Definition at line 70 of file CigiSensorCtrlV3.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, CIGI_SENSOR_CTRL_PACKET_ID_V3, CIGI_SENSOR_CTRL_PACKET_SIZE_V3, CigiBaseSensorCtrl::Gain, CigiBaseSensorCtrl::GatePos, CigiBaseSensorCtrl::Level, CigiBaseSensorCtrl::LineDropEn, CigiBasePacket::MinorVersion, CigiBaseSensorCtrl::Noise, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseSensorCtrl::Polarity, CigiBaseSensorCtrl::ResponseType, CigiBaseSensorCtrl::SensorID, CigiBaseSensorCtrl::SensorOn, CigiBaseSensorCtrl::TrackMode, CigiBaseSensorCtrl::TrackOff, CigiBaseSensorCtrl::TrackPolarity, CigiBaseSensorCtrl::TrackWhite, CigiBasePacket::Version, CigiBaseSensorCtrl::ViewID, and CigiBaseSensorCtrl::WhiteHot.
00071 { 00072 00073 PacketID = CIGI_SENSOR_CTRL_PACKET_ID_V3; 00074 PacketSize = CIGI_SENSOR_CTRL_PACKET_SIZE_V3; 00075 Version = 3; 00076 MinorVersion = 0; 00077 00078 ViewID = 0; 00079 SensorID = 0; 00080 SensorOn = false; 00081 Polarity = WhiteHot; 00082 LineDropEn = false; 00083 TrackMode = TrackOff; 00084 AutoGainEn = false; 00085 TrackPolarity = TrackWhite; 00086 ResponseType = GatePos; 00087 Gain = 0.0; 00088 Level = 0.0; 00089 ACCoupling = 0.0; 00090 Noise = 0.0; 00091 00092 }
CigiSensorCtrlV3::~CigiSensorCtrlV3 | ( | ) | [virtual] |
float CigiSensorCtrlV3::GetGain | ( | void | ) | const [inline] |
Gets the Gain value.
Definition at line 164 of file CigiSensorCtrlV3.h.
00164 { return(Gain); }
ResponseTypeGrp CigiSensorCtrlV3::GetResponseType | ( | void | ) | const [inline] |
Gets the ResponseType value.
Definition at line 147 of file CigiSensorCtrlV3.h.
00147 { return(ResponseType); }
Cigi_uint16 CigiSensorCtrlV3::GetViewID | ( | void | ) | const [inline] |
Gets the ViewID value.
Definition at line 128 of file CigiSensorCtrlV3.h.
00128 { return(ViewID); }
int CigiSensorCtrlV3::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 3
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 CigiBaseSensorCtrl.
Definition at line 109 of file CigiSensorCtrlV3.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, CigiBaseSensorCtrl::BlackHot, PackPointerUnion::c, PackPointerUnion::f, CigiBaseSensorCtrl::Gain, CigiBaseSensorCtrl::Level, CigiBaseSensorCtrl::LineDropEn, CigiBaseSensorCtrl::Noise, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseSensorCtrl::Polarity, CigiBaseSensorCtrl::ResponseType, PackPointerUnion::s, CigiBaseSensorCtrl::SensorID, CigiBaseSensorCtrl::SensorOn, CigiBaseSensorCtrl::TrackBlack, CigiBaseSensorCtrl::TrackMode, CigiBaseSensorCtrl::TrackPolarity, and CigiBaseSensorCtrl::ViewID.
00110 { 00111 PackPointer CDta; 00112 00113 CigiBaseSensorCtrl * Data = ( CigiBaseSensorCtrl *)Base; 00114 00115 CDta.c = Buff; 00116 00117 *CDta.c++ = PacketID; 00118 *CDta.c++ = PacketSize; 00119 00120 *CDta.s++ = Data->ViewID; 00121 *CDta.c++ = Data->SensorID; 00122 00123 Cigi_uint8 HDta = (Cigi_uint8)(Data->TrackMode << 5); 00124 00125 if(Data->TrackPolarity == TrackBlack) 00126 HDta |= 0x10; 00127 00128 if(Data->AutoGainEn) 00129 HDta |= 0x08; 00130 00131 if(Data->LineDropEn) 00132 HDta |= 0x04; 00133 00134 if(Data->Polarity == BlackHot) 00135 HDta |= 0x02; 00136 00137 if(Data->SensorOn) 00138 HDta |= 0x01; 00139 00140 *CDta.c++ = HDta; 00141 00142 *CDta.c++ = (Cigi_uint8)(Data->ResponseType & 0x01); 00143 00144 *CDta.c++ = 0; 00145 00146 *CDta.f++ = Data->Gain; 00147 *CDta.f++ = Data->Level; 00148 *CDta.f++ = Data->ACCoupling; 00149 *CDta.f++ = Data->Noise; 00150 00151 return(PacketSize); 00152 00153 }
int CigiSensorCtrlV3::SetGain | ( | const float | GainIn, | |
bool | bndchk = true | |||
) |
Sets the Gain with bound checking control
GainIn | - Specifies the gain control value to be applied. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 253 of file CigiSensorCtrlV3.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseSensorCtrl::Gain.
00254 { 00255 00256 #ifndef CIGI_NO_BND_CHK 00257 if(bndchk && ((GainIn < 0.0)||(GainIn > 1.0))) 00258 { 00259 #ifndef CIGI_NO_EXCEPT 00260 throw CigiValueOutOfRangeException("Gain",(float)GainIn,0.0,1.0); 00261 #endif 00262 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00263 } 00264 #endif 00265 00266 Gain = GainIn; 00267 return(CIGI_SUCCESS); 00268 00269 }
int CigiSensorCtrlV3::SetResponseType | ( | const ResponseTypeGrp | ResponseTypeIn, | |
bool | bndchk = true | |||
) |
Sets the ResponseType with bound checking control
ResponseTypeIn | - Specifies the response wanted. GatePos=0 GateAndTargetPos=1 | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 231 of file CigiSensorCtrlV3.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseSensorCtrl::ResponseType.
00232 { 00233 00234 #ifndef CIGI_NO_BND_CHK 00235 if(bndchk && ((ResponseTypeIn < 0)||(ResponseTypeIn > 1))) 00236 { 00237 #ifndef CIGI_NO_EXCEPT 00238 throw CigiValueOutOfRangeException("ResponseType",(ResponseTypeGrp)ResponseTypeIn,0,1); 00239 #endif 00240 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00241 } 00242 #endif 00243 00244 ResponseType = ResponseTypeIn; 00245 return(CIGI_SUCCESS); 00246 00247 }
int CigiSensorCtrlV3::SetViewID | ( | const Cigi_uint16 | ViewIDIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the ViewID with bound checking control
ViewIDIn | - Specifies the view that this packet is to be applied. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 119 of file CigiSensorCtrlV3.h.
References CIGI_SUCCESS.
00120 { 00121 ViewID = ViewIDIn; 00122 return(CIGI_SUCCESS); 00123 }
int CigiSensorCtrlV3::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 3
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 CigiBaseSensorCtrl.
Definition at line 158 of file CigiSensorCtrlV3.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, PackPointerUnion::c, CigiSwap2(), CigiSwap4(), PackPointerUnion::f, CigiBaseSensorCtrl::Gain, CigiBaseSensorCtrl::Level, CigiBaseSensorCtrl::LineDropEn, CigiBaseSensorCtrl::Noise, CigiBasePacket::PacketSize, CigiBaseSensorCtrl::Polarity, CigiBaseSensorCtrl::ResponseType, PackPointerUnion::s, CigiBaseSensorCtrl::SensorID, CigiBaseSensorCtrl::SensorOn, CigiBaseSensorCtrl::TrackMode, CigiBaseSensorCtrl::TrackPolarity, and CigiBaseSensorCtrl::ViewID.
00159 { 00160 PackPointer CDta; 00161 00162 CDta.c = Buff; 00163 00164 CDta.c += 2; // Step over packet id and size 00165 00166 if(!Swap) 00167 { 00168 ViewID = *CDta.s++; 00169 SensorID = *CDta.c++; 00170 00171 Cigi_uint8 HDta = *CDta.c++; 00172 00173 SensorOn = ((HDta & 0x01) != 0); 00174 Polarity = (PolarityGrp)((HDta >> 1) & 0x01); 00175 LineDropEn = ((HDta & 0x04) != 0); 00176 AutoGainEn = ((HDta & 0x08) != 0); 00177 TrackPolarity = (TrackPolarityGrp)((HDta >> 4) & 0x01); 00178 TrackMode = (TrackModeGrp)((HDta >> 5) & 0x07); 00179 00180 HDta = *CDta.c++; 00181 00182 ResponseType = (ResponseTypeGrp)(HDta & 0x01); 00183 00184 CDta.c++; 00185 00186 Gain = *CDta.f++; 00187 Level = *CDta.f++; 00188 ACCoupling = *CDta.f++; 00189 Noise = *CDta.f++; 00190 } 00191 else 00192 { 00193 CigiSwap2(&ViewID, CDta.s++); 00194 SensorID = *CDta.c++; 00195 00196 Cigi_uint8 HDta = *CDta.c++; 00197 00198 SensorOn = ((HDta & 0x01) != 0); 00199 Polarity = (PolarityGrp)((HDta >> 1) & 0x01); 00200 LineDropEn = ((HDta & 0x04) != 0); 00201 AutoGainEn = ((HDta & 0x08) != 0); 00202 TrackPolarity = (TrackPolarityGrp)((HDta >> 4) & 0x01); 00203 TrackMode = (TrackModeGrp)((HDta >> 5) & 0x07); 00204 00205 HDta = *CDta.c++; 00206 00207 ResponseType = (ResponseTypeGrp)(HDta & 0x01); 00208 00209 CDta.c++; 00210 00211 CigiSwap4(&Gain, CDta.f++); 00212 CigiSwap4(&Level, CDta.f++); 00213 CigiSwap4(&ACCoupling, CDta.f++); 00214 CigiSwap4(&Noise, CDta.f++); 00215 } 00216 00217 return(PacketSize); 00218 00219 }