#include <CigiSensorCtrlV2.h>
Inheritance diagram for CigiSensorCtrlV2:
Public Member Functions | |
CigiSensorCtrlV2 () | |
virtual | ~CigiSensorCtrlV2 () |
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 | SetGain (const float GainIn, bool bndchk=true) |
float | GetGain (void) const |
Definition at line 61 of file CigiSensorCtrlV2.h.
CigiSensorCtrlV2::CigiSensorCtrlV2 | ( | ) |
General Constructor
Definition at line 85 of file CigiSensorCtrlV2.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, CIGI_SENSOR_CTRL_PACKET_ID_V2, CIGI_SENSOR_CTRL_PACKET_SIZE_V2, 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.
00086 { 00087 00088 PacketID = CIGI_SENSOR_CTRL_PACKET_ID_V2; 00089 PacketSize = CIGI_SENSOR_CTRL_PACKET_SIZE_V2; 00090 Version = 2; 00091 MinorVersion = 0; 00092 00093 ViewID = 0; 00094 SensorID = 0; 00095 SensorOn = false; 00096 Polarity = WhiteHot; 00097 LineDropEn = false; 00098 TrackMode = TrackOff; 00099 AutoGainEn = false; 00100 TrackPolarity = TrackWhite; 00101 ResponseType = GatePos; 00102 Gain = 0.0; 00103 Level = 0.0; 00104 ACCoupling = 0.0; 00105 Noise = 0.0; 00106 00107 }
CigiSensorCtrlV2::~CigiSensorCtrlV2 | ( | ) | [virtual] |
float CigiSensorCtrlV2::GetGain | ( | void | ) | const [inline] |
Gets the Gain value.
Definition at line 141 of file CigiSensorCtrlV2.h.
00141 { return(Gain); }
Cigi_uint16 CigiSensorCtrlV2::GetViewID | ( | void | ) | const [inline] |
Gets the ViewID value.
Definition at line 124 of file CigiSensorCtrlV2.h.
00124 { return(ViewID); }
int CigiSensorCtrlV2::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 CigiBaseSensorCtrl.
Definition at line 124 of file CigiSensorCtrlV2.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, CigiBaseSensorCtrl::BlackHot, PackPointerUnion::c, CIGI_SCOPY4, CIGI_SENSOR_CTRL_PACKET_SIZE_V2, PackPointerUnion::d, PackPointerUnion::f, CigiBaseSensorCtrl::Gain, CigiBaseSensorCtrl::Level, CigiBaseSensorCtrl::LineDropEn, CigiBaseSensorCtrl::Noise, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseSensorCtrl::Polarity, PackPointerUnion::s, CigiBaseSensorCtrl::SensorID, CigiBaseSensorCtrl::SensorOn, CigiBaseSensorCtrl::TrackBlack, CigiBaseSensorCtrl::TrackMode, CigiBaseSensorCtrl::TrackPolarity, and CigiBaseSensorCtrl::ViewID.
00125 { 00126 double DBuf[6]; 00127 Cigi_uint16 tViewID; 00128 00129 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00130 00131 PackPointer CDta; 00132 00133 CigiBaseSensorCtrl * Data = ( CigiBaseSensorCtrl *)Base; 00134 00135 CDta.d = DBuf; 00136 00137 *CDta.c++ = PacketID; 00138 *CDta.c++ = PacketSize; 00139 00140 tViewID = Data->ViewID; 00141 00142 if(tViewID > 31) 00143 tViewID = 31; 00144 00145 Cigi_uint8 HDta = (Cigi_uint8)tViewID << 3; 00146 00147 if(Data->SensorOn) 00148 HDta |= 0x04; 00149 00150 if(Data->Polarity == BlackHot) 00151 HDta |= 0x02; 00152 00153 if(Data->LineDropEn) 00154 HDta |= 0x01; 00155 00156 *CDta.c++ = HDta; 00157 00158 *CDta.c++ = Data->SensorID; 00159 00160 HDta = (Cigi_uint8)(Data->TrackMode << 4); 00161 00162 if(Data->AutoGainEn) 00163 HDta |= 0x08; 00164 00165 if(Data->TrackPolarity == TrackBlack) 00166 HDta |= 0x04; 00167 00168 *CDta.c++ = HDta; 00169 00170 *CDta.c++ = 0; 00171 *CDta.s++ = 0; 00172 00173 CIGI_SCOPY4(CDta.f++, &Data->Gain); 00174 CIGI_SCOPY4(CDta.f++, &Data->Level); 00175 CIGI_SCOPY4(CDta.f++, &Data->ACCoupling); 00176 CIGI_SCOPY4(CDta.f++, &Data->Noise); 00177 00178 memcpy(Buff,tBuf,CIGI_SENSOR_CTRL_PACKET_SIZE_V2); 00179 00180 return(PacketSize); 00181 00182 }
int CigiSensorCtrlV2::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 261 of file CigiSensorCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseSensorCtrl::Gain.
00262 { 00263 00264 #ifndef CIGI_NO_BND_CHK 00265 if(bndchk && ((GainIn < 0.0)||(GainIn > 1.0))) 00266 { 00267 #ifndef CIGI_NO_EXCEPT 00268 throw CigiValueOutOfRangeException("Gain",(float)GainIn,0.0,1.0); 00269 #endif 00270 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00271 } 00272 #endif 00273 00274 Gain = GainIn; 00275 return(CIGI_SUCCESS); 00276 00277 }
int CigiSensorCtrlV2::SetViewID | ( | const Cigi_uint16 | ViewIDIn, | |
bool | bndchk = true | |||
) |
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 239 of file CigiSensorCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseSensorCtrl::ViewID.
00240 { 00241 00242 #ifndef CIGI_NO_BND_CHK 00243 if(bndchk && ((ViewIDIn < 0)||(ViewIDIn > 31))) 00244 { 00245 #ifndef CIGI_NO_EXCEPT 00246 throw CigiValueOutOfRangeException("ViewID",(Cigi_uint16)ViewIDIn,0,31); 00247 #endif 00248 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00249 } 00250 #endif 00251 00252 ViewID = ViewIDIn; 00253 return(CIGI_SUCCESS); 00254 00255 }
int CigiSensorCtrlV2::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 CigiBaseSensorCtrl.
Definition at line 187 of file CigiSensorCtrlV2.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, PackPointerUnion::c, CIGI_SCOPY4, CIGI_SENSOR_CTRL_PACKET_SIZE_V2, PackPointerUnion::d, PackPointerUnion::f, CigiBaseSensorCtrl::Gain, CigiBaseSensorCtrl::GatePos, CigiBaseSensorCtrl::Level, CigiBaseSensorCtrl::LineDropEn, CigiBaseSensorCtrl::Noise, CigiBasePacket::PacketSize, CigiBaseSensorCtrl::Polarity, CigiBaseSensorCtrl::ResponseType, CigiBaseSensorCtrl::SensorID, CigiBaseSensorCtrl::SensorOn, CigiBaseSensorCtrl::TrackMode, CigiBaseSensorCtrl::TrackPolarity, and CigiBaseSensorCtrl::ViewID.
00188 { 00189 double DBuf[6]; 00190 00191 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00192 00193 PackPointer CDta; 00194 00195 memcpy(tBuf,Buff,CIGI_SENSOR_CTRL_PACKET_SIZE_V2); 00196 00197 CDta.d = DBuf; 00198 00199 CDta.c += 2; // Step over packet id and size 00200 00201 Cigi_uint8 HDta = *CDta.c++; 00202 00203 ViewID = (Cigi_uint8)((HDta >> 3) & 0x1f); 00204 SensorOn = ((HDta & 0x04) != 0); 00205 Polarity = (PolarityGrp)((HDta >> 1) & 0x01); 00206 LineDropEn = ((HDta & 0x01) != 0); 00207 00208 SensorID = *CDta.c++; 00209 00210 HDta = *CDta.c++; 00211 TrackMode = (TrackModeGrp)((HDta >> 4) & 0x0f); 00212 AutoGainEn = ((HDta & 0x08) != 0); 00213 TrackPolarity = (TrackPolarityGrp)((HDta >> 2) & 0x01); 00214 00215 CDta.c += 3; 00216 00217 CIGI_SCOPY4(&Gain, CDta.f++); 00218 00219 CIGI_SCOPY4(&Level, CDta.f++); 00220 CIGI_SCOPY4(&ACCoupling, CDta.f++); 00221 CIGI_SCOPY4(&Noise, CDta.f++); 00222 00223 ResponseType = GatePos; 00224 00225 return(PacketSize); 00226 00227 }