Description

After we have established a connection with the camera using the UVC protocol, we can do some simple communication with the camera through extended commands. The method is described below.

For usb host programming related to the Android system, please refer to the relevant documents in Google Developer Center.

Programming flow

Step1: Create camera session based on uvc transport

  1. try {
  2. this.transport = new ICatchUVCIsoTransport(vendorID, productID, this.feature.getFileDescriptor());
  3. this.transport = new ICatchUVCBulkTransport(this.feature.getUsbDevice(), this.feature.getUsbDeviceConnection());
  4. this.transport.prepareTransport();
  5. }
  6. catch(Exception ex) {
  7. ex.printStackTrace();
  8. }
  9. this.cameraSession = ICatchCameraSession.createSession();
  10. try {
  11. this.cameraSession.prepareSession(this.transport);
  12. } catch (IchTransportException e) {
  13. e.printStackTrace();
  14. }

Step2: Get a property client and send extension command

  1. try {
  2. cameraProperty = this.cameraSession.getPropertyClient();
  3. }
  4. catch(Exception ex) {
  5. ex.printStackTrace();
  6. }

Step3: Send&Recv extension unit command

—> exu set

  1. try {
  2. cameraProperty.setProperty(command, data, dataSize);
  3. }
  4. catch(Exception ex) {
  5. ex.printStackTrace();
  6. }

—> exu get

  1. try {
  2. return cameraProperty.getProperty(command, data);
  3. }
  4. catch(Exception ex) {
  5. ex.printStackTrace();
  6. }
  7. return 0;

The parameters here should be filled with the extended command information you added to the camera, including command type (Set/Get), data format, data length, etc.

Sample code

A sample code provided uvc_extension_sample.tar.gz

SDK version

Should be greater or equal than V3.6.0.28, download from SDK Release Note