commit | author | age
|
8c7455
|
1 |
// PingPong.h |
JS |
2 |
|
|
3 |
|
|
4 |
/* |
|
5 |
Polhemus Tracker Terminal version 1.0.0 -- Terminal Interface to Polhemus Trackers: Fastrak, Patriot, and Liberty |
|
6 |
Copyright © 2009 Polhemus, Inc. |
|
7 |
|
|
8 |
This file is part of Tracker Terminal. |
|
9 |
|
|
10 |
Tracker Terminal is free software: you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation, either version 3 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Tracker Terminal is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Tracker Terminal. If not, see <http://www.gnu.org/licenses/>. |
|
22 |
|
|
23 |
************************************************************************* |
|
24 |
|
|
25 |
Tracker Terminal version 1.0.0 uses the libusb library version 1.0 |
|
26 |
libusb Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org> |
|
27 |
libusb Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com> |
|
28 |
Licensed under the GNU Lesser General Public License version 2.1 or later. |
|
29 |
*/ |
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
#ifndef PINGPONG_H_ |
|
34 |
#define PINGPONG_H_ |
|
35 |
|
|
36 |
#define NUMBUFS 100 |
|
37 |
#define BYTE unsigned char |
|
38 |
|
|
39 |
class PingPong { |
|
40 |
|
|
41 |
private: |
|
42 |
|
|
43 |
BYTE* m_buf[NUMBUFS]; |
|
44 |
int m_readInd; |
|
45 |
int m_writeInd; |
|
46 |
int m_size; |
|
47 |
int m_len[NUMBUFS]; |
|
48 |
pthread_mutex_t m_mutex; |
|
49 |
|
|
50 |
void IncrInd(int& ind); |
|
51 |
|
|
52 |
public: |
|
53 |
|
|
54 |
PingPong(); |
|
55 |
~PingPong(); |
|
56 |
|
|
57 |
int InitPingPong(int); |
|
58 |
int GetBufferSize(); |
|
59 |
int IsDataAvail(); |
|
60 |
int ReadPP(BYTE*); |
|
61 |
int WritePP(BYTE*,int); |
|
62 |
void ClearBuffers(); |
|
63 |
}; |
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
#endif |