Hi Sahil, I’m also playing around with the herelink to develop a custom app. This is my first go at Android (Kotlin using Android Studio), and wanted to see if I could interact with the Herelink’s peripherals before investing time to learn android app development. With some research and ‘luck’ I managed to interact with the joystick and buttons (except the power button) in my custom app using these methods:
Libraries:
import android.util.Log
import android.view.KeyEvent
import android.view.MotionEvent
import android.widget.Toast
Joystick:
override fun onGenericMotionEvent(event: MotionEvent) : Boolean {
var joystick_2X = event.getAxisValue(MotionEvent.AXIS_X)
var joystick_2Y = event.getAxisValue(MotionEvent.AXIS_Y)
var joystick_1X = event.getAxisValue(MotionEvent.AXIS_Z)
var joystick_1Y = event.getAxisValue(MotionEvent.AXIS_RZ)
var joystick_wheel = event.getAxisValue(MotionEvent.AXIS_WHEEL)
Log.d("joystick_1X : ", joystick_1X.toString())
Log.d("joystick_1Y : ", joystick_1Y.toString())
Log.d("joystick_2X : ", joystick_2X.toString())
Log.d("joystick_2Y : ", joystick_2Y.toString())
Log.d("joystick_wheel : ", joystick_wheel.toString())
return super.onGenericMotionEvent(event);
}
Buttons:
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
Toast.makeText(this, "Key dispatch : " + event.keyCode.toString(), Toast.LENGTH_SHORT).show()
return super.dispatchKeyEvent(event)
}
The keycode for each button is shown as an alert in the app as you press the buttons.
Hope this helps.
If you manage to use the telemetry within your custom app, please let me know how.