universal7885: interfaces: Implement FMRadio HAL v1.1

Change-Id: Ifff4f14171e1774723a1ffa40f74eabd99a28e97
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2022-02-19 01:07:04 +09:00
commit 81a87b312f
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
10 changed files with 85 additions and 15 deletions

View file

@ -5,6 +5,8 @@ hidl_interface {
"types.hal",
"IFMRadio.hal",
],
interfaces: [ "android.hidl.base@1.0" ],
interfaces: [
"android.hidl.base@1.0",
],
gen_java: true,
}

View file

@ -0,0 +1,13 @@
hidl_interface {
name: "vendor.eureka.hardware.fmradio@1.1",
root: "vendor.eureka",
srcs: [
"types.hal",
"IFMRadio.hal",
],
interfaces: [
"android.hidl.base@1.0",
"vendor.eureka.hardware.fmradio@1.0",
],
gen_java: true,
}

View file

@ -0,0 +1,21 @@
// Copyright (C) 2021 Eureka Team
//
// 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 vendor.eureka.hardware.fmradio@1.1;
import @1.0::IFMRadio;
interface IFMRadio extends @1.0::IFMRadio {
isAvailable() generates (Status status);
};

View file

@ -1,7 +1,7 @@
// FIXME: your file license if you have one
cc_binary {
name: "vendor.eureka.hardware.fmradio@1.0-service",
name: "vendor.eureka.hardware.fmradio@1.1-service",
relative_install_path: "hw",
proprietary: true,
srcs: [
@ -13,7 +13,8 @@ cc_binary {
"libutils",
"liblog",
"vendor.eureka.hardware.fmradio@1.0",
"vendor.eureka.hardware.fmradio@1.1",
],
init_rc: [ "vendor.eureka.hardware.fmradio@1.0-service.rc" ],
vintf_fragments: [ "vendor.eureka.hardware.fmradio@1.0.xml" ],
init_rc: [ "vendor.eureka.hardware.fmradio@1.1-service.rc" ],
vintf_fragments: [ "vendor.eureka.hardware.fmradio@1.1.xml" ],
}

View file

@ -16,7 +16,10 @@
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::fmradio::V1_0 {
#include <sys/types.h>
#include <sys/stat.h>
namespace vendor::eureka::hardware::fmradio::V1_1 {
Return<void> IFMRadio::setManualFreq(float freq) {
std::ofstream file;
@ -39,8 +42,15 @@ Return<void> IFMRadio::adjustFreqByStep(fmradio::V1_0::Direction dir) {
file.close();
return Void();
}
IFMRadio* FMRadio::getInstance(void) {
Return<int32_t> IFMRadio::isAvailable(){
struct stat info;
if(stat("/sys/devices/virtual/s610_radio/s610_radio/", &info ) != 0) {
return Status::NO;
else
return Status::YES;
}
}
IFMRadio* IFMRadio::getInstance(void) {
return new FMRadio();
}
} // namespace vendor::eureka::hardware::fmradio::V1_0

View file

@ -16,9 +16,9 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/fmradio/1.0/IFMRadio.h>
#include <vendor/eureka/hardware/fmradio/1.1/IFMRadio.h>
namespace vendor::eureka::hardware::fmradio::V1_0 {
namespace vendor::eureka::hardware::fmradio::V1_1 {
using ::android::sp;
using ::android::hardware::hidl_array;
@ -29,9 +29,11 @@ using ::android::hardware::Return;
using ::android::hardware::Void;
struct FMRadio : public IFMRadio {
// Methods from ::vendor::eureka::hardware::parts::V1_0::ISELinux follow.
// Methods from ::vendor::eureka::hardware::fmradio::V1_0::IFMRadio follow.
Return<void> setManualFreq(float freq);
Return<void> adjustFreqByStep(Direction dir);
// Methods from ::vendor::eureka::hardware::fmradio::V1_1::IFMRadio follow.
Return<int32_t> isAvailable();
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IFMRadio* getInstance(void);
};

View file

@ -14,7 +14,7 @@
#define LOG_TAG "vendor.eureka.hardware.fmradio@1.0-service"
#include <vendor/eureka/hardware/parts/1.0/IFMRadio.h>
#include <vendor/eureka/hardware/fmradio/1.1/IFMRadio.h>
#include <hidl/LegacySupport.h>
@ -23,8 +23,8 @@
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using vendor::eureka::hardware::parts::V1_0::FMRadio;
using vendor::eureka::hardware::parts::V1_0::IFMRadio;
using vendor::eureka::hardware::fmradio::V1_1::FMRadio;
using vendor::eureka::hardware::fmradio::V1_1::IFMRadio;
int main() {
int ret;

View file

@ -1,5 +1,6 @@
service vendor.parts-hal /vendor/bin/hw/vendor.eureka.hardware.fmradio@1.0-service
service vendor.parts-hal /vendor/bin/hw/vendor.eureka.hardware.fmradio@1.1-service
interface vendor.eureka.hardware.fmradio@1.0::IFMRadio default
interface vendor.eureka.hardware.fmradio@1.1::IFMRadio default
class hal
user root
group root

View file

@ -2,7 +2,7 @@
<hal format="hidl">
<name>vendor.eureka.hardware.fmradio</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>1.1</version>
<interface>
<name>IFMRadio</name>
<instance>default</instance>

View file

@ -0,0 +1,20 @@
// Copyright (C) 2021 Eureka Team
//
// 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 vendor.eureka.hardware.fmradio@1.1;
enum Status : int32_t {
YES,
NO,
};