Merge "Extend Scan Message and Message Type in Tuner HAL 1.1"

This commit is contained in:
Amy Zhang
2020-09-30 23:00:54 +00:00
committed by Android (Google) Code Review
6 changed files with 106 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ hidl_interface {
"IFilter.hal",
"IFrontend.hal",
"IFilterCallback.hal",
"IFrontendCallback.hal",
"ITuner.hal",
"types.hal",
],

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.tv.tuner@1.1;
import @1.0::IFrontendCallback;
import FrontendScanMessageExt1_1;
import FrontendScanMessageTypeExt1_1;
interface IFrontendCallback extends @1.0::IFrontendCallback {
/**
* The callback function that must be called by HAL implementation to notify
* the client of the v1_1 extended scan messages.
*
* @param type the type of v1_1 extended scan message.
* @param message the v1_1 extended scan message sent by HAL to the client.
*/
onScanMessageExt1_1(FrontendScanMessageTypeExt1_1 type, FrontendScanMessageExt1_1 messageExt);
};

View File

@@ -17,7 +17,7 @@
#define LOG_TAG "android.hardware.tv.tuner@1.1-Frontend"
#include "Frontend.h"
#include <android/hardware/tv/tuner/1.0/IFrontendCallback.h>
#include <android/hardware/tv/tuner/1.1/IFrontendCallback.h>
#include <utils/Log.h>
namespace android {
@@ -118,6 +118,17 @@ Return<Result> Frontend::scan(const FrontendSettings& settings, FrontendScanType
mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg);
mIsLocked = true;
sp<V1_1::IFrontendCallback> frontendCallback_v1_1 =
V1_1::IFrontendCallback::castFrom(mCallback);
if (frontendCallback_v1_1 != NULL) {
V1_1::FrontendScanMessageExt1_1 msg;
msg.dvbc(FrontendDvbcModulation::MOD_16QAM);
frontendCallback_v1_1->onScanMessageExt1_1(V1_1::FrontendScanMessageTypeExt1_1::MODULATION,
msg);
} else {
ALOGD("[Filter] Couldn't cast to V1_1 IFrontendCallback");
}
return Result::SUCCESS;
}

View File

@@ -37,6 +37,7 @@ import @1.0::FrontendIsdbtBandwidth;
import @1.0::FrontendIsdbtGuardInterval;
import @1.0::FrontendIsdbtMode;
import @1.0::FrontendIsdbtModulation;
import @1.0::FrontendScanMessageType;
import @1.0::FrontendStatusType;
import @1.0::FrontendType;
import android.hidl.safe_union@1.0;
@@ -522,3 +523,9 @@ safe_union FrontendStatusExt1_1 {
*/
vec<uint32_t> tsDataRate;
};
enum FrontendScanMessageTypeExt1_1 : uint32_t {
MODULATION = @1.0::FrontendScanMessageType:ATSC3_PLP_INFO + 1,
};
typedef FrontendModulation FrontendScanMessageExt1_1;

View File

@@ -47,6 +47,51 @@ Return<void> FrontendCallback::onScanMessage(FrontendScanMessageType type,
return Void();
}
Return<void> FrontendCallback::onScanMessageExt1_1(FrontendScanMessageTypeExt1_1 type,
const FrontendScanMessageExt1_1& message) {
android::Mutex::Autolock autoLock(mMsgLock);
ALOGD("[vts] frontend ext1_1 scan message. Type: %d", type);
switch (type) {
case FrontendScanMessageTypeExt1_1::MODULATION:
readFrontendScanMessageExt1_1Modulation(message);
break;
default:
break;
}
return Void();
}
void FrontendCallback::readFrontendScanMessageExt1_1Modulation(FrontendModulation modulation) {
switch (modulation.getDiscriminator()) {
case FrontendModulation::hidl_discriminator::dvbc:
ALOGD("[vts] frontend ext1_1 scan message modulation dvbc: %d", modulation.dvbc());
break;
case FrontendModulation::hidl_discriminator::dvbs:
ALOGD("[vts] frontend ext1_1 scan message modulation dvbs: %d", modulation.dvbs());
break;
case FrontendModulation::hidl_discriminator::isdbs:
ALOGD("[vts] frontend ext1_1 scan message modulation isdbs: %d", modulation.isdbs());
break;
case FrontendModulation::hidl_discriminator::isdbs3:
ALOGD("[vts] frontend ext1_1 scan message modulation isdbs3: %d", modulation.isdbs3());
break;
case FrontendModulation::hidl_discriminator::isdbt:
ALOGD("[vts] frontend ext1_1 scan message modulation isdbt: %d", modulation.isdbt());
break;
case FrontendModulation::hidl_discriminator::atsc:
ALOGD("[vts] frontend ext1_1 scan message modulation atsc: %d", modulation.atsc());
break;
case FrontendModulation::hidl_discriminator::atsc3:
ALOGD("[vts] frontend ext1_1 scan message modulation atsc3: %d", modulation.atsc3());
break;
case FrontendModulation::hidl_discriminator::dvbt:
ALOGD("[vts] frontend ext1_1 scan message modulation dvbt: %d", modulation.dvbt());
break;
default:
break;
}
}
void FrontendCallback::tuneTestOnLock(sp<IFrontend>& frontend, FrontendSettings settings,
FrontendSettingsExt1_1 settingsExt1_1) {
sp<android::hardware::tv::tuner::V1_1::IFrontend> frontend_1_1;

View File

@@ -15,9 +15,9 @@
*/
#include <android-base/logging.h>
#include <android/hardware/tv/tuner/1.0/IFrontendCallback.h>
#include <android/hardware/tv/tuner/1.0/types.h>
#include <android/hardware/tv/tuner/1.1/IFrontend.h>
#include <android/hardware/tv/tuner/1.1/IFrontendCallback.h>
#include <android/hardware/tv/tuner/1.1/ITuner.h>
#include <binder/MemoryDealer.h>
#include <gtest/gtest.h>
@@ -54,9 +54,12 @@ using android::hardware::tv::tuner::V1_0::FrontendScanMessage;
using android::hardware::tv::tuner::V1_0::FrontendScanMessageType;
using android::hardware::tv::tuner::V1_0::FrontendScanType;
using android::hardware::tv::tuner::V1_0::IFrontend;
using android::hardware::tv::tuner::V1_0::IFrontendCallback;
using android::hardware::tv::tuner::V1_0::Result;
using android::hardware::tv::tuner::V1_1::FrontendDtmbCapabilities;
using android::hardware::tv::tuner::V1_1::FrontendModulation;
using android::hardware::tv::tuner::V1_1::FrontendScanMessageExt1_1;
using android::hardware::tv::tuner::V1_1::FrontendScanMessageTypeExt1_1;
using android::hardware::tv::tuner::V1_1::IFrontendCallback;
using android::hardware::tv::tuner::V1_1::ITuner;
using ::testing::AssertionResult;
@@ -71,6 +74,8 @@ class FrontendCallback : public IFrontendCallback {
virtual Return<void> onEvent(FrontendEventType frontendEventType) override;
virtual Return<void> onScanMessage(FrontendScanMessageType type,
const FrontendScanMessage& message) override;
virtual Return<void> onScanMessageExt1_1(FrontendScanMessageTypeExt1_1 type,
const FrontendScanMessageExt1_1& message) override;
void tuneTestOnLock(sp<IFrontend>& frontend, FrontendSettings settings,
FrontendSettingsExt1_1 settingsExt1_1);
@@ -81,6 +86,8 @@ class FrontendCallback : public IFrontendCallback {
void resetBlindScanStartingFrequency(FrontendConfig& config, uint32_t resetingFreq);
private:
void readFrontendScanMessageExt1_1Modulation(FrontendModulation modulation);
bool mEventReceived = false;
bool mScanMessageReceived = false;
bool mLockMsgReceived = false;