vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_Tracker_JsonNet.h
Go to the documentation of this file.
1#ifndef VRPN_TRACKER_JSONNET
2#define VRPN_TRACKER_JSONNET
3
4#include "vrpn_Configure.h"
5
6#if defined(VRPN_USE_JSONNET)
7
8#include "vrpn_Analog.h"
9#include "vrpn_Button.h"
10#include "vrpn_Tracker.h"
11#include "vrpn_Text.h"
12
13namespace Json {
14 class Reader;
15 class Value;
16}
17
27class vrpn_Tracker_JsonNet :
28 public vrpn_Tracker, public vrpn_Button_Filter, public vrpn_Analog, public vrpn_Text_Sender
29{
30public:
31 vrpn_Tracker_JsonNet(
32 const char* name,
34 int udpPort
35 );
36 ~vrpn_Tracker_JsonNet(void);
37
38 void mainloop();
39
40 enum {
41 TILT_TRACKER_ID = 0,
42 };
43
44
45private:
46 /*
47 * Network part
48 */
49 bool _network_init(int udp_port);
50 int _network_receive(void *buffer, int maxlen, int tout_us);
51 void _network_release();
52#ifdef _WIN32
53 typedef SOCKET socket_type;
54#else
55 typedef int socket_type;
56#endif
57 socket_type _socket;
58 enum {
59 _NETWORK_BUFFER_SIZE = 2000,
60
61 };
62 char _network_buffer[_NETWORK_BUFFER_SIZE];
63
64 /*
65 * Json part
66 */
67 bool _parse(const char* buffer, int length);
68 bool _parse_tracker_data(const Json::Value& root);
69 bool _parse_analog(const Json::Value& root);
70 bool _parse_button(const Json::Value& root);
71 bool _parse_text(const Json::Value& root);
72 bool _do_tracker_report;
73 Json::Reader* _pJsonReader;
74};
75
76#endif // ifdef JSONNET
77#endif
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition: vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
Allows a user to send text messages from a device (usually,.
Definition: vrpn_Text.h:40
#define SOCKET
Definition: vrpn_Shared.h:52