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." } } |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-21。
[null,null,["最后更新时间 (UTC):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.\" } } ``` |"]]