/** * Notify the collection task that data collection is complete. */ void WorkerTask::completeDataCollection() { // done with data collection; report completion to collection task // and any packet reception problems to SSE. ChannelStatistics stats; channel->getStats(stats); Debug(DEBUG_ALWAYS, (int32_t) stats.netStats.total, "total packets"); Debug(DEBUG_ALWAYS, (int32_t) stats.netStats.missed, "missed packets"); Debug(DEBUG_ALWAYS, (int32_t) stats.netStats.late, "late packets"); if ((stats.netStats.missed + stats.netStats.late) > 0 && activity) { LogWarning(ERR_LMP, activity->getActivityId(), "channel %d, total packets = %d, missed = %d, late = %d", channel->getChannelNum(), stats.netStats.total, stats.netStats.missed, stats.netStats.late); } Msg *cMsg = msgList->alloc(DATA_COLLECTION_COMPLETE, activityId, reinterpret_cast<void *> (channel->getChannelNum()), 0, 0, IMMEDIATE); cMsg->setUnit((sonata_lib::Unit) unit); collectionQ->send(cMsg); stopActivity(activity); }
void WorkerTask::handleMsg(Msg *msg) { // flush any irrelevant messages if (msg->getActivityId() != activityId) return; switch (msg->getCode()) { case DfbProcess: // perform a DFB/channelization lock(); processData(msg); unlock(); break; case DATA_COLLECTION_COMPLETE: // all channels are done, time to go lock(); spectrometer->stopSpectrometry(activity); activity = 0; activityId = -1; unlock(); break; case STOP_DX_ACTIVITY: case SHUTDOWN_DX: case RESTART_DX: lock(); stopActivity(msg); unlock(); terminate(); break; default: Fatal(ERR_IMT); break; } }
void BootupAnimation::pipeDataAvailable(int pipe) { char buffer[BOOT_ANIM_MESSAGE_LENGHT]; int index = 0; char data; while(index < BOOT_ANIM_MESSAGE_LENGHT && (::read(pipe, &(buffer[index]), 1) == 1)) { index++; } if(buffer[0] == BOOT_ANIM_MESSAGE_END_ANIMATION) { stop(); } else if(buffer[0] == BOOT_ANIM_MESSAGE_START_PROGRESS) { startActivity(); } else if(buffer[0] == BOOT_ANIM_MESSAGE_END_PROGRESS) { stopActivity(); } else if(buffer[0] == BOOT_ANIM_MESSAGE_PROGRESS_UPDATE) { int val, total; int* p = (int*)&(buffer[1]); val = *p; p = (int*)&(buffer[1 + sizeof(int)]); total = *p; setActivityProgress(val, total); } }
void DetectionTask::handleMsg(Msg *msg) { DxOpsBitset operations; switch (msg->getCode()) { case StartDetection: // start the signal detection startActivity(msg); break; case CwComplete: if (!activity) break; operations = params.operations; if (activity->getState() == DX_ACT_STOPPING) sendDetectionComplete(); else startPulseDetection(); break; case PulseComplete: sendDetectionComplete(); break; case STOP_DX_ACTIVITY: stopActivity(msg); break; case ActivityStopped: sendDetectionComplete(); break; case SHUTDOWN_DX: case RESTART_DX: stopActivity(msg, true); break; default: break; } }
void ActivityManager::activityAdded(QString id) { // skip the Status source if (id == "Status") return; // create a new activity object ActivityWidget *activity = new ActivityWidget(extender()->item("Activities"), id); // add activity to the list m_activities.insert(id, activity); // connect activity update signal dataEngine("org.kde.activities")->connectSource(id, this); // connect activity start/stop signals connect(activity, SIGNAL(setCurrent(QString)), this, SLOT(setCurrent(QString))); connect(activity, SIGNAL(startActivity(QString)), this, SLOT(start(QString))); connect(activity, SIGNAL(stopActivity(QString)), this, SLOT(stop(QString))); connect(activity, SIGNAL(addActivity(QString)), this, SLOT(add(QString))); connect(activity, SIGNAL(removeActivity(QString)), this, SLOT(remove(QString))); connect(activity, SIGNAL(renameActivity(QString,QString)), this, SLOT(setName(QString,QString))); }
void destroyActivity (ActivityObject *activity) { stopActivity(activity); awaitActivityStopped(activity); free(activity); }