החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הסבר על המבנה של sensors_module_t
#include <
sensors.h
>
לכל מודול חומרה צריך להיות מבנה נתונים בשם HAL_MODULE_INFO_SYM, והשדות של מבנה הנתונים הזה צריכים להתחיל ב-
hw_module_t
ולאחר מכן במידע ספציפי למודול.
ההגדרה מופיעה בשורה
1149
בקובץ
sensors.h
.
ספירה של כל החיישנים הזמינים. הרשימה מוחזרת ב-"list".
-
החזרות
-
מספר החיישנים ברשימה
ההגדרה מופיעה בשורה
1156
בקובץ
sensors.h
.
int(* set_operation_mode)(unsigned int mode)
|
להעביר את המודול למצב ספציפי. מוגדרים המצבים הבאים
0 – הפעלה רגילה. מצב ברירת המחדל של המודול. 1 – מצב לולאה חוזרת (loopback). במוד הזה, שירות החיישן מזין נתונים לחיישנים הנתמכים.
-
החזרות
-
0 אם הפעולה בוצעה בהצלחה, -EINVAL אם המצב המבוקש לא נתמך, -EPERM אם הפעולה לא מותרת
ההגדרה מופיעה בשורה
1169
בקובץ
sensors.h
.
התיעוד של המבנה הזה נוצר מהקובץ הבא:
-
hardware/libhardware/include/hardware/
sensors.h
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Android Hardware Abstraction Layer: sensors_module_t Struct Reference\n\nsensors_module_t Struct Reference\n=================================\n\n[Data Fields](#pub-attribs) \nsensors_module_t Struct Reference \n\n`\n#include \u003c\n`[sensors.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)`\n\u003e\n`\n\n|----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| struct [hw_module_t](/reference/hal/structhw__module__t) | [common](/reference/hal/structsensors__module__t#a71ea01183b3998cad6a2301a37a42fc7) |\n| ||\n| int(\\* | [get_sensors_list](/reference/hal/structsensors__module__t#aa9546f8477ee959716aa78e849a2c51b) )(struct [sensors_module_t](/reference/hal/structsensors__module__t) \\*module, struct [sensor_t](/reference/hal/structsensor__t) const \\*\\*list) |\n| ||\n| int(\\* | [set_operation_mode](/reference/hal/structsensors__module__t#a495cc50ac138223c6f32006810c1a8ca) )(unsigned int mode) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nEvery hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this data structure must begin with\n[hw_module_t](/reference/hal/structhw__module__t)\nfollowed by module specific information.\n\n\nDefinition at line\n[1149](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\nof file\n[sensors.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\n.\n\nField Documentation\n-------------------\n\n\n|-----------------------------------------------------------------|\n| struct [hw_module_t](/reference/hal/structhw__module__t) common |\n\n\nDefinition at line\n[1150](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\nof file\n[sensors.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\n.\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* get_sensors_list)(struct [sensors_module_t](/reference/hal/structsensors__module__t) \\*module, struct [sensor_t](/reference/hal/structsensor__t) const \\*\\*list) |\n\n\nEnumerate all available sensors. The list is returned in \"list\".\n\n\nReturns\n:\n number of sensors in the list\n\n\nDefinition at line\n[1156](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\nof file\n[sensors.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\n.\n\n|-----------------------------------------------|\n| int(\\* set_operation_mode)(unsigned int mode) |\n\n\nPlace the module in a specific mode. The following modes are defined\n\n\n0 - Normal operation. Default state of the module. 1 - Loopback mode. Data is injected for the supported sensors by the sensor service in this mode.\n\n\nReturns\n:\n 0 on success -EINVAL if requested mode is not supported -EPERM if operation is not allowed\n\n\nDefinition at line\n[1169](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\nof file\n[sensors.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [sensors.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h)"]]