Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tham chiếu Cấu trúc vibrator_device
#include <
vibrator.h
>
Định nghĩa tại dòng
37
của tệp
vibrator.h
.
Tắt tính năng rung
Huỷ chế độ rung đã bắt đầu trước đó, nếu có.
-
Giá trị trả về
-
0 trong trường hợp thành công, mã errno âm nếu không
Định nghĩa tại dòng
63
của tệp
vibrator.h
.
int(* vibrator_on)(struct
vibrator_device
*vibradev, unsigned int timeout_ms)
|
Bật tính năng rung
Bạn chỉ được gọi hàm này sau khi thời gian chờ trước đó đã hết hoặc bị huỷ (thông qua
vibrator_off()
).
-
Tham số
-
timeout_ms
|
số mili giây để rung
|
-
Giá trị trả về
-
0 trong trường hợp thành công, mã errno âm nếu không
Định nghĩa tại dòng
55
của tệp
vibrator.h
.
Tài liệu cho cấu trúc này được tạo từ tệp sau:
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-26 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)"]]