1 Star 0 Fork 1

upczap/vrpn

forked from ianaxe/vrpn 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vrpn_5DT16.h 2.81 KB
一键复制 编辑 原始数据 按行查看 历史
#ifndef vrpn_5dt16_H
#define vrpn_5dt16_H
#include "vrpn_Analog.h" // for vrpn_ANALOGCB, etc
#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK
#include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
#include "vrpn_Shared.h" // for timeval
#include "vrpn_Types.h" // for vrpn_uint32
// This class will read the finger-pad values of the 5DT glove as analogs
// and send them. Use the vrpn_Button_5DT_Server class below if you want
// to turn them into buttons by thresholding them.
class VRPN_API vrpn_5dt16: public vrpn_Serial_Analog
{
public:
vrpn_5dt16 (const char * name,
vrpn_Connection * c,
const char * port,
int baud = 19200);
~vrpn_5dt16 () {};
/// Called once through each main loop iteration to handle updates.
virtual void mainloop ();
protected:
int _status; //< Reset, Syncing, or Reading
int _numchannels; //< How many analog channels to open
int _mode ; //< glove mode for reporting data (see glove manual)
unsigned _expected_chars; //< How many characters to expect in the report
unsigned char _buffer[512]; //< Buffer of characters in report
unsigned _bufcount; //< How many characters we have so far
bool _tenbytes; //< Whether there are 10-byte responses (unusual, but seen)
struct timeval timestamp; //< Time of the last report from the device
virtual int reset(void); //< Set device back to starting config
virtual void get_report(void); //< Try to read a report from the device
virtual void clear_values(void); //< Clears all channels to 0
/// send report iff changed
virtual void report_changes
(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
/// send report whether or not changed
virtual void report
(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
};
#include "vrpn_Button.h" // for vrpn_Button_Filter
// 5dt16 button server code. This device will listen to a 5dt16 analog server
// and report button press and release event when the analog pass a threshold
// value.
// This class is derived from the vrpn_Button_Filter class, so that it
// can be made to toggle its buttons using messages from the client.
class VRPN_API vrpn_Button_5DT_Server : public vrpn_Button_Filter
{
public:
// Buttons are considered pressed when their analog value exceeds the
// threshold value.
vrpn_Button_5DT_Server(const char *name, const char *deviceName, vrpn_Connection *c,
double threshold[16]);
~vrpn_Button_5DT_Server();
virtual void mainloop();
protected:
static void VRPN_CALLBACK handle_analog_update (void * userdata, const vrpn_ANALOGCB info);
vrpn_Analog_Remote *d_5dt_button;
double m_threshold[16];
};
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/jari/vrpn.git
[email protected]:jari/vrpn.git
jari
vrpn
vrpn
master

搜索帮助