iCub-main
embObjPSC.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This software may be modified and distributed under the terms of the
5  * LGPL-2.1+ license. See the accompanying LICENSE file for details.
6  */
7 
8 
9 #ifndef __embObjPSC_h__
10 #define __embObjPSC_h__
11 
12 #include <string>
13 #include <mutex>
14 #include <yarp/dev/DeviceDriver.h>
15 #include <yarp/dev/IAnalogSensor.h>
16 #include <yarp/sig/Vector.h>
17 
18 //#include <iCub/FactoryInterface.h>
19 //#include <iCub/LoggerInterfaces.h>
20 
21 
23 
24 #include "serviceParser.h"
25 
26 
27 namespace yarp {
28  namespace dev {
29  class embObjPSC;
30  }
31 }
32 
33 
34 
35 class yarp::dev::embObjPSC: public yarp::dev::IAnalogSensor,
36  public yarp::dev::DeviceDriver,
37  public eth::IethResource
38 {
39 
40 public:
41 
42  embObjPSC();
43  ~embObjPSC();
44 
45  bool open(yarp::os::Searchable &config);
46  bool close();
47 
48  // IAnalogSensor interface
49  virtual int read(yarp::sig::Vector &out);
50  virtual int getState(int ch);
51  virtual int getChannels();
52  virtual int calibrateChannel(int ch, double v);
53  virtual int calibrateSensor();
54  virtual int calibrateSensor(const yarp::sig::Vector& value);
55  virtual int calibrateChannel(int ch);
56 
57  // IethResource interface
58  virtual bool initialised();
59  virtual eth::iethresType_t type();
60  virtual bool update(eOprotID32_t id32, double timestamp, void* rxdata);
61 
62 private:
63 
65 
66 
67  std::mutex m_mutex;
68 
69  yarp::sig::Vector m_data;
70 
71 
72 private:
73 
74  bool fromConfig(yarp::os::Searchable &config, servConfigPSC_t &serviceConfig);
75  bool sendConfig2PSCboards(servConfigPSC_t &serviceConfig);
76  bool sendStart2PSCboards(void);
77  bool initRegulars(void);
78  void cleanup(void);
79 // void printServiceConfig(void);
80 
81 
82 };
83 
84 
85 #endif
86 
virtual int calibrateChannel(int ch, double v)
Definition: embObjPSC.cpp:301
virtual int read(yarp::sig::Vector &out)
Read a vector from the sensor.
Definition: embObjPSC.cpp:253
virtual int getChannels()
Definition: embObjPSC.cpp:277
virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata)
Definition: embObjPSC.cpp:313
bool open(yarp::os::Searchable &config)
Definition: embObjPSC.cpp:83
virtual int calibrateSensor()
Definition: embObjPSC.cpp:283
virtual int getState(int ch)
Definition: embObjPSC.cpp:270
virtual bool initialised()
Definition: embObjPSC.cpp:75
virtual eth::iethresType_t type()
Definition: embObjPSC.cpp:307
static int v
Definition: iCub_Sim.cpp:42
iethresType_t
Definition: IethResource.h:61
Copyright (C) 2008 RobotCub Consortium.
out
Definition: sine.m:8