~hitmuri/vjpirate/trunk

« back to all changes in this revision

Viewing changes to os/win/include/vrpn_Tracker_NovintFalcon.h

  • Committer: Florent Berthaut
  • Date: 2014-07-26 18:53:16 UTC
  • mfrom: (5.1.12 mac)
  • Revision ID: flo@localhost.localdomain-20140726185316-c2ucnwmgm5kij4e2
Merged mac branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
// This file provides an interface to a Novint Falcon.
 
3
// http://home.novint.com/products/novint_falcon.php
 
4
// It uses libnifalcon to communicate with the device.
 
5
// http://libnifalcon.nonpolynomial.org/
 
6
//
 
7
// file:        vrpn_Tracker_NovintFalcon.h
 
8
// author:      Axel Kohlmeyer akohlmey@gmail.com 2010-04-14
 
9
// copyright:   (C) 2010 Axel Kohlmeyer
 
10
// license:     Released to the Public Domain.
 
11
// depends:     libnifalcon-1.0.1, libusb-1.0, VRPN 07_26
 
12
// tested on:   Linux x86_64 w/ gcc 4.4.1
 
13
 
 
14
#ifndef __TRACKER_NOVINTFALCON_H
 
15
#define __TRACKER_NOVINTFALCON_H
 
16
 
 
17
#include "vrpn_Configure.h"
 
18
 
 
19
#if defined(VRPN_USE_LIBNIFALCON)
 
20
 
 
21
#include "vrpn_Tracker.h"
 
22
#include "vrpn_Button.h"
 
23
#include "vrpn_ForceDevice.h"
 
24
 
 
25
// Forward declaration for proxy class that wraps
 
26
// the device management of the falcon.
 
27
class vrpn_NovintFalcon_Device;
 
28
 
 
29
// Forward declaration for proxy class that maintains
 
30
// the list of objects that contribute to the force.
 
31
class vrpn_NovintFalcon_ForceObjects;
 
32
 
 
33
class VRPN_API vrpn_Tracker_NovintFalcon
 
34
    : public vrpn_Tracker, public vrpn_Button, public vrpn_ForceDevice {
 
35
 
 
36
public:
 
37
    /// custom constructor
 
38
    vrpn_Tracker_NovintFalcon(const char *name,
 
39
                              vrpn_Connection *c = NULL,
 
40
                              const int devidx = 0,
 
41
                              const char *grip = NULL,
 
42
                              const char *kine = NULL,
 
43
                              const char *damp = NULL);
 
44
 
 
45
    /// destructor
 
46
    ~vrpn_Tracker_NovintFalcon();
 
47
 
 
48
    /// Called once through each main loop iteration to handle updates.
 
49
    virtual void mainloop();
 
50
 
 
51
protected: // methods for tracker and button functionality
 
52
    virtual void reset();
 
53
    virtual int get_report(void);
 
54
    virtual void send_report(void);
 
55
    virtual void clear_values(void);
 
56
 
 
57
protected: // methods for force feedback functionality
 
58
    /// apply forces from known objects
 
59
    virtual void handle_forces(void);
 
60
public:
 
61
    /// apply received information about force field effects.
 
62
    virtual int  update_forcefield_effect(vrpn_HANDLERPARAM p);
 
63
protected:
 
64
    int m_devflags;                         //< device configuration flags
 
65
    vrpn_float64 m_update_rate;             //< update rate of device
 
66
    vrpn_float64 m_damp;                    //< damping factor for force updates
 
67
    struct timeval m_timestamp;             //< last update of device status
 
68
    vrpn_NovintFalcon_Device *m_dev;        //< device handle
 
69
    vrpn_NovintFalcon_ForceObjects *m_obj;  //< handle to force generating objects
 
70
};
 
71
 
 
72
#endif /* defined(VRPN_USE_LIBNIFALCON) */
 
73
#endif