Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
vibrator_device Struct Reference
#include <
vibrator.h
>
Definition at line
37
of file
vibrator.h
.
Turn off vibrator
Cancel a previously-started vibration, if any.
-
Returns
-
0 in case of success, negative errno code else
Definition at line
63
of file
vibrator.h
.
int(* vibrator_on)(struct
vibrator_device
*vibradev, unsigned int timeout_ms)
|
Turn on vibrator
This function must only be called after the previous timeout has expired or was canceled (through
vibrator_off()
).
-
Parameters
-
timeout_ms
|
number of milliseconds to vibrate
|
-
Returns
-
0 in case of success, negative errno code else
Definition at line
55
of file
vibrator.h
.
The documentation for this struct was generated from the following file:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2019-10-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2019-10-02 UTC."],[],[],null,["# Android Hardware Abstraction Layer: vibrator_device Struct Reference\n\nvibrator_device Struct Reference\n================================\n\n[Data Fields](#pub-attribs) \nvibrator_device Struct Reference \n\n`\n#include \u003c\n`[vibrator.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)`\n\u003e\n`\n\n|----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| struct [hw_device_t](/reference/hal/structhw__device__t) | [common](/reference/hal/structvibrator__device#a86a0ca82dd3f02023e259b8b5e155dbe) |\n| ||\n| int(\\* | [vibrator_on](/reference/hal/structvibrator__device#a6c44b936e041cbff5e2207f86d755148) )(struct [vibrator_device](/reference/hal/structvibrator__device) \\*vibradev, unsigned int timeout_ms) |\n| ||\n| int(\\* | [vibrator_off](/reference/hal/structvibrator__device#a050f76d66b2ea6e7149b145dbad123eb) )(struct [vibrator_device](/reference/hal/structvibrator__device) \\*vibradev) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nDefinition at line\n[37](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\nof file\n[vibrator.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\n.\n\nField Documentation\n-------------------\n\n\n|-----------------------------------------------------------------|\n| struct [hw_device_t](/reference/hal/structhw__device__t) common |\n\n\nCommon methods of the vibrator device. This\n*must*\nbe the first member of\n[vibrator_device](/reference/hal/structvibrator__device)\nas users of this structure will cast a\n[hw_device_t](/reference/hal/structhw__device__t)\nto\n[vibrator_device](/reference/hal/structvibrator__device)\npointer in contexts where it's known the\n[hw_device_t](/reference/hal/structhw__device__t)\nreferences a\n[vibrator_device](/reference/hal/structvibrator__device)\n.\n\n\nDefinition at line\n[44](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\nof file\n[vibrator.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\n.\n\n|--------------------------------------------------------------------------------------------------|\n| int(\\* vibrator_off)(struct [vibrator_device](/reference/hal/structvibrator__device) \\*vibradev) |\n\n\nTurn off vibrator\n\n\nCancel a previously-started vibration, if any.\n\n\nReturns\n:\n 0 in case of success, negative errno code else\n\n\nDefinition at line\n[63](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\nof file\n[vibrator.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\n.\n\n|--------------------------------------------------------------------------------------------------------------------------|\n| int(\\* vibrator_on)(struct [vibrator_device](/reference/hal/structvibrator__device) \\*vibradev, unsigned int timeout_ms) |\n\n\nTurn on vibrator\n\n\nThis function must only be called after the previous timeout has expired or was canceled (through\n[vibrator_off()](/reference/hal/structvibrator__device#a050f76d66b2ea6e7149b145dbad123eb)\n).\n\n\nParameters\n:\n\n |------------|-----------------------------------|\n | timeout_ms | number of milliseconds to vibrate |\n\n\nReturns\n:\n 0 in case of success, negative errno code else\n\n\nDefinition at line\n[55](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\nof file\n[vibrator.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [vibrator.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vibrator.h)"]]