mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-11 10:26:22 +00:00
Implement controller LED and battery state extensions
This commit is contained in:
@@ -571,6 +571,10 @@ public class NvConnection {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendControllerBatteryEvent(byte controllerNumber, byte batteryState, byte batteryPercentage) {
|
||||
MoonBridge.sendControllerBatteryEvent(controllerNumber, batteryState, batteryPercentage);
|
||||
}
|
||||
|
||||
public void sendUtf8Text(final String text) {
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendUtf8Text(text);
|
||||
|
||||
@@ -18,4 +18,6 @@ public interface NvConnectionListener {
|
||||
void setHdrMode(boolean enabled, byte[] hdrMetadata);
|
||||
|
||||
void setMotionEventState(short controllerNumber, byte motionType, short reportRateHz);
|
||||
|
||||
void setControllerLED(short controllerNumber, byte r, byte g, byte b);
|
||||
}
|
||||
|
||||
@@ -107,10 +107,21 @@ public class MoonBridge {
|
||||
public static final short LI_CCAP_TOUCHPAD = 0x08;
|
||||
public static final short LI_CCAP_ACCEL = 0x10;
|
||||
public static final short LI_CCAP_GYRO = 0x20;
|
||||
public static final short LI_CCAP_BATTERY_STATE = 0x40;
|
||||
public static final short LI_CCAP_RGB_LED = 0x80;
|
||||
|
||||
public static final byte LI_MOTION_TYPE_ACCEL = 0x01;
|
||||
public static final byte LI_MOTION_TYPE_GYRO = 0x02;
|
||||
|
||||
public static final byte LI_BATTERY_STATE_UNKNOWN = 0x00;
|
||||
public static final byte LI_BATTERY_STATE_NOT_PRESENT = 0x01;
|
||||
public static final byte LI_BATTERY_STATE_DISCHARGING = 0x02;
|
||||
public static final byte LI_BATTERY_STATE_CHARGING = 0x03;
|
||||
public static final byte LI_BATTERY_STATE_NOT_CHARGING = 0x04; // Connected to power but not charging
|
||||
public static final byte LI_BATTERY_STATE_FULL = 0x05;
|
||||
|
||||
public static final byte LI_BATTERY_PERCENTAGE_UNKNOWN = (byte)0xFF;
|
||||
|
||||
private static AudioRenderer audioRenderer;
|
||||
private static VideoDecoderRenderer videoRenderer;
|
||||
private static NvConnectionListener connectionListener;
|
||||
@@ -307,6 +318,12 @@ public class MoonBridge {
|
||||
}
|
||||
}
|
||||
|
||||
public static void bridgeClSetControllerLED(short controllerNumber, byte r, byte g, byte b) {
|
||||
if (connectionListener != null) {
|
||||
connectionListener.setControllerLED(controllerNumber, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupBridge(VideoDecoderRenderer videoRenderer, AudioRenderer audioRenderer, NvConnectionListener connectionListener) {
|
||||
MoonBridge.videoRenderer = videoRenderer;
|
||||
MoonBridge.audioRenderer = audioRenderer;
|
||||
@@ -361,6 +378,8 @@ public class MoonBridge {
|
||||
|
||||
public static native int sendControllerMotionEvent(byte controllerNumber, byte motionType, float x, float y, float z);
|
||||
|
||||
public static native int sendControllerBatteryEvent(byte controllerNumber, byte batteryState, byte batteryPercentage);
|
||||
|
||||
public static native void sendKeyboardInput(short keyMap, byte keyDirection, byte modifier, byte flags);
|
||||
|
||||
public static native void sendMouseHighResScroll(short scrollAmount);
|
||||
|
||||
Reference in New Issue
Block a user