bool EngineManager::updateUnitily() { updateFrame(); renderFrame(); presentFrame(); return !isExitRequested(); }
int main(int argc, const char * argv[]) { CanDevice::resetAllDevices(); PwmDevice::resetAllDevices(); event_init(); task_init(0, 0, NULL); CanBusHandler can_bus_handler; while (!isExitRequested()) { event_dispatch(); } printf("</end>\n"); return EXIT_SUCCESS; }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void Envelope::emitResult(const Processor *proc, double acc, double vel, double disp, const Core::Time ×tamp, bool clipped) { _creationInfo.setCreationTime(Core::Time::GMT()); // Objects with empty publicID are created since they are currently // not sent as notifiers and stored in the database VS::EnvelopePtr envelope = new VS::Envelope(""); envelope->setCreationInfo(_creationInfo); envelope->setNetwork(proc->waveformID().networkCode()); envelope->setStation(proc->waveformID().stationCode()); envelope->setTimestamp(timestamp); VS::EnvelopeChannelPtr cha = new VS::EnvelopeChannel(""); cha->setName(proc->name()); cha->setWaveformID(proc->waveformID()); VS::EnvelopeValuePtr val; // Add acceleration value val = new VS::EnvelopeValue; val->setValue(acc); val->setType("acc"); if ( clipped ) val->setQuality(VS::EnvelopeValueQuality(VS::clipped)); cha->add(val.get()); // Add velocity value val = new VS::EnvelopeValue; val->setValue(vel); val->setType("vel"); if ( clipped ) val->setQuality(VS::EnvelopeValueQuality(VS::clipped)); cha->add(val.get()); // Add displacement value val = new VS::EnvelopeValue; val->setValue(disp); val->setType("disp"); if ( clipped ) val->setQuality(VS::EnvelopeValueQuality(VS::clipped)); cha->add(val.get()); envelope->add(cha.get()); Core::DataMessagePtr msg = new Core::DataMessage; msg->attach(envelope.get()); /* -- DEBUG -- Core::DataMessage *tmp = &msg; IO::XMLArchive ar; ar.create("-"); ar.setFormattedOutput(true); ar << tmp; ar.close(); */ if ( connection() ) { connection()->send(msg.get()); ++_sentMessages; ++_sentMessagesTotal; #ifndef SC3_SYNC_VERSION if ( _config.maxMessageCountPerSecond > 0 ) { bool first = true; while ( !isExitRequested() && _sentMessages > _config.maxMessageCountPerSecond ) { if ( first ) SEISCOMP_WARNING("Throttling message output, more than %d allowed messages sent per second", _config.maxMessageCountPerSecond); first = false; Core::msleep(100); } } #else // Request a sync token every 100 messages if ( _sentMessages > 100 ) { _sentMessages = 0; // Tell the record acquisition to request synchronization and to // stop sending records until the sync is completed. requestSync(); } #endif } }