MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/technological/proxy/BrakeProxy.cpp
2024-06-07 11:12:56 +03:00

50 lines
869 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* BrakeProxy.cpp
*
* Created on: 7 окт. 2020 г.
* Author: LeonidTitov
*/
#include "BrakeProxy.hh"
technological::proxy::BrakeProxy::BrakeProxy(
ResourceKeeper<driver::IBrake> & brake ) : brake(brake), intention(false) {}
void technological::proxy::BrakeProxy::engage() {
intention = false;
if( brake ) {
brake->engage();
brake.unlock();
}
}
void technological::proxy::BrakeProxy::disengage() {
intention = true;
if( brake or brake.try_lock() )
brake->disengage();
}
bool technological::proxy::BrakeProxy::isApplied() const {
return (brake) ? brake->isApplied() : false;
}
bool technological::proxy::BrakeProxy::isFree() const {
return (brake) ? brake->isFree() : false;
}
bool technological::proxy::BrakeProxy::isBlocked() const {
return not( brake ) and intention;
}