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 (世界標準時間)。"],[[["The command enables the app to provide the camera with infrastructure Wi-Fi credentials, including a pre-shared key for subsequent authentication."],["Introduced in API level 2.1, this command is specifically for Direct Upload functionality and facilitates camera-app communication over Wi-Fi."],["It requires parameters like preSharedKey, wifiSsid, and wifiPwd, and potential errors include missing or invalid parameters."],["The command itself doesn't return a result, but errors are indicated through specific error codes and messages."]]],["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"]]