doc:appunti:hardware:sjcam-8pro-ambarella-wifi-api
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:hardware:sjcam-8pro-ambarella-wifi-api [2022/05/07 10:22] – [Video streaming] niccolo | doc:appunti:hardware:sjcam-8pro-ambarella-wifi-api [2023/06/16 12:18] (current) – [SJCAM SJ8 Pro WiFi Ambarella API] niccolo | ||
---|---|---|---|
Line 5: | Line 5: | ||
The server on the camera accepts **only one client at a time**. When the camera is connected to a WiFi client on the controlling port 7878/TCP it will **ignore the Auto Power Off** setting and it remains active. | The server on the camera accepts **only one client at a time**. When the camera is connected to a WiFi client on the controlling port 7878/TCP it will **ignore the Auto Power Off** setting and it remains active. | ||
- | The protocol was at least partially **reversed engineered**. | + | The protocol was at least partially **reversed engineered**. |
- | See my other page about the SJCAM SJ8 Pro action camera: **[[sjcam-8pro]]**, **[[sjcam-8pro-ambarella-firmware-modding]]** | + | See my other page about the SJCAM SJ8 Pro action camera: |
+ | |||
+ | * **[[sjcam-8pro]]** | ||
+ | * **[[sjcam-8pro-ambarella-firmware-modding]]** | ||
+ | * **[[sjcam-8pro-custom-firmware]]** | ||
===== JSON Messages ===== | ===== JSON Messages ===== | ||
Line 19: | Line 23: | ||
The most important item of the message is the **msg_id**, for each code there may be other parameters that must be instantiated, | The most important item of the message is the **msg_id**, for each code there may be other parameters that must be instantiated, | ||
- | The first message sent from the host is the **AMBA_START_SESSION** (msg_id | + | The first message sent from the host is the **AMBA_START_SESSION** (msg_id 257): |
< | < | ||
Line 31: | Line 35: | ||
</ | </ | ||
- | The returned value **rval** should be **zero**, generally a negative number means some error occurred. The token is received into the **param** item, generally | + | The returned value **rval** should be **zero**, generally a negative number means some error occurred. The token is received into the **param** item, it is an integer increasing by one on every new connection. |
+ | |||
+ | **NOTICE**: Response messages from the SJCAM **do not end with a new line** character. | ||
==== Ambarella msg_id Codes ==== | ==== Ambarella msg_id Codes ==== | ||
Line 41: | Line 47: | ||
| AMBA_STOP_SESSION | | AMBA_STOP_SESSION | ||
| AMBA_GET_SETTING | | AMBA_GET_SETTING | ||
- | | AMBA_SET_SETTING | + | | AMBA_SET_SETTING |
| AMBA_GET_ALL_CURRENT_SETTINGS | | AMBA_GET_ALL_CURRENT_SETTINGS | ||
| AMBA_GET_SPACE | | AMBA_GET_SPACE | ||
Line 74: | Line 80: | ||
< | < | ||
- | SEND: {" | + | SEND: {" |
RECV: {" | RECV: {" | ||
</ | </ | ||
Line 126: | Line 132: | ||
== AMBA_GET_SINGLE_SETTING_OPTIONS == | == AMBA_GET_SINGLE_SETTING_OPTIONS == | ||
- | Enumerate all the possible values for one setting: | + | Enumerate all the possible values for LCD Off Time setting: |
< | < | ||
Line 132: | Line 138: | ||
RECV: {" | RECV: {" | ||
" | " | ||
+ | </ | ||
+ | |||
+ | Enumerate all the possible values for Resolution setting: | ||
+ | |||
+ | < | ||
+ | SEND: {" | ||
+ | RECV: {" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
</ | </ | ||
Line 150: | Line 174: | ||
</ | </ | ||
- | FIXME | + | Set the video mode: |
< | < | ||
- | SEND: {" | + | SEND: {" |
+ | RECV: {" | ||
+ | </ | ||
+ | |||
+ | Set the camera mode to normal record: | ||
+ | |||
+ | < | ||
+ | SEND: {" | ||
+ | RECV: {" | ||
</ | </ | ||
Line 198: | Line 231: | ||
== AMBA_BOSS_RESETVF == | == AMBA_BOSS_RESETVF == | ||
- | Sending the following two messages will start the RTSP video streamin | + | Sending the following two messages will start the RTSP video streaming |
< | < | ||
Line 214: | Line 247: | ||
SEND: {" | SEND: {" | ||
RECV: {" | RECV: {" | ||
+ | </ | ||
+ | |||
+ | FIXME | ||
+ | < | ||
+ | SEND: {" | ||
+ | </ | ||
+ | |||
+ | ===== Notification messages ===== | ||
+ | |||
+ | Into the controlling session you can sometimes get some messages with msg_id **AMBA_NOTIFICATION**; | ||
+ | |||
+ | < | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
</ | </ | ||
Line 239: | Line 290: | ||
===== Using Python to call the API ===== | ===== Using Python to call the API ===== | ||
+ | {{.: | ||
{{ .: | {{ .: | ||
I wrote same **Python scripts** to execute simple actions, like **start** and **stop recording**, | I wrote same **Python scripts** to execute simple actions, like **start** and **stop recording**, | ||
+ | On Android I installed also the **Termux: | ||
+ | |||
+ | In this **[[https:// | ||
Line 250: | Line 305: | ||
In this scenario the **RTOS** operating system on the camera uses the **telnet** command to talk to the **GNU/ | In this scenario the **RTOS** operating system on the camera uses the **telnet** command to talk to the **GNU/ | ||
- | I was able to **create a script** to select the Color Profile automatically at boot. Remember that, due a firmware bug, the color profile | + | I was able to **create a script** to select the Color Profile automatically at boot. Remember that, due a firmware bug, the color profile |
+ | |||
+ | **NOTICE**: I had written this script because I had customized the //SJCAM - Vivid// profile and I wanted to select it at bootstrap, while the camera starts with a default profile which at the time I did not know how to customize. Today BitrateEditor exposes also the default profile, so I can customize every profile and this script is now useless for me. | ||
Executing that script at camera startup is a rather convoluted process: | Executing that script at camera startup is a rather convoluted process: |
doc/appunti/hardware/sjcam-8pro-ambarella-wifi-api.txt · Last modified: 2023/06/16 12:18 by niccolo