dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'androidx.exifinterface:exifinterface:1.3.0'
+ implementation 'androidx.exifinterface:exifinterface:1.3.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'com.google.android.material:material:1.2.1'
- implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
api files('libs/olycamerakit.jar')
Log.v(TAG, " doCapture() ");
// シャッターを切る
- commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, REQUEST_SHUTTER_ON, 50, 300, false, isDumpLog, 0, 0x9207, 8, 0xffffffff, 0x00, 0, 0));
- commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, SEQ_DEVICE_READY, 50, 300, false, isDumpLog, 0, 0x90c8, 0, 0, 0, 0, 0));
- commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, SEQ_GET_EVENT, 50, 300, false, isDumpLog, 0, 0x90c7, 0, 0, 0, 0, 0));
+ commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, REQUEST_SHUTTER_ON, 30, 200, false, isDumpLog, 0, 0x9207, 8, 0xffffffff, 0x00, 0, 0));
+ commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, SEQ_DEVICE_READY, 30, 200, false, isDumpLog, 0, 0x90c8, 0, 0, 0, 0, 0));
+ commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, SEQ_GET_EVENT, 30, 200, false, isDumpLog, 0, 0x90c7, 0, 0, 0, 0, 0));
}
catch (Exception e)
{
try
{
Log.v(TAG, " Unlock AF ");
- commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_UNLOCK, 30, 100, false, isDumpLog, 0, 0x9206, 0, 0, 0, 0, 0));
+ commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_UNLOCK, 30, 200, false, isDumpLog, 0, 0x9206, 0, 0, 0, 0, 0));
}
catch (Exception e)
{
public void halfPressShutter(boolean isPressed)
{
//unlockAutoFocus();
- commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_MOVE, 30, 250, false, isDumpLog, 0, 0x90c1, 0, 0, 0, 0, 0));
+ commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_MOVE, 30, 200, false, isDumpLog, 0, 0x90c1, 0, 0, 0, 0, 0));
//lockAutoFocus(new PointF(0.5f, 0.5f));
}
int y = (0x0000ffff & (Math.round(point.y * maxPointLimitHeight) + 1));
Log.v(TAG, "Lock AF: [" + x + ","+ y + "]");
if (!not_support_focus_lock) {
- commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_LOCK, 30, 250, false, isDumpLog, 0, 0x9205, 8, x, y, 0, 0));
+ commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_LOCK, 30, 200, false, isDumpLog, 0, 0x9205, 8, x, y, 0, 0));
} else {
- commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_MOVE, 30, 250, false, isDumpLog, 0, 0x90c1, 0, 0, 0, 0, 0));
+ commandPublisher.enqueueCommand(new PtpIpCommandGenericWithRetry(this, FOCUS_MOVE, 30, 200, false, isDumpLog, 0, 0x90c1, 0, 0, 0, 0, 0));
}
}
catch (Exception e)
{
this.activity = context;
commandPublisher = new PtpIpCommandPublisher(CAMERA_IP, CONTROL_PORT, true, false);
- liveViewControl = new NikonLiveViewControl(context, this, 30);
+ liveViewControl = new NikonLiveViewControl(context, this, 50, 1);
asyncReceiver = new PtpIpAsyncResponseReceiver(CAMERA_IP, ASYNC_RESPONSE_PORT);
statusChecker = new NikonStatusChecker(activity, commandPublisher, CAMERA_IP, EVENT_PORT);
nikonConnection = new NikonConnection(context, provider, this, statusChecker);
@Override
public int maxRetryCount()
{
- return (400);
+ return (350);
}
@Override
import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener
import java.util.*
-class NikonLiveViewControl(private val context: AppCompatActivity, interfaceProvider: IPtpIpInterfaceProvider, private val delayMs: Int) : ILiveViewControl, ILiveViewListener, IPtpIpCommunication, IPtpIpLiveViewImageCallback, IPtpIpCommandCallback
+class NikonLiveViewControl(private val context: AppCompatActivity, interfaceProvider: IPtpIpInterfaceProvider, private val delayMs: Int, private val delayScale: Int) : ILiveViewControl, ILiveViewListener, IPtpIpCommunication, IPtpIpLiveViewImageCallback, IPtpIpCommandCallback
{
private val isDumpLog = false
private val commandIssuer = interfaceProvider.commandPublisher
private fun sendNextMessage()
{
+ Log.v(TAG, "sendNextMessage(), sleep : ${delayMs.toLong() * delayScale} ms ")
try
{
//Thread.sleep(delayMs.toLong())
//commandIssuer.enqueueCommand(NikonStatusRequestMessage(statusReceiver, delayMs, isDumpLog))
- Thread.sleep(delayMs.toLong())
+ Thread.sleep(delayMs.toLong() * delayScale)
commandIssuer.enqueueCommand(NikonLiveViewRequestMessage(imageReceiver, delayMs, isDumpLog))
}
catch (e: Exception)
}
Log.v(TAG, String.format(" NikonLiveViewControl: ----- OK REPLY (ID : %d) ----- ", id))
+ waitSleep()
when (id)
{
socket?.tcpNoDelay = tcpNoDelay
if (tcpNoDelay)
{
- socket?.tcpNoDelay = true
+ //socket?.tcpNoDelay = true
//socket?.keepAlive = false
socket?.keepAlive = false
//socket?.setPerformancePreferences(0, 1, 2)
socket?.oobInline = true
//socket?.reuseAddress = false
socket?.trafficClass = 0x80 // 0x80
- //socket?.soTimeout = 800
socket?.soTimeout = 0
+ //socket?.soTimeout = 0
//socket?.receiveBufferSize = 8192 // 10240 // 16384 // 6144// 8192 // 49152 // 65536 // 32768
- //socket?.sendBufferSize = 8192 // 4096 // 2048 // 10248
- socket?.setSoLinger(true, 3000);
+ //socket?.sendBufferSize = 1024 // 8192 // 4096 // 2048 // 10240
+ socket?.setSoLinger(true, 500);
//socket?.setReceiveBufferSize(2097152);
//socket?.setSendBufferSize(524288);
isHold = true
holdId = command.holdId
}
- //Log.v(TAG, "Enqueue : " + command.getId());
+ Log.v(TAG, "Enqueue [ID: " + command.getId() + "] size: " + commandQueue.size);
return (commandQueue.offer(command))
}
catch (e: Exception)
private const val BUFFER_SIZE = 1024 * 1024 + 16 // 受信バッファは 1MB
private const val COMMAND_SEND_RECEIVE_DURATION_MS = 5
private const val COMMAND_SEND_RECEIVE_DURATION_MAX = 3000
- private const val COMMAND_POLL_QUEUE_MS = 5
+ private const val COMMAND_POLL_QUEUE_MS = 5 // 5
}
}