RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Android.h
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
40{
41public:
42
44 vrpn_Android_Server(vrpn_int32 num_analogs, vrpn_int32 * analog_sizes, vrpn_int32 num_buttons, vrpn_int32 port);
45
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
61private:
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.h:181
定义 vrpn_Analog.h:95
定义 vrpn_Android.h:40
~vrpn_Android_Server()
Destructor.
void report_analog_chg(vrpn_int32 analog_id)
Called when changes are made to any of the analog values
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,...
void set_button(vrpn_int32 button_id, vrpn_int32 state)
Set the value for the given button
void mainloop()
Main loop to be called at every time step. Calls the mainloop() functions of the member servers.
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
定义 vrpn_Button.h:251
定义 vrpn_Button.h:99
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562