segunda-feira, 28 de outubro de 2013

Power On and Start record process in GoPro Camera

GoPro is a camera witth several funcionalities and details. One of them is power on and start the record process. 

Before to start the record process we need to guarantee that the camera is already POWER ON(Dont forget to turn on the wifi capability in the GoPro camera). To do it, we need to dispatch a command to get the GoPro status, see the method verifyIfGoProIsPowerOn, basically it will check if the status is (ENCameraPowerStatus.POWERON.getCode()). If no, we need to send a power on command to it. 

To make the power on command, we will send a url reques to the GoPro Ip address, using the link below:


Turn on camera : http://<ip>/bacpac/PW?t=<password>&p=%01

If yes, you need to proceed to check if the camera is already prepared to receive a record commands, sometime the GoPro may take some time to boot, so you need to guarantee the condition.  After that, when the camera is ready to record, we dispatch another url request to the go pro to start the record process. 


 Start capture : http://<ip>/bacpac/SH?t=<password>&p=%01

Just to remember, the following functions are abstracting several calls for easier manipulation.

The example below contains a snippet code. 

public void powerOnAndStartRecord() throws Exception {
        boolean goproIsReady = false;

        try {
                verifyIfGoProIsPowerOn();

                verifyIfGoProIsReadyToRecord();

                goproIsReady = true;
        } catch (Exception e) {
                System.out
                                .println("The gopro is not poweron. Let try agin power on. ["
                                                + e.getMessage() + "]");
                goproIsReady = powerAndWaitUntilIsReady();
        }

        if (goproIsReady) {

                waitUntilIsReadyToReceiveCmd();

                System.out.println("Starting record");
                startRecord();

                System.out.println("Started.");
        }
}


For more information, you can take a look in the source code. See the class GoProApi, look for the method which are not detailed above. 

You can see how download the source code in the link.





Nenhum comentário:

Postar um comentário