コード例 #1
0
 virtual void
 run (Arg)
   {
     checkDefaultAdvice();
     blockOnAdvice();
     checkSignals();
   }
コード例 #2
0
ファイル: control.c プロジェクト: derkling/adcontrol
void controlLoop(void) {
	static uint8_t i = 0;
	uint8_t ch; // The currently selected channel

	// Keep quite the dog at each iteration
	WATCHDOG_RESET();

	// Set device status led
	if (CalibrationDone())
		LED_ON();
	else
		LED_SWITCH();

	// Schedule timer activities (SMS and Console checking)
	synctimer_poll(&timers_lst);

	// Checking for pending signals to serve
	checkSignals();

	// Select Channel to sample and get P measure
	ch = sampleChannel();
	if (ch==MAX_CHANNELS) {
		// No channels enabled... avoid calibration/monitoring
		if (chCalib) {
			DB(LOG_INFO("Idle (%s, Fault: 0x%04X, Cal: 0x%04X) %c\r",
						controlMonitoringEnabled() ? "Mon" : "Dis",
						chSpoiled,
						chCalib, progress[i++%4]));
		} else {
			DB(LOG_INFO("Idle (%s, Fault: 0x%04X) %c\r",
						controlMonitoringEnabled() ? "Mon" : "Dis",
						chSpoiled,
						progress[i++%4]));
		}
		DELAY(500);
		return;
	}

	if (needCalibration(ch)) {

		calibrate(ch);
		
		// Check if all channels has been calibrated
		// So that we can notify calibration completion (just one time)
		if (!CalibrationDone())
			return;

		// Notify calibration completion
		LOG_INFO("\n\nCALIBRATION COMPLETED\r\n\n");
		LED_ON();
		notifyCalibrationCompleted();
		return;
	}

	// Monitor the current channel
	if (controlMonitoringEnabled())
		monitor(ch);

}
コード例 #3
0
bool PlaceManagerUtils::doSavePlace(QPlaceManager *manager,
                                    const QPlace &place,
                                    QPlaceReply::Error expectedError,
                                    QString *placeId)
{
    Q_ASSERT(manager);
    QPlaceIdReply *saveReply = manager->savePlace(place);
    bool isSuccessful = checkSignals(saveReply, expectedError, manager);
    if (placeId != 0) {
        *placeId = saveReply->id();
    }

    if (saveReply->id().isEmpty() && expectedError == QPlaceReply::NoError) {
        qWarning("ID is empty in reply for save operation");
        qWarning() << "Error string = " << saveReply->errorString();
        isSuccessful = false;
    }

    if (!isSuccessful)
        qWarning() << "Error string = " << saveReply->errorString();

    return isSuccessful;
}