38 lines
553 B
C++
38 lines
553 B
C++
/*
|
||
* Brake.cpp
|
||
*
|
||
* Created on: 2 февр. 2018 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#include "Brake.hh"
|
||
|
||
driver::detail::Brake::Brake( IDiscreteOutput & output ) :
|
||
output(output), state(true) {}
|
||
|
||
void driver::detail::Brake::engage() {
|
||
|
||
output.off();
|
||
state = true;
|
||
|
||
}
|
||
|
||
void driver::detail::Brake::disengage() {
|
||
|
||
output.on();
|
||
state = false;
|
||
|
||
}
|
||
|
||
bool driver::detail::Brake::isApplied() const {
|
||
|
||
return state && output.isCompleted();
|
||
|
||
}
|
||
|
||
bool driver::detail::Brake::isFree() const {
|
||
|
||
return !state && output.isCompleted();
|
||
|
||
}
|