Avionics
Dropship Simulator
Analog.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../phidgets-2.1/phidget21.h"
4 #include "Bus.h"
5 
6 namespace Devices
7 {
8  struct AnalogConfig
9  {
10  bool enable;
11  int serialno;
12 
13  struct Channel
14  {
15  bool defined;
16  double currentValue;
17  std::string trigger;
18  };
19 
20  std::vector<Channel> channels;
21  };
22 
23  class Analog
24  {
25  private:
26  Logger* logger = nullptr;
27  AnalogConfig* config = nullptr;
28  Bus* bus = nullptr; // needs a pointer because it is two-way (digital in or sensor can add, commands removed can trigger digital out)
29 
30  CPhidgetAnalogHandle ifKit = nullptr;
31 
32  static int CCONV AttachHandler(CPhidgetHandle IFK, void* userptr);
33  static int CCONV DetachHandler(CPhidgetHandle IFK, void* userptr);
34  static int CCONV ErrorHandler(CPhidgetHandle IFK, void* userptr, int ErrorCode, const char* unknown);
35  /*static int CCONV InputChangeHandler(CPhidgetAnalogHandle IFK, void *usrptr, int Index, int State);
36  static int CCONV OutputChangeHandler(CPhidgetAnalogHandle IFK, void *usrptr, int Index, int State);
37  static int CCONV SensorChangeHandler(CPhidgetAnalogHandle IFK, void *usrptr, int Index, int Value);*/
38 
39  int display_properties(CPhidgetAnalogHandle phid) const;
40 
41  public:
42  void FrameMove() const;
43  void Destroy() const;
44  void Initialize(Logger* logger, AnalogConfig* config, Bus* prmBus);
45  };
46 }
AnalogConfig * config
Definition: Analog.h:27
void FrameMove() const
Definition: Analog.cpp:154
Bus * bus
Definition: Analog.h:28
static int CCONV DetachHandler(CPhidgetHandle IFK, void *userptr)
Definition: Analog.cpp:24
Definition: Logger.h:5
void Destroy() const
Definition: Analog.cpp:146
std::vector< Channel > channels
Definition: Analog.h:20
okay, the portable keyboard numbers don&#39;t work like the outside keypad because the outside keypad is ...
Definition: Analog.cpp:3
Logger * logger
Definition: Analog.h:26
void Initialize(Logger *logger, AnalogConfig *config, Bus *prmBus)
Definition: Analog.cpp:83
int display_properties(CPhidgetAnalogHandle phid) const
Definition: Analog.cpp:53
Definition: Bus.h:12
static int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
Definition: Analog.cpp:41
static int CCONV AttachHandler(CPhidgetHandle IFK, void *userptr)
Definition: Analog.cpp:5
CPhidgetAnalogHandle ifKit
Definition: Analog.h:30