Avionics
Dropship Simulator
Encoder.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 EncoderConfig
9  {
10  bool enable;
11  int serialno;
12  std::string friendlyName;
13  };
14 
15  class Encoder
16  {
17  private:
18  Logger* logger = nullptr;
19  EncoderConfig* config = nullptr;
20  Bus* bus = nullptr; // needs a pointer because it is two-way (digital in or sensor can add, commands removed can trigger digital out)
21 
22  CPhidgetEncoderHandle ifKit = nullptr;
23 
24  static int CCONV AttachHandler(CPhidgetHandle IFK, void* userptr);
25  static int CCONV DetachHandler(CPhidgetHandle IFK, void* userptr);
26  static int CCONV ErrorHandler(CPhidgetHandle IFK, void* userptr, int ErrorCode, const char* unknown);
27  static int CCONV InputChangeHandler(CPhidgetEncoderHandle IFK, void* usrptr, int Index, int State);
28  static int CCONV PositionChangeHandler(CPhidgetEncoderHandle IFK, void* usrptr, int Index, int Time, int RelativePosition);
29 
30  int display_properties(CPhidgetEncoderHandle phid) const;
31  bool attached = false;
32  bool wasDetached = false;
33 
34  public:
35  void Destroy() const;
36  void Initialize(Logger* logger, EncoderConfig* config, Bus* prmBus);
37  };
38 }
Definition: Logger.h:5
void Initialize(Logger *logger, EncoderConfig *config, Bus *prmBus)
Definition: Encoder.cpp:298
okay, the portable keyboard numbers don't work like the outside keypad because the outside keypad is ...
Definition: Analog.cpp:3
static int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
Definition: Encoder.cpp:75
Definition: Bus.h:12
void Destroy() const
Definition: Encoder.cpp:347
bool wasDetached
Definition: Encoder.h:32
CPhidgetEncoderHandle ifKit
Definition: Encoder.h:22
static int CCONV PositionChangeHandler(CPhidgetEncoderHandle IFK, void *usrptr, int Index, int Time, int RelativePosition)
Definition: Encoder.cpp:151
static int CCONV DetachHandler(CPhidgetHandle IFK, void *userptr)
Definition: Encoder.cpp:51
Logger * logger
Definition: Encoder.h:18
std::string friendlyName
Definition: Encoder.h:12
EncoderConfig * config
Definition: Encoder.h:19
int display_properties(CPhidgetEncoderHandle phid) const
Definition: Encoder.cpp:271
static int CCONV InputChangeHandler(CPhidgetEncoderHandle IFK, void *usrptr, int Index, int State)
Definition: Encoder.cpp:86
static int CCONV AttachHandler(CPhidgetHandle IFK, void *userptr)
Definition: Encoder.cpp:20