|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eu.ensam.ii.vrpn.VrpnClient
public class VrpnClient
Send updates button, analog and tracker updates to the JsonNet Vrpn server.
A application that uses the Vrpn widgets must initialize the unique instance
of this class by calling setUri
before the
widgets are used.
This class is not thread-safe. The methods sendButton
and
sendAnalog
must be called from the main UI thread
Currently the messages neither include a timestamp nor a sequence number
TODO Add timestamps and sequence numbers Add a method to allow sending TODO tracker updates from the widgets
Method Summary | |
---|---|
void |
enableTiltTracker(boolean enable)
Enables or disable the tilt tracker. |
static VrpnClient |
getInstance()
Returns the unique VrpnClient instance |
void |
onAccuracyChanged(Sensor sensor,
int accuracy)
Called by the system when the sensor accuracy changes This method is empty and should not be called by widgets |
void |
onSensorChanged(SensorEvent event)
Called by the system when a sensor data changes. |
void |
sendAnalog(int channelId,
double channelValue)
Send an update to a Vrpn Analog channel. |
void |
sendButton(int buttonId,
boolean buttonState)
Send an update to a Vrpn Button. |
void |
setupVrpnServer(InetAddress hostAddress,
int port)
Initializes the address and port of the VRPN server. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static VrpnClient getInstance()
public void setupVrpnServer(InetAddress hostAddress, int port)
This method must be called before sending any update to the server.
Note that the widgets trigger updates when they they are displayed for the first time. So this method must be called before callingsetContentView
in the
main activity
setContentView
onCreate
method
host
- a string that is a valid host name or IP addressport
- the port number of the VRPN serverpublic void sendButton(int buttonId, boolean buttonState)
buttonId
- the button number. Invalid button numbers are ignored on this
side, but may trigger an error message on the Vrpn serverbuttonState
- the new status of the buttonpublic void sendAnalog(int channelId, double channelValue)
channelId
- The channel number. Invalid channel numbers are ignored on
this side but, they may trigger an error message on the Vrpn
serverchannelValue
- the data that will be sent on the analog channelpublic void enableTiltTracker(boolean enable)
SensorEvent
for a description of the
device coordinate system. This quaternion can be used to retrieve the
roll and pitch of the device.
enable
- true
enables the tilt tracker updates and
false
disable the tilt tracker updatespublic void onAccuracyChanged(Sensor sensor, int accuracy)
public void onSensorChanged(SensorEvent event)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |