| 1 | // %flair:license{
|
---|
| 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
| 4 | // %flair:license}
|
---|
| 5 | // created: 2019/11/28
|
---|
| 6 | // filename: Servos.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Virtual class for servos
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "Servos.h"
|
---|
| 19 | #include "Servos_impl.h"
|
---|
| 20 | #include <DoubleSpinBox.h>
|
---|
| 21 |
|
---|
| 22 | using std::string;
|
---|
| 23 | using namespace flair::core;
|
---|
| 24 | using namespace flair::gui;
|
---|
| 25 |
|
---|
| 26 | namespace flair {
|
---|
| 27 | namespace actuator {
|
---|
| 28 |
|
---|
| 29 | Servos::Servos(const IODevice *parent, Layout *layout, string name,
|
---|
| 30 | uint8_t motors_count)
|
---|
| 31 | : IODevice(parent, name) {
|
---|
| 32 | pimpl_ = new Servos_impl(this, layout, name, motors_count);
|
---|
| 33 |
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | Servos::~Servos() { delete pimpl_; }
|
---|
| 37 |
|
---|
| 38 | void Servos::UpdateFrom(const io_data *data) { pimpl_->UpdateFrom(data); }
|
---|
| 39 |
|
---|
| 40 | void Servos::LockUserInterface(void) const { pimpl_->LockUserInterface(); }
|
---|
| 41 |
|
---|
| 42 | void Servos::UnlockUserInterface(void) const { pimpl_->UnlockUserInterface(); }
|
---|
| 43 |
|
---|
| 44 | Layout *Servos::GetLayout(void) const { return (Layout *)pimpl_->layout; }
|
---|
| 45 |
|
---|
| 46 | void Servos::UseDefaultPlot(TabWidget *tabwidget) {
|
---|
| 47 | pimpl_->UseDefaultPlot(tabwidget);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | uint8_t Servos::ServosCount(void) const { return pimpl_->servos_count; }
|
---|
| 51 |
|
---|
| 52 | bool Servos::AreEnabled(void) const { return pimpl_->are_enabled; }
|
---|
| 53 |
|
---|
| 54 | void Servos::SetEnabled(bool status) {
|
---|
| 55 | if (pimpl_->are_enabled != status) {
|
---|
| 56 | pimpl_->are_enabled = status;
|
---|
| 57 | if (pimpl_->are_enabled) {
|
---|
| 58 | LockUserInterface();
|
---|
| 59 | } else {
|
---|
| 60 | UnlockUserInterface();
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | } // end namespace sensor
|
---|
| 66 | } // end namespace flair
|
---|