File: pad.h

package info (click to toggle)
libsynaptics 0.14.6b-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,116 kB
  • ctags: 194
  • sloc: sh: 8,570; cpp: 701; makefile: 13
file content (145 lines) | stat: -rw-r--r-- 4,577 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef PAD_H
#define PAD_H


#include "synshm.h"
#include "synaptics.h"

namespace Synaptics
{
    class Pad
    {
    public:
        ~Pad();

        // is pad hardware present?
        // receive: whether a touch pad is present
        // TODO implement me (I don't know if it's even possible!)
        static bool hasHardware();

        // is a driver present?
        // receive: whether a usable driver has been detected
        static bool hasDriver();

        // is shared memory accessible?
        // receive: whether shared memory access is possible
        static bool hasShm();

        // returns kind of detected driver
        // receive: kind of detected driver
        static DriverVersion driverKind();

        // returns version number string of detected driver
        // receive: version number string of detected driver
        static std::string driverStr();

        // returns version number string of used library
        static std::string libraryStr();

        // returns version number ( 10000 * major + 100 * minor + 1 * rev )
        // receive: version number ( 10000 * major + 100 * minor + 1 * rev )
        static int driverVersion();

        // returns pad type
        // receive: pad type
        // TODO implement me ( I don't know if it's even possible!)
        static PadType getPadType();

        // returns whether a given parameter is available
        // give: parameter name
        // receive: whether the parameter is available
        static bool hasParam( std::string );

        // returns a given parameter, if the parameter is not available returns 0
        // give: name of parameter
        // receive: given parameter value, if it doesn't exist 0
        static double getParam( std::string );

        // sets a given parameter if available
        // give: a parameter's name and the correspondent value
        static void setParam( std::string, double ); 

        // gets max value of a parameter
        // give: name of parameter
        // receive: max value
        static double getParamMax( std::string );

        // gets min value of a parameter
        // give: name of parameter
        // receive: min value
        static double getParamMin( std::string );

        // gets type of a parameter
        // give: name of parameter
        // receive: type of parameter - PT_VOID if no parameter at all!
        static Synaptics::ParamType getParamType( std::string );

        // returns a string list containing all available parameters
        // receive: string list containing all available parameters
        static std::list<std::string> getAvailableParams();

        //
        // the following procedures are only neccessary for old versions
        //


        // is the system capable of running synclient?
        // receive: whether synclient is runnable
        // TODO: implement me
        static bool hasSynClient();

        // is the system capable of running syndaemon?
        // receive: whether syndaemon is runnable
        // TODO implement me
        static bool hasSynDaemon();

        // is syndaemon being run?
        // receive: whether syndaemon is being run
        // TODO implement me
        static bool isSynDaemonRunning();
        static bool killSynDaemonProcesses();

    protected:
        Pad();

        static Synaptics::Pad *mSelf;

        // this is a workaround for the missing constructor functionality in static classes
        static void INIT();

        // this is a workaround for the missing destructor functionality in static classes
        static void CLOSE();

        //   NOTE to make this class abstract
        //   NOTE must be implemented in "Pad"-class
        virtual void registerParameters();

        // detect driver version by reading "version" member from the SHM
        // receive: whether a driver could be detected
        static bool detectDriverVersion();

        // create a version string from an integer value
        // give: version (integer value)
        // receive: version string, if no driver is present it returns "None"
        static std::string intVerToStrVer( int );


        // whether shm access is possible
        static bool mHasShm;

        // store type of detected driver version
        static DriverVersion mDetectedDriver;


        static ::SynShm* mSynShm;

        typedef std::map<std::string, Synaptics::Param> Parameter;

        static std::map<std::string, Parameter> mSupportedDriver;
        static std::list<std::string> mSupportedDriverList;

    private:
    };
}

#endif