source: flair-src/trunk/lib/FlairSensorActuator/src/Servos.cpp@ 342

Last change on this file since 342 was 340, checked in by Sanahuja Guillaume, 5 years ago

add servos

File size: 1.6 KB
Line 
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
22using std::string;
23using namespace flair::core;
24using namespace flair::gui;
25
26namespace flair {
27namespace actuator {
28
29Servos::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
36Servos::~Servos() { delete pimpl_; }
37
38void Servos::UpdateFrom(const io_data *data) { pimpl_->UpdateFrom(data); }
39
40void Servos::LockUserInterface(void) const { pimpl_->LockUserInterface(); }
41
42void Servos::UnlockUserInterface(void) const { pimpl_->UnlockUserInterface(); }
43
44Layout *Servos::GetLayout(void) const { return (Layout *)pimpl_->layout; }
45
46void Servos::UseDefaultPlot(TabWidget *tabwidget) {
47 pimpl_->UseDefaultPlot(tabwidget);
48}
49
50uint8_t Servos::ServosCount(void) const { return pimpl_->servos_count; }
51
52bool Servos::AreEnabled(void) const { return pimpl_->are_enabled; }
53
54void 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
Note: See TracBrowser for help on using the repository browser.