I was really busy at work for the last few weeks. This kept me away from posting here, so this weekend I decided to make it happen. I will, therefore, speak about the Camera Remote API I was mentioning in my last post (2 SONY cameras for your IoT projects). So what is this API all about? Sony has developed an SDK (first release in 2013, today in version 2.0) so developers can drive compatible cameras, such as the HDR-AS100V or the QX-10. The SDK can be download from Sony’s developer web site and provides all you need to use the REST API, including an Android and IOS sample. But the good news for IoT solution developers is that since it is a REST API, you can use it from anywhere where compute power is available. Indeed, you can use the API via simple HTTP, JSON (JSON-RPC) and a tad of SSDP requests. The API is pretty well done and had the time to evolve and mature over the releases. Depending on the capabilities of the device you want to control, your application can do programmatically pretty much what a user can – and sometimes even more. For instance, you can stream a live video feed, and process selected sample frames on your IoT board using Open-CV. Note that the API doesn’t provide you the functions to handle the data itself, and in our case, decoding the JPEG data has to be done by our own means. What the API does, and doesn’t it well, is to give you control upon the imaging device features, and ways to retrieve the data. This is a real step-up compared to a scenario where an onboard camera was capturing the video stream in a preprogrammed fashion, and you had to hope that the data you got was good (often discovered when it was downloaded to a back-end server and post-processed). With the help of the API, you can now add specific business logic to your app and make the image/video acquisition responsive to the environment! Of course, the more processing you want to do, the more compute power your micro-controller will need. But an Edison board can perfectly fit the bill for most cases.
Using the API is really simple as I hinted it last time. The camera models I have tested are equipped with a Wi-Fi interface to which you can access from your micro-controller (each device has its unique SSID – printed on a sticker in the user guide, so do not discard it!). Once the Ad-Hoc connection established, you can use any enabled application to control the device remotely. The camera is the server, your software is the client. In a program, you will then need to use the SSDP protocol first to obtain the API URL and query the device’s feature (multicast “M-SEARCH * HTTP/1.1\r\n” “HOST: 188.8.131.52:1900 \r\n”). With the URL, you can now start issuing API calls using JSON-RPC via HTTP POST/GET. The response is a JSON file can then be parsed to extract the requested data and perform error handling.
Although the cameras I tried are a tad pricy for a simple hobbyist – though when quality and advance features are needed, this is not an issue anymore –, the API makes it easy to focus on developing your app instead of dealing with the nitty-gritty details of the device management (OK, the same hobbyist would say that that’s also very interesting too). The use of HTTP/JSON makes the API’s use ubiquitous, and this is great news for the IoT community. This is not only for phones and tablets! Let’s see if Sony will develop IoT specific imaging devices that could be used with the Camera Remote API.