source: flair-src/trunk/lib/FlairSensorActuator/src/PressureSensor.cpp@ 345

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

add servos

File size: 2.0 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: 2018/02/08
6// filename: PressureSensor.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Base class for PressureSensor
14//
15//
16/*********************************************************************/
17
18#include "PressureSensor.h"
19#include <FrameworkManager.h>
20#include <Tab.h>
21#include <TabWidget.h>
22#include <GroupBox.h>
23#include <Layout.h>
24#include <DataPlot1D.h>
25#include <Matrix.h>
26
27using std::string;
28using namespace flair::core;
29using namespace flair::gui;
30
31namespace flair {
32namespace sensor {
33
34PressureSensor::PressureSensor(string name)
35 : IODevice(getFrameworkManager(), name) {
36 plot_tab = NULL;
37
38 MatrixDescriptor *desc = new MatrixDescriptor(1, 1);
39 desc->SetElementName(0, 0, name);
40 output = new Matrix(this, desc, floatType);
41 delete desc;
42 AddDataToLog(output);
43
44 main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
45 tab = new TabWidget(main_tab->NewRow(), name);
46 sensor_tab = new Tab(tab, "Setup");
47 setup_groupbox = new GroupBox(sensor_tab->NewRow(), name);
48}
49
50PressureSensor::~PressureSensor() {
51 delete main_tab;
52}
53
54GroupBox *PressureSensor::GetGroupBox(void) const { return setup_groupbox; }
55
56Layout *PressureSensor::GetLayout(void) const { return sensor_tab; }
57
58DataPlot1D *PressureSensor::GetPlot(void) const { return plot; }
59
60Tab *PressureSensor::GetPlotTab(void) const { return plot_tab; }
61
62void PressureSensor::UseDefaultPlot(void) {
63 plot_tab = new Tab(tab, "Mesures");
64 plot = new DataPlot1D(plot_tab->NewRow(), ObjectName(), 101000, 101500);
65 plot->AddCurve(output->Element(0));
66}
67
68void PressureSensor::LockUserInterface(void) const {
69 setup_groupbox->setEnabled(false);
70}
71
72void PressureSensor::UnlockUserInterface(void) const {
73 setup_groupbox->setEnabled(true);
74}
75
76float PressureSensor::Value(void) const { return output->Value(0, 0); }
77
78} // end namespace sensor
79} // end namespace flair
Note: See TracBrowser for help on using the repository browser.