Description

We add a new API since V3.6.0.12 in order to allow the app to lock/unlock file. following the standard operation code 0x1012(PTP_OC_SetObjectProtection).

The PIMA spec:
  1. OC code PTP_OC_SetObjectProtection 0x1012
  2. Parameter1 —> oid(uint32_t) The Object handle
  3. Parameter2 —> newprot(uint16_t) object protection flag


The ICatchCameraControl’s API

For Java

  1. boolean setFileProtection(ICatchFile file, int newprot)
  2. throws IchSocketException, IchDeviceException, IchInvalidSessionException;

For C++

  1. bool setFileProtection(shared_ptr<ICatchFile> file, unsigned int newprot);


Sample code

  1. this.cameraSession = ICatchCameraSession.createSession();
  2. try {
  3. this.cameraSession.prepareSession(this.transport);
  4. } catch (IchTransportException e) {
  5. e.printStackTrace();
  6. }
  7. try {
  8. /* The parameter 1 should be a real object handle */
  9. ICatchFile file = new ICatchFile(1);
  10. /* The parameter 2 based on the camera' impl, maybe ingored by the camera. */
  11. boolean retVal = this.cameraSession.getControlClient().setObjectProtection(file, 0);
  12. Log.i("__file_protection__", "retVal: " + retVal);
  13. }
  14. catch (Exception ex) {
  15. ex.printStackTrace();
  16. }