自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
GpsMeasurementInterface 結構體參考資料
#include <
gps.h
>
擴充 GPS 測量支援的介面。
定義位於檔案
gps.h
的
1982
行。
停止 HAL 的更新,並取消註冊回呼例行程序。呼叫停止後,HAL 必須將先前註冊的回呼視為無效。如果在沒有先前「init」的情況下叫用 stop,這個函式就不會執行任何工作。
定義位於檔案
gps.h
的
2005
行。
初始化介面,並向 HAL 註冊回呼例程。成功呼叫「init」後,HAL 必須開始在其自身階段提供更新。
狀態:GPS_MEASUREMENT_OPERATION_SUCCESS GPS_MEASUREMENT_ERROR_ALREADY_INIT - 如果已註冊回呼,但未對應呼叫「close」GPS_MEASUREMENT_ERROR_GENERIC - 如果發生任何其他錯誤,HAL 不會在傳回此錯誤代碼時產生任何更新。
定義位於檔案
gps.h
的
1997
行。
設為 sizeof(GpsMeasurementInterface)
定義位於檔案
gps.h
的
1984
行。
這個結構體的說明文件是由下列檔案產生:
-
hardware/libhardware/include/hardware/
gps.h
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[],[],null,["# Android Hardware Abstraction Layer: GpsMeasurementInterface Struct Reference\n\nGpsMeasurementInterface Struct Reference\n========================================\n\n[Data Fields](#pub-attribs) \nGpsMeasurementInterface Struct Reference \n\n`\n#include \u003c\n`[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)`\n\u003e\n`\n\n|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| size_t | [size](/reference/hal/struct_gps_measurement_interface#a854352f53b148adc24983a58a1866d66) |\n| ||\n| int(\\* | [init](/reference/hal/struct_gps_measurement_interface#ab662b0cdfbead07de6273f5587f9608c) )( [GpsMeasurementCallbacks](/reference/hal/struct_gps_measurement_callbacks) \\*callbacks) |\n| ||\n| void(\\* | [close](/reference/hal/struct_gps_measurement_interface#a9736ff1cda7d1d558f5cd251e0049c49) )() |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nExtended interface for GPS Measurements support.\n\n\nDefinition at line\n[1982](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\nField Documentation\n-------------------\n\n\n|------------------|\n| void(\\* close)() |\n\n\nStops updates from the HAL, and unregisters the callback routines. After a call to stop, the previously registered callbacks must be considered invalid by the HAL. If stop is invoked without a previous 'init', this function should perform no work.\n\n\nDefinition at line\n[2005](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n|-------------------------------------------------------------------------------------------------------|\n| int(\\* init)( [GpsMeasurementCallbacks](/reference/hal/struct_gps_measurement_callbacks) \\*callbacks) |\n\n\nInitializes the interface and registers the callback routines with the HAL. After a successful call to 'init' the HAL must begin to provide updates at its own phase.\n\n\nStatus: GPS_MEASUREMENT_OPERATION_SUCCESS GPS_MEASUREMENT_ERROR_ALREADY_INIT - if a callback has already been registered without a corresponding call to 'close' GPS_MEASUREMENT_ERROR_GENERIC - if any other error occurred, it is expected that the HAL will not generate any updates upon returning this error code.\n\n\nDefinition at line\n[1997](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n|-------------|\n| size_t size |\n\n\nSet to sizeof(GpsMeasurementInterface)\n\n\nDefinition at line\n[1984](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)"]]