Avionics
Dropship Simulator
InterfaceKit.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 {
9  {
11  bool enable;
12  int serialno;
13  std::string friendlyName;
14 
15  struct Sensor
16  {
17  bool defined;
18  std::string guid;
19  std::string name;
20  std::string type;
21  std::string subtype;
23  bool inverse = false;
24  float bias = 0.0f;
25  float* ptrFloat = nullptr;
27  };
28 
29  std::vector<Sensor> sensors;
30 
31  struct Input
32  {
33  bool defined;
34  std::string name;
35  std::string guid;
36  float* ptrFloat = nullptr;
38  };
39 
40  std::vector<Input> inputs;
41 
42  struct Output
43  {
44  bool defined;
45  std::string trigger;
46  std::string guid;
48  float* busCurrentState = nullptr;
49  };
50 
51  std::vector<Output> outputs;
52  };
53 
55  {
56  private:
57  Logger* logger = nullptr;
59  Bus* bus = nullptr; // needs a pointer because it is two-way (digital in or sensor can add, commands removed can trigger digital out)
60 
61  CPhidgetInterfaceKitHandle ifKit = nullptr;
62 
63  static int CCONV AttachHandler(CPhidgetHandle IFK, void* userptr);
64  static int CCONV DetachHandler(CPhidgetHandle IFK, void* userptr);
65  static int CCONV ErrorHandler(CPhidgetHandle IFK, void* userptr, int ErrorCode, const char* unknown);
66  static int CCONV InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void* usrptr, int Index, int State);
67  //static int CCONV OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State);
68  static int CCONV SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void* usrptr, int Index, int Value);
69 
70  int display_properties(CPhidgetInterfaceKitHandle phid) const;
71  bool attached = false;
72  bool wasDetached = false;
73 
74  public:
75  void FrameMove() const;
76  void Destroy() const;
78  };
79 }
CPhidgetInterfaceKitHandle ifKit
Definition: InterfaceKit.h:61
static int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
Definition: Logger.h:5
static int CCONV InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
InterfaceKitConfig * config
Definition: InterfaceKit.h:58
static int CCONV SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
std::vector< Output > outputs
Definition: InterfaceKit.h:51
okay, the portable keyboard numbers don&#39;t work like the outside keypad because the outside keypad is ...
Definition: Analog.cpp:3
Definition: Bus.h:12
std::vector< Input > inputs
Definition: InterfaceKit.h:40
static int CCONV DetachHandler(CPhidgetHandle IFK, void *userptr)
static int CCONV AttachHandler(CPhidgetHandle IFK, void *userptr)
Definition: InterfaceKit.cpp:5
int display_properties(CPhidgetInterfaceKitHandle phid) const
void Initialize(Logger *logger, InterfaceKitConfig *config, Bus *prmBus)
std::vector< Sensor > sensors
Definition: InterfaceKit.h:29