TouchCPLib
1.0.0
A touch-enabled GUI interface based on SDL and libTS. It provides a simple desktop-free UI for your embedded Raspberry projects.
TouchInput.h
Go to the documentation of this file.
1
#pragma once
2
13
#include <string>
14
#include <tslib.h>
15
#include <vector>
16
#include <functional>
17
18
#include "
TouchInputException.h
"
19
20
#define TS_SETENV(x) setenv(#x, x, false);
21
22
using
TouchEventCallback
= std::function<void(ts_sample_mt)>;
// void(*)(ts_sample_mt);
23
27
class
TouchInput
28
{
29
public
:
37
TouchInput
(
const
std::string &device_name,
TouchEventCallback
callback,
int
samples,
int
slots);
38
~TouchInput
();
39
void
setTouchEventCallback
(
TouchEventCallback
callback);
40
void
poll
();
41
42
private
:
43
std::string device_name;
44
struct
tsdev *ts;
45
ts_sample_mt **samp_mt;
46
int
samples, slots, ret;
47
TouchEventCallback
event_callback;
48
49
const
char
*TSLIB_CALIBFILE =
"/etc/pointercal.tslib"
;
50
const
char
*TSLIB_CONFFILE =
"/etc/ts.conf"
;
51
const
char
*TSLIB_TSDEVICE =
"/dev/input/event0"
;
52
};
TouchInput::TouchInput
TouchInput(const std::string &device_name, TouchEventCallback callback, int samples, int slots)
Creates an instance of TouchInput.
Definition:
TouchInput.cpp:3
TouchInputException.h
TouchInput::setTouchEventCallback
void setTouchEventCallback(TouchEventCallback callback)
Definition:
TouchInput.cpp:39
TouchInput
Object that gathers the touch events from the underlying device.
Definition:
TouchInput.h:27
TouchInput::poll
void poll()
Definition:
TouchInput.cpp:44
TouchEventCallback
std::function< void(ts_sample_mt)> TouchEventCallback
Definition:
TouchInput.h:22
TouchInput::~TouchInput
~TouchInput()
Definition:
TouchInput.cpp:24
include
TouchCP
TouchInput.h
Generated by
1.8.13