camera.switchWifi
Aplikasi mengirimkan perintah ini ke kamera untuk memberinya kredensial untuk
mengakses Wi-Fi infrastruktur
dengan akses ke Internet. Perintah ini menyertakan
kunci rahasia K yang dibagikan sebelumnya, yang nantinya akan digunakan aplikasi untuk mengotentikasi dirinya sendiri
dengan kamera setelah kedua perangkat
beralih ke Wi-Fi infrastruktur.
Perintah ini ditambahkan di API level 2.1 dan relevan dengan
Upload Langsung.
Parameter
preSharedKey:
Kunci 256-bit yang dibuat secara acak yang digunakan untuk mengautentikasi
kamera dengan aplikasi setelah keduanya
terhubung ke infrastruktur Wi-Fi.
Misalnya, RAND_bytes() dari OpenSSL dapat digunakan untuk menghasilkan ini.
- SSID Wi-Fi
wifiSsid:
.
- Sandi Wi-Fi
wifiPwd:
, jika ada.
Hasil
- Perintah ini tidak menampilkan hasil.
Error
missingParameter:
Beberapa parameter, misalnya, preSharedKey
tidak ada.
invalidParameterName:
Satu atau beberapa nama parameter input
tidak dikenal.
invalidParameterValue:
Nama parameter input dikenali
tetapi satu atau beberapa nilai yang diteruskan tidak valid. Misalnya, wifiPwd
diteruskan sebagai bilangan bulat, bukan string.
I/O Perintah |
|
Input Perintah |
{ "parameters": { "preSharedKey": "random key", "wifiSsid": "home Wi-Fi", "wifiPwd": "wifi password" } } |
Output Perintah |
none |
Output Perintah (Error) |
{ "error": { "code": "missingParameter", "message": "Parameter preSharedKey is missing." } } |
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2024-08-21 UTC.
[null,null,["Terakhir diperbarui pada 2024-08-21 UTC."],[[["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"]]