#include <CigiSensorCtrlV1.h>
Inheritance diagram for CigiSensorCtrlV1:
Public Member Functions | |
CigiSensorCtrlV1 () | |
virtual | ~CigiSensorCtrlV1 () |
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 CigiSensorCtrlV1.h.
CigiSensorCtrlV1::CigiSensorCtrlV1 | ( | ) |
General Constructor
Definition at line 85 of file CigiSensorCtrlV1.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, CIGI_SENSOR_CTRL_PACKET_ID_V1, CIGI_SENSOR_CTRL_PACKET_SIZE_V1, 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_V1; 00089 PacketSize = CIGI_SENSOR_CTRL_PACKET_SIZE_V1; 00090 Version = 1; 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 }
CigiSensorCtrlV1::~CigiSensorCtrlV1 | ( | ) | [virtual] |
float CigiSensorCtrlV1::GetGain | ( | void | ) | const [inline] |
Gets the Gain value.
Definition at line 141 of file CigiSensorCtrlV1.h.
00141 { return(Gain * 100.0f); }
Cigi_uint16 CigiSensorCtrlV1::GetViewID | ( | void | ) | const [inline] |
Gets the ViewID value.
Definition at line 124 of file CigiSensorCtrlV1.h.
00124 { return(ViewID); }
int CigiSensorCtrlV1::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 1
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 CigiSensorCtrlV1.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, CigiBaseSensorCtrl::BlackHot, PackPointerUnion::c, CIGI_SCOPY4, CIGI_SENSOR_CTRL_PACKET_SIZE_V1, 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 float tGain; 00129 00130 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00131 00132 PackPointer CDta; 00133 00134 CigiBaseSensorCtrl * Data = ( CigiBaseSensorCtrl *)Base; 00135 00136 CDta.d = DBuf; 00137 00138 *CDta.c++ = PacketID; 00139 *CDta.c++ = PacketSize; 00140 00141 tViewID = Data->ViewID; 00142 00143 if(tViewID > 31) 00144 tViewID = 31; 00145 00146 Cigi_uint8 HDta = (Cigi_uint8)tViewID << 3; 00147 00148 if(Data->SensorOn) 00149 HDta |= 0x04; 00150 00151 if(Data->Polarity == BlackHot) 00152 HDta |= 0x02; 00153 00154 if(Data->LineDropEn) 00155 HDta |= 0x01; 00156 00157 *CDta.c++ = HDta; 00158 00159 *CDta.c++ = Data->SensorID; 00160 00161 HDta = (Cigi_uint8)(Data->TrackMode << 4); 00162 00163 if(Data->AutoGainEn) 00164 HDta |= 0x08; 00165 00166 if(Data->TrackPolarity == TrackBlack) 00167 HDta |= 0x04; 00168 00169 *CDta.c++ = HDta; 00170 00171 *CDta.c++ = 0; 00172 *CDta.s++ = 0; 00173 00174 tGain = 100.0f * Data->Gain; // convert from std gain to CIGI 1 gain. 00175 CIGI_SCOPY4(CDta.f++, &tGain); 00176 CIGI_SCOPY4(CDta.f++, &Data->Level); 00177 CIGI_SCOPY4(CDta.f++, &Data->ACCoupling); 00178 CIGI_SCOPY4(CDta.f++, &Data->Noise); 00179 00180 memcpy(Buff,tBuf,CIGI_SENSOR_CTRL_PACKET_SIZE_V1); 00181 00182 return(PacketSize); 00183 00184 }
int CigiSensorCtrlV1::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 265 of file CigiSensorCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseSensorCtrl::Gain.
00266 { 00267 00268 #ifndef CIGI_NO_BND_CHK 00269 if(bndchk && ((GainIn < 0.0)||(GainIn > 100.0))) 00270 { 00271 #ifndef CIGI_NO_EXCEPT 00272 throw CigiValueOutOfRangeException("Gain",(float)GainIn,0.0,100.0); 00273 #endif 00274 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00275 } 00276 #endif 00277 00278 // convert CIGI 1 gain to standard gain 00279 Gain = GainIn / 100.0f; 00280 00281 return(CIGI_SUCCESS); 00282 00283 }
int CigiSensorCtrlV1::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 243 of file CigiSensorCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseSensorCtrl::ViewID.
00244 { 00245 00246 #ifndef CIGI_NO_BND_CHK 00247 if(bndchk && ((ViewIDIn < 0)||(ViewIDIn > 31))) 00248 { 00249 #ifndef CIGI_NO_EXCEPT 00250 throw CigiValueOutOfRangeException("ViewID",(Cigi_uint16)ViewIDIn,0,31); 00251 #endif 00252 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00253 } 00254 #endif 00255 00256 ViewID = ViewIDIn; 00257 return(CIGI_SUCCESS); 00258 00259 }
int CigiSensorCtrlV1::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 1
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 189 of file CigiSensorCtrlV1.cpp.
References CigiBaseSensorCtrl::ACCoupling, CigiBaseSensorCtrl::AutoGainEn, PackPointerUnion::c, CIGI_SCOPY4, CIGI_SENSOR_CTRL_PACKET_SIZE_V1, 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.
00190 { 00191 double DBuf[6]; 00192 float tGain; 00193 00194 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00195 00196 PackPointer CDta; 00197 00198 memcpy(tBuf,Buff,CIGI_SENSOR_CTRL_PACKET_SIZE_V1); 00199 00200 CDta.d = DBuf; 00201 00202 CDta.c += 2; // Step over packet id and size 00203 00204 Cigi_uint8 HDta = *CDta.c++; 00205 00206 ViewID = (Cigi_uint8)((HDta >> 3) & 0x1f); 00207 SensorOn = ((HDta & 0x04) != 0); 00208 Polarity = (PolarityGrp)((HDta >> 1) & 0x01); 00209 LineDropEn = ((HDta & 0x01) != 0); 00210 00211 SensorID = *CDta.c++; 00212 00213 HDta = *CDta.c++; 00214 TrackMode = (TrackModeGrp)((HDta >> 4) & 0x0f); 00215 AutoGainEn = ((HDta & 0x08) != 0); 00216 TrackPolarity = (TrackPolarityGrp)((HDta >> 2) & 0x01); 00217 00218 CDta.c += 3; 00219 00220 CIGI_SCOPY4(&tGain, CDta.f++); 00221 Gain = tGain / 100.0f; // convert from CIGI 1 gain to standard gain. 00222 00223 CIGI_SCOPY4(&Level, CDta.f++); 00224 CIGI_SCOPY4(&ACCoupling, CDta.f++); 00225 CIGI_SCOPY4(&Noise, CDta.f++); 00226 00227 ResponseType = GatePos; 00228 00229 return(PacketSize); 00230 00231 }