本文整理汇总了C++中Sensor类的典型用法代码示例。如果您正苦于以下问题:C++ Sensor类的具体用法?C++ Sensor怎么用?C++ Sensor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sensor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QLabel
QWidget* GUI::setupSensors() {
QWidget* sensorList = new QWidget;
QVBoxLayout* sensorListLayout = new QVBoxLayout;
sensorList->setLayout(sensorListLayout);
sensorListLayout->addWidget(new QLabel("Sensors"));
std::map<std::string, Sensor*> sensors = this->entityHandler->sensors;
for(auto o : sensors) {
Sensor* s = o.second;
QWidget* sensorRow = new QWidget;
QHBoxLayout* sensorRowLayout = new QHBoxLayout;
sensorRow->setLayout(sensorRowLayout);
/*
std::ostringstream buff;
buff << s->getValue();
QLabel* sensorValueLabel = new QLabel(buff.str().c_str());
sensorRowLayout->addWidget(sensorValueLabel);
*/
sensorRowLayout->addWidget(new QLabel(s->getName().c_str()));
sensorListLayout->addWidget(sensorRow);
}
return sensorList;
}
开发者ID:daemacles,项目名称:ess,代码行数:30,代码来源:gui.cpp
示例2: _inv
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
InventoryTask::InventoryTask(Seiscomp::DataModel::Inventory *inv) : _inv(inv) {
_logHandler = NULL;
if ( _inv == NULL ) return;
for ( size_t i = 0; i < _inv->dataloggerCount(); ++i ) {
Datalogger *d = _inv->datalogger(i);
_dataloggerNames[d->name()] = d;
}
for ( size_t i = 0; i < _inv->sensorCount(); ++i ) {
Sensor *s = _inv->sensor(i);
_sensorNames[s->name()] = s;
}
for ( size_t i = 0; i < _inv->auxDeviceCount(); ++i ) {
AuxDevice *d = _inv->auxDevice(i);
_auxDeviceNames[d->name()] = d;
}
for ( size_t i = 0; i < _inv->responseFIRCount(); ++i ) {
ResponseFIR *r = _inv->responseFIR(i);
_FIRNames[r->name()] = r;
}
for ( size_t i = 0; i < _inv->responsePAZCount(); ++i ) {
ResponsePAZ *r = _inv->responsePAZ(i);
_PAZNames[r->name()] = r;
}
for ( size_t i = 0; i < _inv->responsePolynomialCount(); ++i ) {
ResponsePolynomial *r = _inv->responsePolynomial(i);
_PolyNames[r->name()] = r;
}
}
开发者ID:koukou73gr,项目名称:seiscomp3,代码行数:36,代码来源:inv.cpp
示例3: main
int main(int argc, char *argv[])
{
int RXPIN = 1;
int TXPIN = 0;
if(wiringPiSetup() == -1)
return 0;
RCSwitch *rc = new RCSwitch(RXPIN,TXPIN);
while (1)
{
if (rc->OokAvailable())
{
char message[100];
rc->getOokCode(message);
printf("%s\n",message);
Sensor *s = Sensor::getRightSensor(message);
if (s!= NULL)
{
printf("Temp : %f\n",s->getTemperature());
printf("Humidity : %f\n",s->getHumidity());
printf("Channel : %d\n",s->getChannel());
}
delete s;
}
delay(1000);
}
}
开发者ID:pokito31,项目名称:OregonPi,代码行数:31,代码来源:test.cpp
示例4: main
int main()
{
string doorCond = "";
int data[] = {100, 101, 105, 110, 210, 100, 102, 110, 150, 100};
Sensor sensor;
Motor motor;
Door_latch door_latch;
printf("Please indicate whether the door is closed or open\nby typing 'closed' or 'open' below:\n");
cin >> doorCond;
printf("\n");
if(door_latch.DoorClosed(doorCond)){ //if door is closed
sensor.ReadData(data); //reads the data
if(sensor.Calibrate()){ //once the calibration is successful, operate the motor
printf("calibration successful!\n");
motor.MoveMotor(sensor.motor_position());
}else
printf("calibration unsuccessful, please provide another set of data\n");
}else //if the door is open, reset the motor
{
motor.ResetMotor();
printf("Door is open\n");
}
system("PAUSE");
}
开发者ID:marceloyuan,项目名称:ConsoleApplication1,代码行数:27,代码来源:Main.cpp
示例5: main
int main (int argc, const char * argv[])
{
Sensor capture;
capture.init("/Users/Gaston/dev/RDC/resources/media.mov");
// number of corners on the chessboard
Size boardSize(5,4);
//init the system
Mat image;
while(1)
{
//Resize the images to a more reasonable size before treatment
//resize(image, image, Size(800, 800*image.size().height/image.size().width) );
imshow( "Camera: ", capture.grabFrame() ); // Show our image inside it.
if(waitKey(30) >=0 )
{
break;
}
}
cvDestroyWindow("Display window");
cout << "application ended: merci au revoir" << endl;
return 0;
}
开发者ID:walidvb,项目名称:rdc,代码行数:31,代码来源:main.cpp
示例6: CheckServiceStatusEvent
////////////////////////////////////////////////////////////////////////////////////
///
/// \brief This method is called by the mCheckServiceTimer. It calls the
/// CheckServiceStatus method of each Service so that they can do
/// updates regularly if needed.
///
////////////////////////////////////////////////////////////////////////////////////
void Component::CheckServiceStatusEvent(void* args)
{
Component* component = (Component *)args;
if(component->mInitializedFlag)
{
Service::Map::iterator s;
for(s = component->mServices.begin();
s != component->mServices.end() && component->mInitializedFlag;
s++)
{
if(s->second != component->mpEventsService &&
s->second != component->mpLivenessService &&
s->second != component->mpDiscoveryService &&
s->second != component->mpAccessControlService &&
s->second != component->mpManagementService &&
s->second != component->mpTimeService &&
s->second != component->mpTransportService)
{
s->second->CheckServiceStatus((unsigned int)(Time::GetUtcTimeMs() - component->mServiceCheckTimeMs));
Sensor* sensor = dynamic_cast<Sensor *>(s->second);
if(sensor)
{
sensor->CheckServiceSynchronization((unsigned int)(Time::GetUtcTimeMs() - component->mServiceCheckTimeMs));
}
}
}
component->mServiceCheckTimeMs = Time::GetUtcTimeMs();
}
}
开发者ID:ShowLove,项目名称:Robotics_Club,代码行数:36,代码来源:component.cpp
示例7: skipChge
//------------------------------------------------------------------------
void Sensors::skipChge(int state)
{
for (int i = Sensor::kSensorStart; i < Sensor::kSensorMax; i++) {
Sensor* s = fSensors[i];
if (s) s->skipDuplicates (state);
}
}
开发者ID:dfober,项目名称:greensounds,代码行数:8,代码来源:Sensors.cpp
示例8: run
boolean Sensor::run()
{
uint8_t i;
boolean ret;
Sensor *pObject = NULL;
ret = true;
if ( !runEnable )
{
return false;
}
for ( i = 0; i < objectNum ; i++ )
{
//todo, add balance
pObject = objectList[i].pObject;
if ( NULL != pObject )
{
if ( false == pObject->run())
{
ret = false;
}
}
}
return ret;
}
开发者ID:pookiemaker,项目名称:Reviews,代码行数:31,代码来源:WeatherStation.cpp
示例9: LOGME_CALL
void Level::loadExit(MvUint tileX, MvUint tileY)
{
LOGME_CALL("Level::loadExit");
LOGME_DEBUG("Exit at %d, %d", tileX, tileY);
auto e = mEcsContext.e();
auto c = mEcsContext.c();
EngineContext& ctx = mEngineContext;
MvAnimation::Ptr aSpawn(new MvAnimation(RepeatMode::Loop));
for (int i = 0; i < 3; ++i) {
StaticDrawable::Ptr ptr(new StaticDrawable(ctx, Tex::Blob, BlueSpawn[i]));
aSpawn->addDrawable(std::move(ptr));
aSpawn->addFrame(i, sf::milliseconds(240));
}
Entity eSpawn = createEntity();
CrawlComponents& cSpawn = c->attach<Transform, Renderable, Sensor>(eSpawn);
Renderable* cRenderable = cSpawn.get<Renderable>();
Sensor* cSensor = cSpawn.get<Sensor>();
Transform* cTransform = cSpawn.get<Transform>();
cRenderable->setLayer(def::layer::BackgroundNear);
cRenderable->setDrawable(std::move(aSpawn));
cTransform->setPosition(tileX * TW, tileY * TH);
cSensor->setShapeCircle(2.f, sf::Vector2f(tileX * TW, tileY * TH));
cSensor->setCollisionCategory(Collision::World);
cSensor->setCollisionWith(Collision::Player);
cSensor->setCategory(Category::ExitSensor);
mEcsContext.s()->get<PhysicsSystem>()->initialize(eSpawn);
}
开发者ID:silentlamb,项目名称:ld33-entry,代码行数:34,代码来源:Level.cpp
示例10: MOJING_FUNC_TRACE
bool Tracker::StartTrackChecker(int nSampleFrequence /*= 100*/)
{
bool bRet = false;
MOJING_FUNC_TRACE(g_Sensorlogger);
if (AtomicOps<int>::ExchangeAdd_NoSync(&RefCount, 1) >= 1)
{
MOJING_TRACE(g_Sensorlogger, "Start Tracker do not match! Start already. ");
}
else
{
Manager* pManager = Manager::GetMojingManager();
Sensor* pSensor = pManager->GetCheckSensor();
int nCheck = pSensor->CheckSensors();
if (nCheck & (SENSOR_GryoTooSlow | SENSOR_NoGryo))
{
MOJING_ERROR(g_Sensorlogger, "GryoTooSlow | SENSOR_NoGryo");
}
bRet = pSensor->StartSensor(nSampleFrequence);
}
return bRet;
}
开发者ID:playbar,项目名称:testplayer,代码行数:25,代码来源:MojingTracker.cpp
示例11: if
//------------------------------------------------------------------------
// Q_INVOKABLE methods
//------------------------------------------------------------------------
void Sensors::activate(int index, bool state)
{
Sensor* s = fSensors[index];
if (s) s->activate(state);
else if (index == Sensor::kSensorMax)
skipChge(state);
}
开发者ID:dfober,项目名称:greensounds,代码行数:10,代码来源:Sensors.cpp
示例12: sensorListLocker
std::wstring DeviceManager::getSensorValue(const std::wstring &protocol, const std::wstring &model, int id, int dataType) const {
TelldusCore::MutexLocker sensorListLocker(&d->lock);
Sensor *sensor = 0;
for (std::list<Sensor *>::iterator it = d->sensorList.begin(); it != d->sensorList.end(); ++it) {
TelldusCore::MutexLocker sensorLocker(*it);
if (!TelldusCore::comparei((*it)->protocol(), protocol)) {
continue;
}
if (!TelldusCore::comparei((*it)->model(), model)) {
continue;
}
if ((*it)->id() != id) {
continue;
}
sensor = *it;
break;
}
if (!sensor) {
return L"";
}
TelldusCore::MutexLocker sensorLocker(sensor);
TelldusCore::Message msg;
std::string value = sensor->value(dataType);
if (value.length() > 0) {
msg.addArgument(TelldusCore::charToWstring(value.c_str()));
msg.addArgument(static_cast<int>(sensor->timestamp()));
}
return msg;
}
开发者ID:4ib3r,项目名称:domoticz,代码行数:30,代码来源:DeviceManager.cpp
示例13: main
int main()
{
Sensor* p = new Adapter( new FahrenheitSensor);
cout << "Celsius temperature = " << p->getTemperature() << endl;
delete p;
return 0;
}
开发者ID:Code-Town,项目名称:CPP_COURSE,代码行数:7,代码来源:Adapter.cpp
示例14: mSensorDevice
SensorFusion::SensorFusion()
: mSensorDevice(SensorDevice::getInstance()),
mEnabled(false), mGyroTime(0)
{
sensor_t const* list;
Sensor uncalibratedGyro;
ssize_t count = mSensorDevice.getSensorList(&list);
if (count > 0) {
for (size_t i=0 ; i<size_t(count) ; i++) {
if (list[i].type == SENSOR_TYPE_ACCELEROMETER) {
mAcc = Sensor(list + i);
}
if (list[i].type == SENSOR_TYPE_MAGNETIC_FIELD) {
mMag = Sensor(list + i);
}
if (list[i].type == SENSOR_TYPE_GYROSCOPE) {
mGyro = Sensor(list + i);
}
if (list[i].type == SENSOR_TYPE_GYROSCOPE_UNCALIBRATED) {
uncalibratedGyro = Sensor(list + i);
}
}
// Use the uncalibrated gyroscope for sensor fusion when available
if (uncalibratedGyro.getType() == SENSOR_TYPE_GYROSCOPE_UNCALIBRATED) {
mGyro = uncalibratedGyro;
}
// 200 Hz for gyro events is a good compromise between precision
// and power/cpu usage.
mEstimatedGyroRate = 200;
mTargetDelayNs = 1000000000LL/mEstimatedGyroRate;
mFusion.init();
}
}
开发者ID:DroidSim,项目名称:platform_frameworks_native,代码行数:35,代码来源:SensorFusion.cpp
示例15: while
void GUIServer::getAllSensors() {
//errorcode 0
m_UdpServer.write((uint8_t) 0);
//num of sensors
m_UdpServer.write((uint8_t) __aquaduino->getNrOfSensors());
//Serial.println("NrOfSensors()");
// Serial.println(__aquaduino->getNrOfSensors());
//sensor information
Sensor* sensor;
__aquaduino->resetSensorIterator();
while (__aquaduino->getNextSensor(&sensor) != -1) {
m_UdpServer.write(__aquaduino->getSensorID(sensor));
//Name:String
m_UdpServer.write(strlen(sensor->getName()));
m_UdpServer.write(sensor->getName());
//Type:int
m_UdpServer.write(sensor->getType());
//Unit:String
m_UdpServer.write((uint8_t) 8);
m_UdpServer.write("TestUnit");
//visible:Boolean
m_UdpServer.write(true);
//calibrationInterval(days):int
m_UdpServer.write((uint8_t) 0);
}
}
开发者ID:tkerstan,项目名称:Aquaduino-Next,代码行数:26,代码来源:GUIServer.cpp
示例16: update
void Display::update(Subject * o)
{
Sensor * s = dynamic_cast< Sensor *>(o);
if ( s )
{
cout << "New Temp: " << s->getReading();
}
}
开发者ID:Sir2B,项目名称:Uni,代码行数:8,代码来源:main.cpp
示例17:
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sensor *Check::findSensor(const string &id) const {
for ( size_t i = 0; i < _inv->sensorCount(); ++i ) {
Sensor *sensor = _inv->sensor(i);
if ( sensor->publicID() == id ) return sensor;
}
return NULL;
}
开发者ID:koukou73gr,项目名称:seiscomp3,代码行数:9,代码来源:check.cpp
示例18: main
int main() {
float threshold = 2.5;
unsigned int numSamples = 10000;
Sensor * s = new Sensor(threshold);
s->read(numSamples);
delete s;
return 0;
}
开发者ID:attiliocaravelli,项目名称:sensors-network,代码行数:8,代码来源:test.cpp
示例19: JELOG2
/*
* Class: com_nokia_mj_impl_sensor_SensorConnectionImpl
* Method: _startServer
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_nokia_mj_impl_sensor_SensorConnectionImpl__1stopServer
(JNIEnv *, jobject, jint aConnectionHandle)
{
JELOG2(ESensor);
SensorConnection* conn = reinterpret_cast< SensorConnection* >(aConnectionHandle);
Sensor* sensor = conn->GetSensor();
sensor->StopServer();
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:13,代码来源:sensorconnectionimpl.cpp
示例20: bindResource
void CaptureParticleProcess::bindResource(const std::string &name, int id) {
if (name == "sensor") {
Sensor *sensor = static_cast<Sensor *>(Scheduler::getInstance()->getResource(id));
m_film = sensor->getFilm();
m_accum = new ImageBlock(Bitmap::ESpectrum, m_film->getCropSize(), NULL);
m_accum->clear();
}
ParticleProcess::bindResource(name, id);
}
开发者ID:AdrianJohnston,项目名称:ShapeNetRender,代码行数:9,代码来源:ptracer_proc.cpp
注:本文中的Sensor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论