Loading media/java/android/media/tv/tuner/Tuner.java +77 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,10 @@ import android.media.tv.tuner.TunerConstants.DemuxPidType; import android.media.tv.tuner.TunerConstants.FilterSubtype; import android.media.tv.tuner.TunerConstants.FilterType; import android.media.tv.tuner.TunerConstants.FrontendScanType; import android.media.tv.tuner.TunerConstants.LnbPosition; import android.media.tv.tuner.TunerConstants.LnbTone; import android.media.tv.tuner.TunerConstants.LnbVoltage; import android.media.tv.tuner.TunerConstants.Result; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -144,6 +148,15 @@ public final class Tuner implements AutoCloseable { * Invoked when there is a LNB event. */ void onEvent(int lnbEventType); /** * Invoked when there is a new DiSEqC message. * * @param diseqcMessage a byte array of data for DiSEqC (Digital Satellite * Equipment Control) message which is specified by EUTELSAT Bus Functional * Specification Version 4.2. */ void onDiseqcMessage(byte[] diseqcMessage); } /** Loading Loading @@ -486,6 +499,12 @@ public final class Tuner implements AutoCloseable { private int mId; private LnbCallback mCallback; private native int nativeSetVoltage(int voltage); private native int nativeSetTone(int tone); private native int nativeSetSatellitePosition(int position); private native int nativeSendDiseqcMessage(byte[] message); private native int nativeClose(); private Lnb(int id) { mId = id; } Loading @@ -499,6 +518,64 @@ public final class Tuner implements AutoCloseable { mHandler = createEventHandler(); } } /** * Sets the LNB's power voltage. * * @param voltage the power voltage the Lnb to use. * @return result status of the operation. */ @Result public int setVoltage(@LnbVoltage int voltage) { return nativeSetVoltage(voltage); } /** * Sets the LNB's tone mode. * * @param tone the tone mode the Lnb to use. * @return result status of the operation. */ @Result public int setTone(@LnbTone int tone) { return nativeSetTone(tone); } /** * Selects the LNB's position. * * @param position the position the Lnb to use. * @return result status of the operation. */ @Result public int setSatellitePosition(@LnbPosition int position) { return nativeSetSatellitePosition(position); } /** * Sends DiSEqC (Digital Satellite Equipment Control) message. * * The response message from the device comes back through callback onDiseqcMessage. * * @param message a byte array of data for DiSEqC message which is specified by EUTELSAT Bus * Functional Specification Version 4.2. * * @return result status of the operation. */ @Result public int sendDiseqcMessage(byte[] message) { return nativeSendDiseqcMessage(message); } /** * Releases the LNB instance * * @return result status of the operation. */ @Result public int close() { return nativeClose(); } } private List<Integer> getLnbIds() { Loading media/java/android/media/tv/tuner/TunerConstants.java +32 −15 Original line number Diff line number Diff line Loading @@ -536,21 +536,6 @@ final class TunerConstants { public static final int SPECTRAL_INVERSION_INVERTED = Constants.FrontendDvbcSpectralInversion.INVERTED; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_VOLTAGE_NONE, LNB_VOLTAGE_VOLTAGE_5V, LNB_VOLTAGE_VOLTAGE_11V, LNB_VOLTAGE_VOLTAGE_12V, LNB_VOLTAGE_VOLTAGE_13V, LNB_VOLTAGE_VOLTAGE_14V, LNB_VOLTAGE_VOLTAGE_15V, LNB_VOLTAGE_VOLTAGE_18V}) public @interface LnbVoltage {} public static final int LNB_VOLTAGE_NONE = Constants.LnbVoltage.NONE; public static final int LNB_VOLTAGE_VOLTAGE_5V = Constants.LnbVoltage.VOLTAGE_5V; public static final int LNB_VOLTAGE_VOLTAGE_11V = Constants.LnbVoltage.VOLTAGE_11V; public static final int LNB_VOLTAGE_VOLTAGE_12V = Constants.LnbVoltage.VOLTAGE_12V; public static final int LNB_VOLTAGE_VOLTAGE_13V = Constants.LnbVoltage.VOLTAGE_13V; public static final int LNB_VOLTAGE_VOLTAGE_14V = Constants.LnbVoltage.VOLTAGE_14V; public static final int LNB_VOLTAGE_VOLTAGE_15V = Constants.LnbVoltage.VOLTAGE_15V; public static final int LNB_VOLTAGE_VOLTAGE_18V = Constants.LnbVoltage.VOLTAGE_18V; @Retention(RetentionPolicy.SOURCE) @IntDef({HIERARCHY_UNDEFINED, HIERARCHY_AUTO, HIERARCHY_NON_NATIVE, HIERARCHY_1_NATIVE, Loading Loading @@ -593,6 +578,38 @@ final class TunerConstants { public static final int DVR_SETTINGS_RECORD = Constants.DvrType.RECORD; public static final int DVR_SETTINGS_PLAYBACK = Constants.DvrType.PLAYBACK; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_VOLTAGE_NONE, LNB_VOLTAGE_5V, LNB_VOLTAGE_11V, LNB_VOLTAGE_12V, LNB_VOLTAGE_13V, LNB_VOLTAGE_14V, LNB_VOLTAGE_15V, LNB_VOLTAGE_18V, LNB_VOLTAGE_19V}) public @interface LnbVoltage {} public static final int LNB_VOLTAGE_NONE = Constants.LnbVoltage.NONE; public static final int LNB_VOLTAGE_5V = Constants.LnbVoltage.VOLTAGE_5V; public static final int LNB_VOLTAGE_11V = Constants.LnbVoltage.VOLTAGE_11V; public static final int LNB_VOLTAGE_12V = Constants.LnbVoltage.VOLTAGE_12V; public static final int LNB_VOLTAGE_13V = Constants.LnbVoltage.VOLTAGE_13V; public static final int LNB_VOLTAGE_14V = Constants.LnbVoltage.VOLTAGE_14V; public static final int LNB_VOLTAGE_15V = Constants.LnbVoltage.VOLTAGE_15V; public static final int LNB_VOLTAGE_18V = Constants.LnbVoltage.VOLTAGE_18V; public static final int LNB_VOLTAGE_19V = Constants.LnbVoltage.VOLTAGE_19V; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_TONE_NONE, LNB_TONE_CONTINUOUS}) public @interface LnbTone {} public static final int LNB_TONE_NONE = Constants.LnbTone.NONE; public static final int LNB_TONE_CONTINUOUS = Constants.LnbTone.CONTINUOUS; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_POSITION_UNDEFINED, LNB_POSITION_A, LNB_POSITION_B}) public @interface LnbPosition {} public static final int LNB_POSITION_UNDEFINED = Constants.LnbPosition.UNDEFINED; public static final int LNB_POSITION_A = Constants.LnbPosition.POSITION_A; public static final int LNB_POSITION_B = Constants.LnbPosition.POSITION_B; @Retention(RetentionPolicy.SOURCE) @IntDef({RESULT_SUCCESS, RESULT_UNAVAILABLE, RESULT_NOT_INITIALIZED, RESULT_INVALID_STATE, RESULT_INVALID_ARGUMENT, RESULT_OUT_OF_MEMORY, RESULT_UNKNOWN_ERROR}) Loading media/jni/android_media_tv_Tuner.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,26 @@ static int android_media_tv_Tuner_close_dvr(JNIEnv*, jobject) { return 0; } static int android_media_tv_Tuner_lnb_set_voltage(JNIEnv*, jobject, jint) { return 0; } static int android_media_tv_Tuner_lnb_set_tone(JNIEnv*, jobject, jint) { return 0; } static int android_media_tv_Tuner_lnb_set_position(JNIEnv*, jobject, jint) { return 0; } static int android_media_tv_Tuner_lnb_send_diseqc_msg(JNIEnv*, jobject, jbyteArray) { return 0; } static int android_media_tv_Tuner_close_lnb(JNIEnv*, jobject) { return 0; } static const JNINativeMethod gTunerMethods[] = { { "nativeInit", "()V", (void *)android_media_tv_Tuner_native_init }, { "nativeSetup", "()V", (void *)android_media_tv_Tuner_native_setup }, Loading Loading @@ -971,6 +991,14 @@ static const JNINativeMethod gDvrMethods[] = { { "nativeClose", "()I", (void *)android_media_tv_Tuner_close_dvr }, }; static const JNINativeMethod gLnbMethods[] = { { "nativeSetVoltage", "(I)I", (void *)android_media_tv_Tuner_lnb_set_voltage }, { "nativeSetTone", "(I)I", (void *)android_media_tv_Tuner_lnb_set_tone }, { "nativeSetSatellitePosition", "(I)I", (void *)android_media_tv_Tuner_lnb_set_position }, { "nativeSendDiseqcMessage", "([B)I", (void *)android_media_tv_Tuner_lnb_send_diseqc_msg }, { "nativeClose", "()I", (void *)android_media_tv_Tuner_close_lnb }, }; static bool register_android_media_tv_Tuner(JNIEnv *env) { if (AndroidRuntime::registerNativeMethods( env, "android/media/tv/tuner/Tuner", gTunerMethods, NELEM(gTunerMethods)) != JNI_OK) { Loading Loading @@ -998,6 +1026,13 @@ static bool register_android_media_tv_Tuner(JNIEnv *env) { ALOGE("Failed to register dvr native methods"); return false; } if (AndroidRuntime::registerNativeMethods( env, "android/media/tv/tuner/Tuner$Lnb", gLnbMethods, NELEM(gLnbMethods)) != JNI_OK) { ALOGE("Failed to register lnb native methods"); return false; } return true; } Loading Loading
media/java/android/media/tv/tuner/Tuner.java +77 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,10 @@ import android.media.tv.tuner.TunerConstants.DemuxPidType; import android.media.tv.tuner.TunerConstants.FilterSubtype; import android.media.tv.tuner.TunerConstants.FilterType; import android.media.tv.tuner.TunerConstants.FrontendScanType; import android.media.tv.tuner.TunerConstants.LnbPosition; import android.media.tv.tuner.TunerConstants.LnbTone; import android.media.tv.tuner.TunerConstants.LnbVoltage; import android.media.tv.tuner.TunerConstants.Result; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -144,6 +148,15 @@ public final class Tuner implements AutoCloseable { * Invoked when there is a LNB event. */ void onEvent(int lnbEventType); /** * Invoked when there is a new DiSEqC message. * * @param diseqcMessage a byte array of data for DiSEqC (Digital Satellite * Equipment Control) message which is specified by EUTELSAT Bus Functional * Specification Version 4.2. */ void onDiseqcMessage(byte[] diseqcMessage); } /** Loading Loading @@ -486,6 +499,12 @@ public final class Tuner implements AutoCloseable { private int mId; private LnbCallback mCallback; private native int nativeSetVoltage(int voltage); private native int nativeSetTone(int tone); private native int nativeSetSatellitePosition(int position); private native int nativeSendDiseqcMessage(byte[] message); private native int nativeClose(); private Lnb(int id) { mId = id; } Loading @@ -499,6 +518,64 @@ public final class Tuner implements AutoCloseable { mHandler = createEventHandler(); } } /** * Sets the LNB's power voltage. * * @param voltage the power voltage the Lnb to use. * @return result status of the operation. */ @Result public int setVoltage(@LnbVoltage int voltage) { return nativeSetVoltage(voltage); } /** * Sets the LNB's tone mode. * * @param tone the tone mode the Lnb to use. * @return result status of the operation. */ @Result public int setTone(@LnbTone int tone) { return nativeSetTone(tone); } /** * Selects the LNB's position. * * @param position the position the Lnb to use. * @return result status of the operation. */ @Result public int setSatellitePosition(@LnbPosition int position) { return nativeSetSatellitePosition(position); } /** * Sends DiSEqC (Digital Satellite Equipment Control) message. * * The response message from the device comes back through callback onDiseqcMessage. * * @param message a byte array of data for DiSEqC message which is specified by EUTELSAT Bus * Functional Specification Version 4.2. * * @return result status of the operation. */ @Result public int sendDiseqcMessage(byte[] message) { return nativeSendDiseqcMessage(message); } /** * Releases the LNB instance * * @return result status of the operation. */ @Result public int close() { return nativeClose(); } } private List<Integer> getLnbIds() { Loading
media/java/android/media/tv/tuner/TunerConstants.java +32 −15 Original line number Diff line number Diff line Loading @@ -536,21 +536,6 @@ final class TunerConstants { public static final int SPECTRAL_INVERSION_INVERTED = Constants.FrontendDvbcSpectralInversion.INVERTED; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_VOLTAGE_NONE, LNB_VOLTAGE_VOLTAGE_5V, LNB_VOLTAGE_VOLTAGE_11V, LNB_VOLTAGE_VOLTAGE_12V, LNB_VOLTAGE_VOLTAGE_13V, LNB_VOLTAGE_VOLTAGE_14V, LNB_VOLTAGE_VOLTAGE_15V, LNB_VOLTAGE_VOLTAGE_18V}) public @interface LnbVoltage {} public static final int LNB_VOLTAGE_NONE = Constants.LnbVoltage.NONE; public static final int LNB_VOLTAGE_VOLTAGE_5V = Constants.LnbVoltage.VOLTAGE_5V; public static final int LNB_VOLTAGE_VOLTAGE_11V = Constants.LnbVoltage.VOLTAGE_11V; public static final int LNB_VOLTAGE_VOLTAGE_12V = Constants.LnbVoltage.VOLTAGE_12V; public static final int LNB_VOLTAGE_VOLTAGE_13V = Constants.LnbVoltage.VOLTAGE_13V; public static final int LNB_VOLTAGE_VOLTAGE_14V = Constants.LnbVoltage.VOLTAGE_14V; public static final int LNB_VOLTAGE_VOLTAGE_15V = Constants.LnbVoltage.VOLTAGE_15V; public static final int LNB_VOLTAGE_VOLTAGE_18V = Constants.LnbVoltage.VOLTAGE_18V; @Retention(RetentionPolicy.SOURCE) @IntDef({HIERARCHY_UNDEFINED, HIERARCHY_AUTO, HIERARCHY_NON_NATIVE, HIERARCHY_1_NATIVE, Loading Loading @@ -593,6 +578,38 @@ final class TunerConstants { public static final int DVR_SETTINGS_RECORD = Constants.DvrType.RECORD; public static final int DVR_SETTINGS_PLAYBACK = Constants.DvrType.PLAYBACK; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_VOLTAGE_NONE, LNB_VOLTAGE_5V, LNB_VOLTAGE_11V, LNB_VOLTAGE_12V, LNB_VOLTAGE_13V, LNB_VOLTAGE_14V, LNB_VOLTAGE_15V, LNB_VOLTAGE_18V, LNB_VOLTAGE_19V}) public @interface LnbVoltage {} public static final int LNB_VOLTAGE_NONE = Constants.LnbVoltage.NONE; public static final int LNB_VOLTAGE_5V = Constants.LnbVoltage.VOLTAGE_5V; public static final int LNB_VOLTAGE_11V = Constants.LnbVoltage.VOLTAGE_11V; public static final int LNB_VOLTAGE_12V = Constants.LnbVoltage.VOLTAGE_12V; public static final int LNB_VOLTAGE_13V = Constants.LnbVoltage.VOLTAGE_13V; public static final int LNB_VOLTAGE_14V = Constants.LnbVoltage.VOLTAGE_14V; public static final int LNB_VOLTAGE_15V = Constants.LnbVoltage.VOLTAGE_15V; public static final int LNB_VOLTAGE_18V = Constants.LnbVoltage.VOLTAGE_18V; public static final int LNB_VOLTAGE_19V = Constants.LnbVoltage.VOLTAGE_19V; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_TONE_NONE, LNB_TONE_CONTINUOUS}) public @interface LnbTone {} public static final int LNB_TONE_NONE = Constants.LnbTone.NONE; public static final int LNB_TONE_CONTINUOUS = Constants.LnbTone.CONTINUOUS; @Retention(RetentionPolicy.SOURCE) @IntDef({LNB_POSITION_UNDEFINED, LNB_POSITION_A, LNB_POSITION_B}) public @interface LnbPosition {} public static final int LNB_POSITION_UNDEFINED = Constants.LnbPosition.UNDEFINED; public static final int LNB_POSITION_A = Constants.LnbPosition.POSITION_A; public static final int LNB_POSITION_B = Constants.LnbPosition.POSITION_B; @Retention(RetentionPolicy.SOURCE) @IntDef({RESULT_SUCCESS, RESULT_UNAVAILABLE, RESULT_NOT_INITIALIZED, RESULT_INVALID_STATE, RESULT_INVALID_ARGUMENT, RESULT_OUT_OF_MEMORY, RESULT_UNKNOWN_ERROR}) Loading
media/jni/android_media_tv_Tuner.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,26 @@ static int android_media_tv_Tuner_close_dvr(JNIEnv*, jobject) { return 0; } static int android_media_tv_Tuner_lnb_set_voltage(JNIEnv*, jobject, jint) { return 0; } static int android_media_tv_Tuner_lnb_set_tone(JNIEnv*, jobject, jint) { return 0; } static int android_media_tv_Tuner_lnb_set_position(JNIEnv*, jobject, jint) { return 0; } static int android_media_tv_Tuner_lnb_send_diseqc_msg(JNIEnv*, jobject, jbyteArray) { return 0; } static int android_media_tv_Tuner_close_lnb(JNIEnv*, jobject) { return 0; } static const JNINativeMethod gTunerMethods[] = { { "nativeInit", "()V", (void *)android_media_tv_Tuner_native_init }, { "nativeSetup", "()V", (void *)android_media_tv_Tuner_native_setup }, Loading Loading @@ -971,6 +991,14 @@ static const JNINativeMethod gDvrMethods[] = { { "nativeClose", "()I", (void *)android_media_tv_Tuner_close_dvr }, }; static const JNINativeMethod gLnbMethods[] = { { "nativeSetVoltage", "(I)I", (void *)android_media_tv_Tuner_lnb_set_voltage }, { "nativeSetTone", "(I)I", (void *)android_media_tv_Tuner_lnb_set_tone }, { "nativeSetSatellitePosition", "(I)I", (void *)android_media_tv_Tuner_lnb_set_position }, { "nativeSendDiseqcMessage", "([B)I", (void *)android_media_tv_Tuner_lnb_send_diseqc_msg }, { "nativeClose", "()I", (void *)android_media_tv_Tuner_close_lnb }, }; static bool register_android_media_tv_Tuner(JNIEnv *env) { if (AndroidRuntime::registerNativeMethods( env, "android/media/tv/tuner/Tuner", gTunerMethods, NELEM(gTunerMethods)) != JNI_OK) { Loading Loading @@ -998,6 +1026,13 @@ static bool register_android_media_tv_Tuner(JNIEnv *env) { ALOGE("Failed to register dvr native methods"); return false; } if (AndroidRuntime::registerNativeMethods( env, "android/media/tv/tuner/Tuner$Lnb", gLnbMethods, NELEM(gLnbMethods)) != JNI_OK) { ALOGE("Failed to register lnb native methods"); return false; } return true; } Loading