38 lines
548 B
C++
38 lines
548 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();
|
|
|
|
}
|