OSDN Git Service

暫定で記録その2.
authorMRSa <mrsa@myad.jp>
Wed, 28 Oct 2020 14:08:55 +0000 (23:08 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 28 Oct 2020 14:08:55 +0000 (23:08 +0900)
app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/wrapper/NikonInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/wrapper/liveview/NikonLiveViewControl.kt
app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/wrapper/liveview/NikonLiveViewImageReceiver.kt
app/src/main/java/net/osdn/gokigen/a01d/camera/ptpip/wrapper/command/PtpIpCommandPublisher.kt
gradle.properties

index 64bdf03..ec52de6 100644 (file)
@@ -52,7 +52,7 @@ public class NikonInterfaceProvider implements IPtpIpInterfaceProvider, IDisplay
     private final NikonCameraInformation cameraInformation;
     private NikonCaptureControl captureControl;
     private NikonFocusingControl focusingControl;
-    private NikonConnection canonConnection;
+    private NikonConnection nikonConnection;
     private PtpIpCommandPublisher commandPublisher;
     private NikonLiveViewControl liveViewControl;
     private PtpIpAsyncResponseReceiver asyncReceiver;
@@ -68,7 +68,7 @@ public class NikonInterfaceProvider implements IPtpIpInterfaceProvider, IDisplay
         liveViewControl = new NikonLiveViewControl(context, this, 30);
         asyncReceiver = new PtpIpAsyncResponseReceiver(CAMERA_IP, ASYNC_RESPONSE_PORT);
         statusChecker = new NikonStatusChecker(activity, commandPublisher, CAMERA_IP, EVENT_PORT);
-        canonConnection = new NikonConnection(context, provider, this, statusChecker);
+        nikonConnection = new NikonConnection(context, provider, this, statusChecker);
         cameraInformation = new NikonCameraInformation();
         zoomControl = new NikonZoomLensControl();
         this.statusListener = statusListener;
@@ -87,7 +87,7 @@ public class NikonInterfaceProvider implements IPtpIpInterfaceProvider, IDisplay
     @Override
     public ICameraConnection getCameraConnection()
     {
-        return (canonConnection);
+        return (nikonConnection);
     }
 
     @Override
index ef1508b..084ff73 100644 (file)
@@ -141,7 +141,7 @@ class NikonLiveViewControl(private val context: AppCompatActivity, interfaceProv
             var pos = 0
 
             // 先頭の 1024 bytesまで
-            val limit = if (data.size < 1024) data.size - 1 else 1024
+            val limit = if (data.size < 4096) data.size - 1 else 4096
             while (pos < limit)
             {
                 if (((data[pos] == 0xff.toByte())&&(data[pos + 1] == 0xd8.toByte())))
index fab9046..1beda3e 100644 (file)
@@ -8,7 +8,7 @@ import java.io.ByteArrayOutputStream
 
 class NikonLiveViewImageReceiver(private var callback: IPtpIpLiveViewImageCallback) : IPtpIpCommandCallback
 {
-    private val isDumpLog = true
+    private val isDumpLog = false
     private var receivedTotalBytes = 0
     private var receivedRemainBytes = 0
     private var receivedFirstData = false
index 40702d1..fd2dd32 100644 (file)
@@ -46,13 +46,22 @@ class PtpIpCommandPublisher(private val ipAddress : String, private val portNumb
             if (tcpNoDelay)
             {
                 socket?.keepAlive = false
-                socket?.setPerformancePreferences(0, 2, 0)
+                socket?.setPerformancePreferences(0, 1, 2)
+                //socket?.setPerformancePreferences(0, 2, 0)
+                //socket?.setPerformancePreferences(0, 1, 2)
+                //socket?.setPerformancePreferences(1, 0, 0)
+                //socket?.setPerformancePreferences(0, 0, 2)
                 socket?.oobInline = true
                 socket?.reuseAddress = false
-                socket?.trafficClass = 0x80
+                socket?.trafficClass = 0x80 // 0x80
+                socket?.soTimeout = 300
+                //socket?.receiveBufferSize = 8192 // 49152 // 65536 // 32768
+                //socket?.sendBufferSize = 8192 // 2048 // 1024 // 2048
                 //socket?.setSoLinger(true, 3000);
                 //socket?.setReceiveBufferSize(2097152);
                 //socket?.setSendBufferSize(524288);
+
+                Log.v(TAG, " SOCKET (SEND:${socket?.sendBufferSize}, RECV:${socket?.receiveBufferSize}) oob:${socket?.oobInline} SO_TIMEOUT:${socket?.soTimeout}ms trafficClass:${socket?.trafficClass}")
             }
             socket?.connect(InetSocketAddress(ipAddress, portNumber), 0)
             isConnected = true
@@ -338,12 +347,12 @@ class PtpIpCommandPublisher(private val ipAddress : String, private val portNumb
         return (if (callback != null && callback.isReceiveMulti)
         {
             // 受信したら逐次「受信したよ」と応答するパターン
-            Log.v(TAG, " receiveMulti() : $delayMs [id:${command.id}] SEQ: $sequenceNumber")
+            //Log.v(TAG, " receiveMulti() : $delayMs [id:${command.id}] SEQ: $sequenceNumber")
             receiveMulti(command, delayMs)
         }
         else
         {
-            Log.v(TAG, " receiveSingle() : $delayMs [id:${command.id}] SEQ: $sequenceNumber")
+            //Log.v(TAG, " receiveSingle() : $delayMs [id:${command.id}] SEQ: $sequenceNumber")
             receiveSingle(command, delayMs)
         })
         //  受信した後、すべてをまとめて「受信したよ」と応答するパターン
index 7dac9b8..b398a58 100644 (file)
@@ -9,7 +9,7 @@
 
 # Specifies the JVM arguments used for the daemon process.
 # The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx1536m
+org.gradle.jvmargs=-Xmx2560m
 
 # When configured, Gradle will run in incubating parallel mode.
 # This option should only be used with decoupled projects. More details, visit