Initializing the connection and polling for Updates
After establishing a WiFi connection, as described in the first part, the communication with the camera needs to be initialized. This post describes how you can obtain all necessary cookies and keep property data in sync by polling for updates.
API Initialization
The Canon EOS C100 II requires certain cookies as part of the request headers for the communication to work. The acid cookie is the most important since it is comparable to a session id. In addition, the productId and brlang cookies are a requirement for the getUpdate endpoint.
To get hold of the values, perform a login followed by a getDeviceInfo request.
Login
The login endpoint is the only endpoint that does not require any cookies. However, you need to be aware that only one client can be connected simultaneously, and there is a 30-second cooldown between sessions.
In the example above, the acid cookie has the value 2ee, which we need to save for future requests.
Get Device Info
To retrieve the product id and language code from the camera, you can perform a getDeviceInfo request. Besides other fields, its response body contains the properties productId and lang, which is some kind of numeric language field.
As you can see, the header uses the acid cookie obtained from the login request. According to the getDeviceInfo response body, we can add productId=VKIX00 and brlang=0 to our client cookies.
Now that we have acquired all necessary cookies, we can continue exploring the Browser Remote API’s endpoints.
Get Updates
When controlling the camera through the Browser Remote API, you can still change settings directly on the camera, like adjusting the shutter angle. Therefore, we must poll for updates periodically to keep the properties between our client and the camera in sync.
For this purpose, we can use the getcurprop endpoint, which takes one query parameter seq. This parameter is also part of the response body and acts as an event sequence counter, meaning each time an event occurs, the response body contains its incremented value for the next request.
Initial Request
The initial getcurprop request with seq set to 0 is a treasure chest for reverse engineering the Browser Remote API since it contains the state of all properties the camera reports.
When analyzing the JSON data, we can make sense of lots of properties just by their name or value. However, for the non-obvious ones, the best bet for finding out their meanings is changing settings on the camera and polling for subsequent event data.
Subsequent Requests
For subsequent requests, use the seq number the camera reported in the previous update response, e. g. /api/cam/getcurprop?seq=1.
Compared to the initial response, subsequent responses only contain the properties that changed.
As a bonus, here are two more response bodies for reference:
When no value has changed, the response does not contain any property data, and the seq counter remains the same.
This response body informs that the battery level batt dropped to 3 and the aperture value Oav changed to 2.0. Additionally, the seq counter changed to 2, which becomes the seq query parameter for the following getcurprop request.
Property Overview
Here is an overview of the getcurprop response’s properties, including the values I have come across. So, be aware that this model description is still a work in progress due to the nature of reverse engineering.
rec Indicates the recording state of the camera.
Stby Rec off seq The seq property increments whenever a property has changed.
com The com property increments with each getcurprop call. It ranges between 1 and 10 and falls over to 1 once it reaches 10.
batt The batt property reports the battery level of the camera. A value between 1 to 4 corresponds with the battery level bars. A value of -1 means the camera is connected to the ac adapter.
tc The current timecode of the camera, e. g. 02:29:22:14. While recording, the event data includes updated timecode values.
camid The id of the connected camera, e. g. C100II for the Canon C100 II.
Oam A property object which contains the current aperture mode.
pv The current aperture mode, e. g, Manual.
en This flag might indicate whether the property is available or enabled.
Oav A property object which contains the current aperture value.
pv The current aperture value e. g. 1.8.
en This flag might indicate whether the property is available or enabled.
Ogcm A property object which contains the current gain mode.
pv The current gain mode, e. g. iso.
en This flag might indicate whether the property is available or enabled.
Ogcv A property object which contains the current gain value when using gain mode iso.
pv The current gain value, e. g, [850].
en This flag might indicate whether the property is available or enabled.
Ossm A property object which contains the current shutter speed mode.
pv The current shutter speed mode, e. g. angle.
en This flag might indicate whether the property is available or enabled.
Ossv A property object which contains the current shutter speed value.
pv The current shutter speed value, e. g. 180.0 when using shutter speed mode angle.
en This flag might indicate whether the property is available or enabled.
Owbm A property object which contains the current white balance mode.
pv The current white balance mode, e. g. Kelvin.
en This flag might indicate whether the property is available or enabled.
Owbv A property object which contains the current white balance value.
pv The current white balance value e. g. 5600 when using white balance mode Kelvin.
en This flag might indicate whether the property is available or enabled.
nd Corresponds to the dialed-in ND value, e. g. 0, 2, 4, 6.
With the initialization and update channel established, the groundwork for communicating with the C100 II is complete.
In the next part, we will use the Camera Remote API to take control of the camera. Besides starting and stopping a recording, you’ll learn to change properties like aperture, ISO, shutter angle and white balance.