/**
 * The application's main.
 */
void loop()
{
    int debounceTime = userEeprom[EE_INPUT_DEBOUNCE_TIME] >> 1;
    int objno, channel, value, lastValue;

    // Handle the input pins
    for (channel = 0; channel < NUM_CHANNELS; ++channel)
    {
        lastValue = inputDebouncer[channel].value();
        value = inputDebouncer[channel].debounce(digitalRead(inputPins[channel]), debounceTime);

        if (lastValue != value)
            inputChanged(channel, value);
    }

    // Handle updated communication objects
    while ((objno = nextUpdatedObject()) >= 0)
    {
        objectUpdated(objno);
    }

    // Handle timed functions (e.g. periodic update)
    handlePeriodic();

    // Sleep up to 1 millisecond if there is nothing to do
    if (bus.idle())
        waitForInterrupt();
}
bool SimpleDataAccessObject<T>::update(T *const object)
{
    resetLastError();
    bool ok = m_objects.contains(m_metaObject.primaryKeyProperty().read(object));
    if(ok)
        emit objectUpdated(object);
    return ok;
}
/**
 * Set the metadata held by the metaobject
 */
void UAVMetaObject::setData(const Metadata & mdata)
{
    QMutexLocker locker(mutex);

    parentMetadata = mdata;
    emit objectUpdatedAuto(this); // trigger object updated event
    emit objectUpdated(this);
}
void QueueObject::statisticsUpdated()
{
  if (m_status == Unknown)
    return;
  
  emit objectUpdated();
  emit KFTPQueue::Manager::self()->objectChanged(this);
}
bool QpDaoBase::updateObject(QSharedPointer<QObject> object)
{
    if(!d->sqlDataAccessObjectHelper->updateObject(d->metaObject, object.data())) {
        setLastError(d->sqlDataAccessObjectHelper->lastError());
        return false;
    }

    emit objectUpdated(object);
    return true;
}
示例#6
0
/**
 * Set the object data fields
 */
void I2CStats::setData(const DataFields& data)
{
    QMutexLocker locker(mutex);
    // Get metadata
    Metadata mdata = getMetadata();
    // Update object if the access mode permits
    if (UAVObject::GetGcsAccess(mdata) == ACCESS_READWRITE) {
        this->data = data;
        emit objectUpdatedAuto(this); // trigger object updated event
        emit objectUpdated(this);
    }
}
/**
 * Set the object data fields
 */
void MixerSettings::setData(const DataFields& data)
{
    QMutexLocker locker(mutex);
    // Get metadata
    Metadata mdata = getMetadata();
    // Update object if the access mode permits
    if ( mdata.gcsAccess == ACCESS_READWRITE )
    {
        this->data = data;
        emit objectUpdatedAuto(this); // trigger object updated event
        emit objectUpdated(this);
    }
}
示例#8
0
/**
 * Unpack the object data from a byte array
 * @returns The number of bytes copied
 */
qint32 UAVObject::unpack(const quint8* dataIn)
{
    QMutexLocker locker(mutex);
    qint32 offset = 0;
    for (int n = 0; n < fields.length(); ++n)
    {
        fields[n]->unpack(&dataIn[offset]);
        offset += fields[n]->getNumBytes();
    }
    emit objectUnpacked(this); // trigger object updated event
    emit objectUpdated(this);

    return numBytes;
}
	void handleSourceDataUpdate(const Source<Objects>& source)
	{
		Objects::Mutex::scoped_lock lock(objects.mutex);

		objects = source.get();

		if (calibrating) {
			for (Objects::Iterator object = objects.begin(); object != objects.end(); ++object) {
				if ((*object)->isNew()) {
					objectAdded(*object);
				} else if ((*object)->isDead()) {
					objectRemoved(*object);
				} else {
					objectUpdated(*object);
				}
			}
		}

		repaint();
	}
Connection *Transfer::initializeSession(Session *session)
{
  if (!session->isFreeConnection()) {
    // We should wait for a connection to become available
    connect(session, SIGNAL(freeConnectionAvailable()), this, SLOT(slotConnectionAvailable()));
    
    if (m_status != Waiting) {
      m_status = Waiting;
      emit objectUpdated();
    }
    
    return 0;
  }
  
  Connection *connection = session->assignConnection();
  connection->acquire(this);
  
  connect(connection->getClient()->eventHandler(), SIGNAL(connected()), this, SLOT(slotConnectionConnected()));
  
  return connection;
}
示例#11
0
/**
 * Signal that the object has been updated
 */
void UAVObject::updated()
{
    emit objectUpdatedManual(this);
    emit objectUpdated(this);
}