# camera.switchWifi

The app sends this command to the camera to provide it with credentials to
access an infrastructure Wi-Fi with access to the Internet. The command includes
a pre-shared secret key K that the app will later use to authenticate itself
with the camera after both devices have switched to the infrastructure Wi-Fi.
*This command was added in API level 2.1 and is relevant to
[Direct Upload](https://developers.google.com/streetview/open-spherical-camera/guides/direct-upload).*

## Parameters

- `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.
- `wifiSsid:` Wi-Fi SSID.
- `wifiPwd:` Wi-Fi password, if any.

## Results

- This command returns no result.

## Errors

- `missingParameter:` Some parameter, for example, `preSharedKey` is missing.
- `invalidParameterName:` One or more input parameter names are unrecognized.
- `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.

| Command I/O |   |
|---|---|
| **Command Input** | ``` { "parameters": { "preSharedKey": "random key", "wifiSsid": "home Wi-Fi", "wifiPwd": "wifi password" } } ``` |
| **Command Output** | ``` none ``` |
| **Command Output (Error)** | ``` { "error": { "code": "missingParameter", "message": "Parameter preSharedKey is missing." } } ``` |