camera.switchWi-Fi
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
應用程式傳送這個指令至相機,以提供憑證給
存取基礎架構 Wi-Fi 並連上網際網路。指令包含
應用程式稍後會用來驗證自身的預先共用密鑰 K
兩部裝置都切換至基礎架構 Wi-Fi 之後,相機才會開啟相機。
這項指令新增至 API 級別 2.1,與
直接上傳。
參數
preSharedKey:
隨機產生的 256 位元金鑰,用於驗證
相機和應用程式的相機。
舉例來說,OpenSSL 的 RAND_bytes() 可用來產生這項資訊。
wifiSsid:
Wi-Fi SSID。
wifiPwd:
Wi-Fi 密碼 (如果有的話)。
結果
錯誤
missingParameter:
缺少部分參數,例如 preSharedKey
。
invalidParameterName:
一或多個輸入參數名稱
則無法辨識。
invalidParameterValue:
系統會辨識輸入參數名稱
但一或多個傳送的值無效。例如:wifiPwd
會以整數 (而不是字串) 的形式傳遞。
指令 I/O |
|
指令輸入 |
{ "parameters": { "preSharedKey": "random key", "wifiSsid": "home Wi-Fi", "wifiPwd": "wifi password" } } |
指令輸出 |
none |
指令輸出 (錯誤) |
{ "error": { "code": "missingParameter", "message": "Parameter preSharedKey is missing." } } |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-21 (世界標準時間)。
[null,null,["上次更新時間:2024-08-21 (世界標準時間)。"],[[["\u003cp\u003eThe command enables the app to provide the camera with infrastructure Wi-Fi credentials, including a pre-shared key for subsequent authentication.\u003c/p\u003e\n"],["\u003cp\u003eIntroduced in API level 2.1, this command is specifically for Direct Upload functionality and facilitates camera-app communication over Wi-Fi.\u003c/p\u003e\n"],["\u003cp\u003eIt requires parameters like preSharedKey, wifiSsid, and wifiPwd, and potential errors include missing or invalid parameters.\u003c/p\u003e\n"],["\u003cp\u003eThe command itself doesn't return a result, but errors are indicated through specific error codes and messages.\u003c/p\u003e\n"]]],["The app sends a command to the camera to grant it access to an infrastructure Wi-Fi network. This command requires three parameters: a 256-bit pre-shared key (`preSharedKey`) for later authentication, the Wi-Fi SSID (`wifiSsid`), and the Wi-Fi password (`wifiPwd`). The camera uses this information to connect to the network. No result is returned, but errors can occur if parameters are missing, unrecognized, or invalid. This was added in API level 2.1.\n"],null,["# camera.switchWifi\n\nThe app sends this command to the camera to provide it with credentials to\naccess an infrastructure Wi-Fi with access to the Internet. The command includes\na pre-shared secret key K that the app will later use to authenticate itself\nwith the camera after both devices have switched to the infrastructure Wi-Fi.\n*This command was added in API level 2.1 and is relevant to\n[Direct Upload](/streetview/open-spherical-camera/guides/direct-upload).*\n\nParameters\n----------\n\n- `preSharedKey:` A randomly generated 256-bit key used for authenticating the camera with the app after both are connected to the infrastructure Wi-Fi. For example, RAND_bytes() from OpenSSL can be used to generate this.\n- `wifiSsid:` Wi-Fi SSID.\n- `wifiPwd:` Wi-Fi password, if any.\n\nResults\n-------\n\n- This command returns no result.\n\nErrors\n------\n\n- `missingParameter:` Some parameter, for example, `preSharedKey` is missing.\n- `invalidParameterName:` One or more input parameter names are unrecognized.\n- `invalidParameterValue:` Input parameter names are recognized but one or more passed value are invalid. For example, the `wifiPwd` is passed in as an integer instead of a string.\n\n| Command I/O | |\n|----------------------------|----------------------------------------------------------------------------------------------------------------------|\n| **Command Input** | ```text { \"parameters\": { \"preSharedKey\": \"random key\", \"wifiSsid\": \"home Wi-Fi\", \"wifiPwd\": \"wifi password\" } } ``` |\n| **Command Output** | ```text none ``` |\n| **Command Output (Error)** | ```text { \"error\": { \"code\": \"missingParameter\", \"message\": \"Parameter preSharedKey is missing.\" } } ``` |"]]