mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 15:58:43 +00:00
Add HIDL implementation of vibrator HAL
Test: Builds, boots and vibrator works on bullhead Change-Id: I0ad3a362d83e5063bdaef2d66bfd785fc5ee6757
This commit is contained in:
46
vibrator/1.0/Android.bp
Normal file
46
vibrator/1.0/Android.bp
Normal file
@@ -0,0 +1,46 @@
|
||||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.vibrator@1.0_genc++",
|
||||
tool: "hidl-gen",
|
||||
cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vibrator@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IVibrator.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/vibrator/1.0/types.cpp",
|
||||
"android/hardware/vibrator/1.0/VibratorAll.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.vibrator@1.0_genc++_headers",
|
||||
tool: "hidl-gen",
|
||||
cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vibrator@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IVibrator.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/vibrator/1.0/types.h",
|
||||
"android/hardware/vibrator/1.0/IVibrator.h",
|
||||
"android/hardware/vibrator/1.0/IHwVibrator.h",
|
||||
"android/hardware/vibrator/1.0/BnVibrator.h",
|
||||
"android/hardware/vibrator/1.0/BpVibrator.h",
|
||||
"android/hardware/vibrator/1.0/BsVibrator.h",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.vibrator@1.0",
|
||||
generated_sources: ["android.hardware.vibrator@1.0_genc++"],
|
||||
generated_headers: ["android.hardware.vibrator@1.0_genc++_headers"],
|
||||
export_generated_headers: ["android.hardware.vibrator@1.0_genc++_headers"],
|
||||
shared_libs: [
|
||||
"libhidl",
|
||||
"libhwbinder",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
],
|
||||
}
|
||||
102
vibrator/1.0/Android.mk
Normal file
102
vibrator/1.0/Android.mk
Normal file
@@ -0,0 +1,102 @@
|
||||
# This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
################################################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.vibrator@1.0-java
|
||||
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
||||
|
||||
intermediates := $(local-generated-sources-dir)
|
||||
|
||||
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
|
||||
|
||||
#
|
||||
# Build types.hal (Status)
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/vibrator/1.0/Status.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.vibrator@1.0::types.Status
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/types.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IVibrator.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/vibrator/1.0/IVibrator.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVibrator.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
|
||||
$(GEN): $(LOCAL_PATH)/types.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.vibrator@1.0::IVibrator
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IVibrator.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.vibrator@1.0-java-static
|
||||
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
||||
|
||||
intermediates := $(local-generated-sources-dir)
|
||||
|
||||
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
|
||||
|
||||
#
|
||||
# Build types.hal (Status)
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/vibrator/1.0/Status.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.vibrator@1.0::types.Status
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/types.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IVibrator.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/vibrator/1.0/IVibrator.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVibrator.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
|
||||
$(GEN): $(LOCAL_PATH)/types.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.vibrator@1.0::IVibrator
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IVibrator.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
include $(BUILD_STATIC_JAVA_LIBRARY)
|
||||
|
||||
|
||||
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||
35
vibrator/1.0/IVibrator.hal
Normal file
35
vibrator/1.0/IVibrator.hal
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.vibrator@1.0;
|
||||
|
||||
interface IVibrator {
|
||||
/** Turn on vibrator
|
||||
*
|
||||
* This function must only be called after the previous timeout has expired or
|
||||
* was canceled (through off()).
|
||||
* @param timeout_ms number of milliseconds to vibrate.
|
||||
* @return vibratorOnRet whether vibrator command was successful or not.
|
||||
*/
|
||||
on(uint32_t timeoutMs) generates (Status vibratorOnRet);
|
||||
|
||||
/** Turn off vibrator
|
||||
*
|
||||
* Cancel a previously-started vibration, if any.
|
||||
* @return vibratorOffRet whether vibrator command was successful or not.
|
||||
*/
|
||||
off() generates (Status vibratorOffRet);
|
||||
};
|
||||
22
vibrator/1.0/types.hal
Normal file
22
vibrator/1.0/types.hal
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.vibrator@1.0;
|
||||
|
||||
enum Status: uint32_t {
|
||||
OK = 0,
|
||||
ERR = 1
|
||||
};
|
||||
Reference in New Issue
Block a user