vrpn
07.35
Virtual Reality Peripheral Network
Toggle main menu visibility
Loading...
Searching...
No Matches
vrpn_Android.h
Go to the documentation of this file.
1
#ifndef VRPN_ANDROID_H
2
#define VRPN_ANDROID_H
3
4
#include <jni.h>
5
#include <stdlib.h>
6
#include <stdio.h>
7
#include <signal.h>
8
#include <string>
9
#include <string.h>
10
11
#include "
vrpn_Types.h
"
12
13
#ifndef VRPN_BUTTON_H
14
#include "
vrpn_Button.h
"
15
#define VRPN_BUTTON_H
16
#endif
17
18
#ifndef VRPN_ANALOG_H
19
#include "
vrpn_Analog.h
"
20
#define VRPN_ANALOG_H
21
#endif
22
23
/*
24
* This is an Android server implementation. It has as members a vrpn_Button_Server
25
* and some number of vrpn_Analog_Servers, as determined by the Java side. This
26
* implementation also has vrpn_Button_Remote and vrpn_Analog_Remote clients for
27
* the sole purpose of testing. All data from the Android is represented here
28
* as either Analogs or Buttons.
29
*
30
* All interaction between this class and the Java side are handled by the jni layer.
31
*
32
* It's worth noting that it is possible to pipe stdout to the Android log - directions
33
* for doing so are in the manual for this project - and all output is in the form of:
34
* fprintf(stderr, "..."), which we've found to be more reliable than other methods,
35
* including fprintf(stdout, "...").
36
*/
37
38
39
class
vrpn_Android_Server
40
{
41
public
:
42
44
vrpn_Android_Server
(vrpn_int32 num_analogs, vrpn_int32 * analog_sizes, vrpn_int32 num_buttons, vrpn_int32 port);
45
47
~vrpn_Android_Server
();
48
50
void
mainloop
();
51
53
void
set_analog
(vrpn_int32 analog_id, vrpn_int32 channel, vrpn_float64 val);
54
56
void
set_button
(vrpn_int32 button_id, vrpn_int32 state);
57
59
void
report_analog_chg
(vrpn_int32 analog_id);
60
61
private
:
62
64
void
initialize(vrpn_int32 num_analogs, vrpn_int32 * analog_sizes, vrpn_int32 num_buttons);
65
66
// Names of the member servers. Only used by the local clients
67
const
char
* ANALOG_SERVER_NAME;
// with no id number; those are formed automatically
68
const
char
* BUTTON_SERVER_NAME;
// uses id 0, since there is only one button server
69
70
vrpn_int32 num_analogs;
// Number of vrpn_Analog_Servers
71
vrpn_int32 * analog_sizes;
// Array of numbers of channels in the analog servers
72
73
vrpn_Analog_Server
** analog_server;
// handles multi-touch x and y as well as any sliders, dials, etc
74
vrpn_Button_Server
* button_server;
75
76
vrpn_Analog_Remote
** analog_client;
77
vrpn_Button_Remote
* button_client;
78
79
vrpn_Connection
* connection;
80
81
vrpn_int32 port;
82
};
83
84
#endif
vrpn_Analog_Remote
Definition
vrpn_Analog.h:181
vrpn_Analog_Server
Definition
vrpn_Analog.h:95
vrpn_Android_Server::mainloop
void mainloop()
Main loop to be called at every time step. Calls the mainloop() functions of the member servers.
Definition
vrpn_Android.C:82
vrpn_Android_Server::set_analog
void set_analog(vrpn_int32 analog_id, vrpn_int32 channel, vrpn_float64 val)
Set the value for the given channel of the given vrpn_Analog_Server.
Definition
vrpn_Android.C:99
vrpn_Android_Server::vrpn_Android_Server
vrpn_Android_Server(vrpn_int32 num_analogs, vrpn_int32 *analog_sizes, vrpn_int32 num_buttons, vrpn_int32 port)
Constructor. Takes an array of integers representing the number of channels for each analog server,...
Definition
vrpn_Android.C:26
vrpn_Android_Server::report_analog_chg
void report_analog_chg(vrpn_int32 analog_id)
Called when changes are made to any of the analog values.
Definition
vrpn_Android.C:105
vrpn_Android_Server::set_button
void set_button(vrpn_int32 button_id, vrpn_int32 state)
Set the value for the given button.
Definition
vrpn_Android.C:94
vrpn_Android_Server::~vrpn_Android_Server
~vrpn_Android_Server()
Destructor.
Definition
vrpn_Android.C:110
vrpn_Button_Remote
Definition
vrpn_Button.h:251
vrpn_Button_Server
Definition
vrpn_Button.h:99
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition
vrpn_Connection.h:561
vrpn_Analog.h
vrpn_Button.h
vrpn_Types.h
vrpn_Android.h
Generated by
1.17.0