Nikon Camera Not Storing Image on SD Card When Captured via USB in Android App

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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>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;
}
}
}
}
</code>
<code>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; } } } } </code>
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

New contributor

Abhinand VK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật