-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPalmRejection.h
executable file
·74 lines (60 loc) · 1.7 KB
/
PalmRejection.h
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
/*
* File: PalmRejection.h
* Author: greg
*
* Created on May 23, 2012, 12:39 PM
*/
#ifndef PALMREJECTION_H
#define PALMREJECTION_H
#include "Point.h"
//#include "QThread"
#include <pthread.h>
#include <iostream>
#include <vector>
#include "ScreenInterpreter.h"
#include <queue>
#include "ScreenAreas.h"
//#include <QWidget>
//#include "QTimer"
#include <boost/asio.hpp>
#include <boost/bind.hpp>
///////////////////////////
class PalmRejection
{
public:
PalmRejection(ScreenInterpreter* s);
virtual ~PalmRejection();
void eventTouch(std::queue<Point* > *mPointsQueue);
void eventMove(std::queue<Point* > *mPointsQueue);
void eventRelease(/*Points *point*/);
private:
void resetPalm(const boost::system::error_code &ec);
int mod(int, const int x = ANALYZE_BUFFER);
int abs(int);
float sqrt(int x);
void analyzeNewSetOfPoints(); //this is done to reject possible "duplicates" of points caused on area edges
void findPen_old(); //Find the pen, not necessarily there
void findPen();
void findNextPoint();
void updatePalmMatrix(ushort slot, ushort ignore = -1);
void updatePosition();
void flushPointBuffer();
bool firstTryFindingPenAndPalm();
void compact_pointToAnalyze();
float getDistance(int, int);
ScreenInterpreter* interpreter;
bool stopRequest;
ushort position;
std::vector <std::vector < Point *> > pointToAnalyze;
std::vector <Point *> possiblePenPoints;
ushort sampling;
bool penPresent;
ScreenAreas mPalm;
ScreenAreas mPen;
boost::asio::deadline_timer* palmResetTimer;
boost::asio::io_service io_service;
//used as reference points
int mX;
int mY;
};
#endif /* PALMREJECTION_H */