I am trying to add support of Sony remote camera API to Open camera project (https://github.com/almalence/OpenCamera)
To begin with I download sample application and try to integrate it to Open camera. So, I can search for device and even launch Liveview. But I want to take more control of camera parameters. So, I implement some methods, to get info about camera parameters. For example, to get available exposure compensation I do following:
public JSONObject getAvailableExposureCompensation() throws IOException {
String service = "camera";
try {
JSONObject requestJson =
new JSONObject().put("method", "getAvailableExposureCompensation") //
.put("params", new JSONArray()).put("id", id()) //
.put("version", "1.0");
String url = findActionListUrl(service) + "/" + service;
log("Request: " + requestJson.toString());
String responseJson = SimpleHttpClient.httpPost(url, requestJson.toString());
log("Response: " + responseJson);
return new JSONObject(responseJson);
} catch (JSONException e) {
throw new IOException(e);
}
}
It's just modified copy of another method from example application.
When I connect to Sony qx 10 and try to get info about exposure compensation, I get an exception:
03-03 00:25:31.098: W/SimpleHttpClient(32662): httpPost: Response Code Error: 403: http://10.0.0.1:10000/sony/camera
03-03 00:25:31.098: W/SimpleHttpClient(32662): httpPost: IOException: Response Error:403
03-03 00:25:31.098: W/System.err(32662): java.io.IOException: Response Error:403
03-03 00:25:31.098: W/System.err(32662): at com.almalence.sony.cameraremote.utils.SimpleHttpClient.httpPost(SimpleHttpClient.java:180)
03-03 00:25:31.098: W/System.err(32662): at com.almalence.sony.cameraremote.utils.SimpleHttpClient.httpPost(SimpleHttpClient.java:135)
03-03 00:25:31.098: W/System.err(32662): at com.almalence.sony.cameraremote.SimpleRemoteApi.getAvailableWhiteBalance(SimpleRemoteApi.java:414)
03-03 00:25:31.098: W/System.err(32662): at com.almalence.opencam.cameracontroller.SonyRemoteCamera.getSupportedWhiteBalance(SonyRemoteCamera.java:825)
03-03 00:25:31.098: W/System.err(32662): at com.almalence.opencam.cameracontroller.SonyRemoteCamera.initRemoteCameraFeatures(SonyRemoteCamera.java:667)
03-03 00:25:31.098: W/System.err(32662): at com.almalence.opencam.cameracontroller.SonyRemoteCamera$3.run(SonyRemoteCamera.java:274)
403 Forbidden
Same result have other requests, such as: getAvailableWhiteBalance, getAvailableFocusMode, getAvailableIsoSpeedRate, getAvailableStillSize...
But on the other hand, Sony's PlayMemories app has exposure compensation control and different white balance modes.
What I've missed? Or PlayMemories app has some hacks, to overcome this issue?
EDIT:
What I found during my attempts:
- getAvailableLiveviewSize is not supported by qx10 (and some other devices). But what to do, if I need info about Liveview size? Is there any other way to get measure of preview images?
- getAvailableStillSize, getAvailableExposureCompensation, getAvailableWhiteBalance, getAvailableFocusMode, getAvailableIsoSpeedRate - this methods declares as supported by qx10, and device says, the they are even available. But request to them responds with 403 error. Why? May be there is some special order of requests or I should change "version" field of requests? For now I use 1.0 version, as examples from documentation.
- Sony PlayMemories can control exposure and white balance. So, at least this 2 parameters should work on my qx10 device. Or It uses some other API, not available for 3rd party developers?
EDIT 2:
So, I can get available sizes:
03-10 13:22:50.820: D/SimpleRemoteApi(4418): Request: {"method":"getAvailableStillSize","params":[],"id":10,"version":"1.0"}
03-10 13:22:50.826: D/SimpleRemoteApi(4418): Response: {"id":7,"result":[{"aspect":"4:3","size":"18M"},[{"aspect":"4:3","size":"18M"},{"aspect":"4:3","size":"5M"},{"aspect":"16:9","size":"13M"},{"aspect":"16:9","size":"2M"}]]}
But when I try to get available exposure compensations:
03-10 13:22:50.830: D/SimpleRemoteApi(4418): Request: {"method":"getAvailableExposureCompensation","params":[],"id":11,"version":"1.0"}
03-10 13:22:51.012: D/SimpleRemoteApi(4418): Response: {"error":[1,""],"id":11}
According to documentation, error code 1 is common. So, there is not any specifics about issue. Same error have getISOmodes and getWBModes requests.