import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection.NikonConnection;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.liveview.PtpIpLiveViewControl;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.IPtpIpRunModeHolder;
-import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker;
import static net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor.NIKON_CAMERA_IP_ADDRESS;
import static net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor.NIKON_CAMERA_IP_ADDRESS_DEFAULT_VALUE;
this.receivedFirstData = false;
Log.v(TAG, " getPartialObject (id : " + objectId + ", size:" + imageSize + ")");
- publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_PARTIAL_OBJECT, true, 0, 0x101b, 12, objectId, 0, imageSize)); // GetPartialObject (0x101b)
+ publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_PARTIAL_OBJECT, 75, true, 0, 0x101b, 12, objectId, 0, imageSize, 0)); // GetPartialObject (0x101b)
}
@Override
if (publisher != null)
{
// オブジェクト一覧をクリアする
- publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_STORAGE_ID, isDumpLog, 0, 0x1004)); // GetStorageIDs
+ publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_STORAGE_ID, 50, isDumpLog, 0, 0x1004, 0, 0, 0, 0, 0)); // GetStorageIDs
this.callback = callback;
}
}
}
// 画像を取得する
- publisher.enqueueCommand(new PtpIpCommandGeneric(new NikonScreennailImageReceiver(activity, callback), objectId, false, 0, 0x90c4, 4, objectId));
+ publisher.enqueueCommand(new PtpIpCommandGeneric(new NikonScreennailImageReceiver(activity, callback), objectId, 75, false, 0, 0x90c4, 4, objectId, 0, 0, 0));
}
}
catch (Exception e)
public boolean isReceiveMulti() {
return (false);
}
- }, objectId, false, 0, 0x1008, 4, objectId)); // getObjectInfo
+ }, objectId, 75, false, 0, 0x1008, 4, objectId, 0, 0, 0)); // getObjectInfo
}
// Log.v(TAG, "downloadContentThumbnail() " + indexStr + " [" + objectId + "] (" + storageId + ")");
- publisher.enqueueCommand(new PtpIpCommandGeneric(new PtpIpThumbnailImageReceiver(activity, callback), objectId, false, 0, 0x100a, 4, objectId)); // getThumb
+ publisher.enqueueCommand(new PtpIpCommandGeneric(new PtpIpThumbnailImageReceiver(activity, callback), objectId, 75, false, 0, 0x100a, 4, objectId, 0, 0, 0)); // getThumb
}
}
catch (Exception e)
this.receivedFirstData = false;
//Log.v(TAG, " getPartialObject (id : " + objectId + ", size:" + imageSize + ")");
//publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_PARTIAL_OBJECT, true, 0, 0x101b, 12, objectId, 0, imageSize)); // GetPartialObject 0x101b
- publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_PARTIAL_OBJECT, true, 0, 0x90c4, 4, objectId)); // GetLargeThumb
+ publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_PARTIAL_OBJECT, 75, true, 0, 0x90c4, 4, objectId, 0, 0, 0)); // GetLargeThumb
}
@Override
{
isObjectReceived = false;
IPtpIpCommandPublisher publisher = provider.getCommandPublisher();
- publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_STORAGE_HANDLE1, isDumpLog, 0, 0x1007, 12, storageId, 0x00003001, 0xffffffff));
+ publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_STORAGE_HANDLE1, 35, isDumpLog, 0, 0x1007, 12, storageId, 0x00003001, 0xffffffff, 0));
imageObjectList.clear();
}
catch (Exception e)
for (int subDirectory : directoriesList)
{
Log.v(TAG, " STORAGE ID : " + storageId + " DIRECTORY ID : " + subDirectory);
- publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_STORAGE_HANDLE2, isDumpLog, 0, 0x1007, 12, storageId, 0x00000000, subDirectory)); //
+ publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_STORAGE_HANDLE2, 35, isDumpLog, 0, 0x1007, 12, storageId, 0x00000000, subDirectory, 0)); //
}
return;
}
public boolean isReceiveMulti() {
return false;
}
- }, GET_STORAGE_HANDLE3, isDumpLog, 0, 0x1007, 12, storageId, 0x00000000, subDirectory));
+ }, GET_STORAGE_HANDLE3, 35, isDumpLog, 0, 0x1007, 12, storageId, 0x00000000, subDirectory, 0));
/*
// ストレージ名称。。。ここでは利用できない
private final int holdId;
private final int estimatedObjectSize;
+ private final int delayMs;
+
private final byte opCode0;
private final byte opCode1;
this.bodySize = 0;
this.isDumpLog = isDumpLog;
this.estimatedObjectSize = -1;
+ this.delayMs = 15;
this.id = id;
this.holdId = holdId;
this.bodySize = bodySize;
this.isDumpLog = isDumpLog;
this.estimatedObjectSize = -1;
+ this.delayMs = 15;
this.id = id;
this.holdId = holdId;
this.bodySize = bodySize;
this.isDumpLog = isDumpLog;
this.estimatedObjectSize = -1;
+ this.delayMs = 15;
this.id = id;
this.holdId = holdId;
this.bodySize = bodySize;
this.isDumpLog = isDumpLog;
this.estimatedObjectSize = -1;
+ this.delayMs = 15;
this.id = id;
this.holdId = holdId;
this.bodySize = bodySize;
this.isDumpLog = isDumpLog;
this.estimatedObjectSize = -1;
+ this.delayMs = 15;
+
+ this.id = id;
+ this.holdId = holdId;
+ opCode0 = ((byte) (0x000000ff & opcode));
+ opCode1 = ((byte)((0x0000ff00 & opcode) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value2));
+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
+ data7 = ((byte)((0xff000000 & value2) >> 24));
+
+ data8 = ((byte) (0x000000ff & value3));
+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
+ dataB = ((byte)((0xff000000 & value3) >> 24));
+
+ dataC = ((byte) (0x000000ff & value4));
+ dataD = ((byte)((0x0000ff00 & value4) >> 8));
+ dataE = ((byte)((0x00ff0000 & value4) >> 16));
+ dataF = ((byte)((0xff000000 & value4) >> 24));
+ }
+
+ public PtpIpCommandGeneric(@NonNull IPtpIpCommandCallback callback, int id, int delayMs, boolean isDumpLog, int holdId, int opcode, int bodySize, int value, int value2, int value3, int value4)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+ this.isDumpLog = isDumpLog;
+ this.estimatedObjectSize = -1;
+ this.delayMs = delayMs;
this.id = id;
this.holdId = holdId;
}
@Override
+ public int receiveDelayMs()
+ {
+ return (delayMs);
+ }
+
+ @Override
public int getHoldId()
{
return (holdId);
--- /dev/null
+package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandCallback;
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandBase;
+
+import java.nio.ByteBuffer;
+import java.util.UUID;
+
+public class NikonRegistrationMessage extends PtpIpCommandBase
+{
+ private final IPtpIpCommandCallback callback;
+
+ public NikonRegistrationMessage(@NonNull IPtpIpCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IPtpIpCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (SEQ_REGISTRATION);
+ }
+
+ @Override
+ public boolean receiveAgainShortLengthMessage()
+ {
+ return (false);
+ }
+
+ @Override
+ public boolean useSequenceNumber()
+ {
+ return (false);
+ }
+
+ @Override
+ public boolean isIncrementSeqNumber()
+ {
+ return (false);
+ }
+
+ @Override
+ public int receiveDelayMs()
+ {
+ return (50);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ int uuid = UUID.randomUUID().hashCode();
+
+ byte[] typeArray = {
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+ };
+
+ byte[] uuidArray = {
+ (byte)0xad, (byte)0xa5, (byte)0x48, (byte)0x5d, (byte)0x87, (byte)0xb2, (byte)0x7f, (byte)0x0b,
+ (byte)0xd3, (byte)0xd5, (byte)0xde, (byte)0xd0, (byte)0x12, (byte)0x44, (byte)0x99, (byte)0x32,
+ };
+
+ byte[] deviceNameArray = {
+ // device_name 'GOKIGEN_a01'
+ (byte)0x47, (byte)0x00, (byte)0x4f, (byte)0x00, (byte)0x4b, (byte)0x00, (byte)0x49, (byte)0x00,
+ (byte)0x47, (byte)0x00, (byte)0x45, (byte)0x00, (byte)0x4e, (byte)0x00, (byte)0x5f, (byte)0x00,
+ (byte)0x61, (byte)0x00, (byte)0x30, (byte)0x00, (byte)0x31, (byte)0x00, (byte)0x00, (byte)0x00,
+ };
+ byte[] versionArray = {
+ //
+ (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00,
+ };
+
+ ByteBuffer byteBuffer = ByteBuffer.allocate(4 + 16 + 24 + 4);
+ byteBuffer.put(typeArray);
+ byteBuffer.put(uuidArray);
+ byteBuffer.put(deviceNameArray);
+ byteBuffer.put(versionArray);
+
+ return (byteBuffer.array());
+ }
+}
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandPublisher;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpMessages;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandGeneric;
-import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific.CanonRegistrationMessage;
-import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker;
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific.NikonRegistrationMessage;
public class NikonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCommandCallback, IPtpIpMessages
{
if (checkEventInitialize(rx_body))
{
interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.canon_connect_connecting1), false, false, 0);
- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41)); // OpenSession
+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_OPEN_SESSION, 50, isDumpLog, 0, 0x1002, 4, 0x41, 0, 0, 0)); // OpenSession
}
else
{
case SEQ_OPEN_SESSION:
interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.canon_connect_connecting2), false, false, 0);
- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_INIT_SESSION, isDumpLog, 0, 0x1001)); // GetDeviceInfo
+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_INIT_SESSION, 50, isDumpLog, 0, 0x1001, 0, 0, 0, 0, 0)); // GetDeviceInfo
break;
case SEQ_INIT_SESSION:
{
interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_start), false, false, 0);
cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start));
- commandIssuer.enqueueCommand(new CanonRegistrationMessage(this));
+ commandIssuer.enqueueCommand(new NikonRegistrationMessage(this));
}
private void sendInitEventRequest(byte[] receiveData)
statusChecker.setEventConnectionNumber(eventConnectionNumber);
interfaceProvider.getCameraStatusWatcher().startStatusWatch(null);
- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41));
+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_OPEN_SESSION, 50, isDumpLog, 0, 0x1002, 4, 0x41, 0, 0, 0));
}
catch (Exception e)
{