OSDN Git Service

これでできた感。(Full Image取得)
authorMRSa <mrsa@myad.jp>
Sun, 13 Oct 2019 05:17:56 +0000 (14:17 +0900)
committerMRSa <mrsa@myad.jp>
Sun, 13 Oct 2019 05:17:56 +0000 (14:17 +0900)
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/command/PtpIpCommandPublisher.java
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/playback/PtpIpFullImageReceiver.java

index b78e550..182f87b 100644 (file)
@@ -436,6 +436,7 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
 
         try
         {
+            Log.v(TAG, " ===== receive_multi() =====");
             int receive_message_buffer_size = BUFFER_SIZE;
             byte[] byte_array = new byte[receive_message_buffer_size];
             InputStream is = socket.getInputStream();
@@ -518,7 +519,7 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
                 lenlen = ((((int) byte_array[15]) & 0xff) << 24) + ((((int) byte_array[14]) & 0xff) << 16) + ((((int) byte_array[13]) & 0xff) << 8) + (((int) byte_array[12]) & 0xff);
                 packetType = (((int)byte_array[16]) & 0xff);
             }
-            Log.v(TAG, " --- [[[ RECEIVED LARGE BLOCK MESSAGE : " + lenlen + " bytes. ]]] --- TYPE : " + packetType);
+            Log.v(TAG, " --- parseDataLength() length: " + lenlen + " TYPE: " + packetType + " read_bytes: " + read_bytes);
         }
         catch (Exception e)
         {
@@ -546,7 +547,7 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
                 lenlen = ((((int) byte_array[15]) & 0xff) << 24) + ((((int) byte_array[14]) & 0xff) << 16) + ((((int) byte_array[13]) & 0xff) << 8) + (((int) byte_array[12]) & 0xff);
                 packetType = (((int) byte_array[16]) & 0xff);
             }
-            Log.v(TAG, " --- <<< RECEIVED LARGE BLOCK MESSAGE : " + len + " bytes. (" + byte_array.length + " bytes.)" + " lenlen : " + lenlen + " >>> --- TYPE : " + packetType);
+            Log.v(TAG, " ---  RECEIVED MESSAGE : " + len + " bytes (BUFFER: " + byte_array.length + " bytes)" + " length : " + lenlen + " TYPE : " + packetType + " --- ");
             if (lenlen == 0)
             {
                 // データとしては変なので、なにもしない
index 3b84875..c4db4a2 100644 (file)
@@ -61,10 +61,12 @@ public class PtpIpFullImageReceiver implements IPtpIpCommandCallback
             }
             else if (id == objectId + 2)
             {
-                Log.v(TAG, " RECEIVED  : " + id);
+                Log.v(TAG, " TransferComplete() RECEIVED  : " + id + " (" + objectId + ") size : " + target_image_size);
 
                 // end of receive sequence.
                 callback.onCompleted();
+                received_remain_bytes = 0;
+                received_total_bytes = 0;
                 target_image_size = 0;
                 objectId = 0;
                 callback = null;
@@ -90,7 +92,7 @@ public class PtpIpFullImageReceiver implements IPtpIpCommandCallback
         // 受信したデータから、通信のヘッダ部分を削除する
         byte[] body = cutHeader(rx_body);
         int length = (body == null) ? 0 : body.length;
-        Log.v(TAG, " onReceiveProgress() " + currentBytes + "/" + totalBytes + " (" + length + " bytes.) : image : " + target_image_size);
+        Log.v(TAG, " onReceiveProgress() " + currentBytes + "/" + totalBytes + " (" + length + " bytes.)");
         callback.onProgress(body, length, new IProgressEvent() {
             @Override
             public float getProgress() {
@@ -120,6 +122,8 @@ public class PtpIpFullImageReceiver implements IPtpIpCommandCallback
         {
             // データを最初に読んだとき。ヘッダ部分を読み飛ばす
             data_position = (int) rx_body[0] & (0xff);
+            Log.v(TAG, " FIRST DATA POS. : " + data_position);
+            //SimpleLogDumper.dump_bytes(" [sss]", Arrays.copyOfRange(rx_body, 0, (64)));
         }
         else if (received_remain_bytes > 0)
         {