CATCH
 All Classes Functions
CatIPSI.h
1 // CatIPSI.h
2 
3 #pragma once
4 
5 #include "CatTrimesh.h"
6 #include "CatUtil.h"
7 #include <string>
8 #include <map>
9 
10 namespace Catch {
11 
12 
13  typedef void (*CatIPSIButtonStateChangeCallback)(int nextState);
14  typedef std::map<std::string, int> strint_map;
15 
16  class CatIPSI
17  {
18  public:
19  #pragma region Public Methods
20 
25  CatIPSI(std::string IPAddr);
26 
30  ~CatIPSI();
31 
39  CAT_RESULT init(int maxNumObjects, double simTimeStep, double resolution);
40 
46  CAT_RESULT addTriMesh( CatTrimesh &tri);
47 
52  CAT_RESULT startSimulation();
53 
60  CAT_RESULT setButtonStateChangeCallback(CatIPSIButtonStateChangeCallback callback);
61 
69  CAT_RESULT pollBodyTransformation(std::string oid, double *object_location);
70 
77  CAT_RESULT pollDeviceTransformation(double *device_transformation);
78 
84  CAT_RESULT attachDevice(std::string oid);
85 
91  CAT_RESULT detachDevice();
92 
93  #pragma endregion
94 
95  private:
96  #pragma region Private Variables
97 
98  unsigned int _selectedBodyId;
99  CatIPSIButtonStateChangeCallback _buttonStateChangeCallback;
100  std::string _ipAddress;
101  strint_map _jtk_ipsi_id_pair;
102  int _numButtons;
103  int _prevButtonState;
104  bool _deviceSensitivityConfigured;
105 
106  #pragma endregion
107 
108  #pragma region Private Methods
109 
110  void pollButton();
111 
112  #pragma endregion
113  };
114 }
CAT_RESULT addTriMesh(CatTrimesh &tri)
CAT_RESULT pollDeviceTransformation(double *device_transformation)
CAT_RESULT startSimulation()
CAT_RESULT pollBodyTransformation(std::string oid, double *object_location)
CAT_RESULT init(int maxNumObjects, double simTimeStep, double resolution)
CAT_RESULT attachDevice(std::string oid)
Definition: CatIPSI.h:16
CAT_RESULT setButtonStateChangeCallback(CatIPSIButtonStateChangeCallback callback)
CAT_RESULT detachDevice()
Definition: CatTrimesh.h:13
CatIPSI(std::string IPAddr)