bool DeviceDescriptor::PutQNH(const AtmosphericPressure &value, OperationEnvironment &env) { assert(InMainThread()); if (device == nullptr || settings_sent.CompareQNH(value) || !config.sync_to_device) return true; if (!Borrow()) /* TODO: postpone until the borrowed device has been returned */ return false; ScopeReturnDevice restore(*this, env); if (!device->PutQNH(value, env)) return false; ScopeLock protect(device_blackboard->mutex); NMEAInfo &basic = device_blackboard->SetRealState(index); settings_sent.qnh = value; settings_sent.qnh_available.Update(basic.clock); return true; }
bool DeviceDescriptor::PutBallast(fixed fraction, fixed overload, OperationEnvironment &env) { assert(InMainThread()); if (device == nullptr || !config.sync_to_device || (settings_sent.CompareBallastFraction(fraction) && settings_sent.CompareBallastOverload(overload))) return true; if (!Borrow()) /* TODO: postpone until the borrowed device has been returned */ return false; ScopeReturnDevice restore(*this, env); if (!device->PutBallast(fraction, overload, env)) return false; ScopeLock protect(device_blackboard->mutex); NMEAInfo &basic = device_blackboard->SetRealState(index); settings_sent.ballast_fraction = fraction; settings_sent.ballast_fraction_available.Update(basic.clock); settings_sent.ballast_overload = overload; settings_sent.ballast_overload_available.Update(basic.clock); return true; }
BigInt & BigInt::operator-=(BICR bi) { int borrow=0; std::vector<int>::iterator it; it=transform(bi.digits.begin(),bi.digits.end(), digits.begin(),digits.begin(),SubWithBorrow(borrow)); transform(it,digits.end(),it,Borrow(borrow)); return *this; }
bool DeviceDescriptor::PutVolume(unsigned volume, OperationEnvironment &env) { assert(InMainThread()); if (device == nullptr || !config.sync_to_device) return true; if (!Borrow()) /* TODO: postpone until the borrowed device has been returned */ return false; ScopeReturnDevice restore(*this, env); return device->PutVolume(volume, env); }
bool DeviceDescriptor::PutStandbyFrequency(RadioFrequency frequency, OperationEnvironment &env) { assert(InMainThread()); if (device == NULL || !config.sync_to_device) return true; if (!Borrow()) /* TODO: postpone until the borrowed device has been returned */ return false; ScopeReturnDevice restore(*this, env); return device->PutStandbyFrequency(frequency, env); }