Wiki

Clone wiki

CGOCameraLibrary / Home

Welcome

This is the CGO Camera wiki where I try to document everything I found out while creating the CGO Camera library.

CGO Camera API

The CGO Camera API basically consists of a simple web service which is running on the camera. It is no real REST/JSON web service as it does not use HTTP methods like POST, PUT etc. It simply uses GET requests for both setter and getter functions.

The service url is located at:

http://192.168.42.1/cgi-bin/cgi

All commands and parameters are provided as query parameters. The following query parameter is mandatory:

  • CMD: command to execute

To execute a command create a URI with the following syntax:

http://192.168.42.1/cgi-bin/cgi?CMD=<command>[&<param>=<value>]

Depending on the command, one or more optional parameters may be appended.

General commands

Please note, that not all commands are supported on all cameras. The following documentation assumes that you have a CGO3 camera. For users of CGO2+ or CGO4 please check the corresponding response code.

INIT_CAMERA

Initializes camera; must be called before any other commands, otherwise they will return an error.

Request parameters: -

Response example:

{"rval":0,"msg_id":"257","param":1,"fw_ver":"1.8.00(E)",
"cam_mode":"1","status":"vf","iq_type":"1","white_balance":"0",
"sdfree":"15191040","sdtotal":"15549440","exposure_value":"0.0",
"video_mode":"3840x2160F30","speed_rate":"6M","sharpness":"6",
"record_time":"0","awb_lock":"0","ae_enable":"1","audio_sw":"1",
"shutter_time":"60","iso_value":"ISO_1600","photo_format":"dng" }

GET_STATUS

Returns the current status of the camera.

Request parameters: -

Response example:

{"rval":0, "msg_id":1, "cam_mode":"1","status":"vf",
"sdfree":"15191040","sdtotal":"15549440",
"record_time":"0","white_balance":"0","ae_enable":"1",
"iq_type":"1","exposure_value":"0.0","video_mode":"3840x2160F30",
"awb_lock":"0","audio_sw":"1","shutter_time":"60",
"iso_value":"ISO_1600","photo_format":"dng"}

GET_FW_VERSION

Returns the current information about the installed firmware

Request Parameters: -

Response example:

{"rval":0,"msg_id":"11","brand":"YUNEEC","model":"CGO3",
"YUNEEC_ver":"1.8.00(E)","api_ver":"2.8.00",
"fw_ver":"Jul 17 2015 14:02:17","app_type":"sport",
"logo":"/tmp/fuse_z/app_logo.jpg","chip":"S2(A9)",
"http":"disable" }

START_RECORD

Starts recording a video. This command must be called in view finder camera mode (vf), otherwise it will return a state error.

Request parameters: -

Response example:

{"rval":0,"flag_id":"513"}

Error cases:

Command called in non-vf mode:

{"rval":-4002,"msg_id":"513","msg":"yuneec stream is not in preview status"}

STOP_RECORD

Stops a recording. This function must be called in record mode camera mode (record), otherwise it will return a state error.

Request parameters: -

Response example:

{"rval":0, "msg_id":"514", "param":"/sdcard/DCIM/100MEDIA"}

Error cases:

Command called in non-record mode:

{"rval":-4003,"msg_id":"514","msg":"yuneec stream is not in recording status"}

Error codes

The following error codes where found during evaluation. Unfortunately, they differ between CGO2 and CGO3, so I cannot guarantee that they are correct. Please contact me, if you find any mistakes.

  • -102: Command not supported; This is probably returned, when the caller tried to execute an unsupported command. For instance if you call a CGO3 command on a CGO2+ camera.
  • -105: Camera not initialized; This is returned when a command is executed before INIT_CAMERA is called.

Updated