I am using the remoteyourcam-usb project to control a Nikon camera via USB from an Android app. I have implemented a custom command (NikonEventCheckCommand) to handle events when the camera shutter button is clicked. The image is successfully transferred to the phone, but it is not stored on the camera’s SD card.
Here is the relevant code snippet:
package com.remoteyourcam.usb.ptp.commands.nikon;
import java.nio.ByteBuffer;
import android.util.Log;
import com.remoteyourcam.usb.AppConfig;
import com.remoteyourcam.usb.ptp.NikonCamera;
import com.remoteyourcam.usb.ptp.PtpCamera.IO;
import com.remoteyourcam.usb.ptp.PtpConstants;
import com.remoteyourcam.usb.ptp.PtpConstants.Event;
import com.remoteyourcam.usb.ptp.PtpConstants.Operation;
public class NikonEventCheckCommand extends NikonCommand {
private static final String TAG = NikonEventCheckCommand.class.getSimpleName();
public NikonEventCheckCommand(NikonCamera camera) {
super(camera);
}
@Override
public void exec(IO io) {
io.handleCommand(this);
}
@Override
public void encodeCommand(ByteBuffer b) {
encodeCommand(b, Operation.NikonGetEvent);
}
@Override
protected void decodeData(ByteBuffer b, int length) {
int count = b.getShort();
while (count > 0) {
--count;
int eventCode = b.getShort();
int eventParam = b.getInt();
if (AppConfig.LOG) {
Log.i(TAG,
String.format("event %s value %s(%04x)", PtpConstants.eventToString(eventCode),
PtpConstants.propertyToString(eventParam), eventParam));
}
switch (eventCode) {
case Event.ObjectAdded:
case -16127: //for getting image from camera when camera shutter button click not in live view
camera.onEventObjectAdded(eventParam);
break;
case Event.DevicePropChanged:
camera.onEventDevicePropChanged(eventParam);
break;
case Event.CaptureComplete:
camera.onEventCaptureComplete();
break;
}
}
}
}
I have added a custom event code (-16127) to handle capturing images when the camera shutter button is clicked outside of live view mode. However, after capturing, the image is only transferred to the phone and not stored on the camera’s SD card.
What modifications are necessary to ensure the image is also saved to the camera’s SD card?
Environment:
- Nikon camera model: [specific model]
- Android version: [specific version]
- RemoteYourCam-USB version: [specific version]
- Attempts:
I have checked the camera settings and ensured that saving images to the SD card is enabled.
I have verified that the images are being successfully transferred to the phone.
References:
RemoteYourCam-USB GitHub Repository
Any insights or suggestions would be greatly appreciated!
I have added a custom event code (-16127) to handle capturing images when the camera shutter button is clicked outside of live view mode. However, after capturing, the image is only transferred to the phone and not stored on the camera’s SD card.
What modifications are necessary to ensure the image is also s
Abhinand VK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.