OSDN Git Service

一回切り替えまで。
authorMRSa <mrsa@myad.jp>
Sun, 26 Apr 2020 12:29:05 +0000 (21:29 +0900)
committerMRSa <mrsa@myad.jp>
Sun, 26 Apr 2020 12:29:05 +0000 (21:29 +0900)
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/FujiXLiveViewControl.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/playback/FujiXPlaybackControl.java
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewFragment.java
app/src/main/java/net/osdn/gokigen/gr2control/playback/ImageGridViewFragment.java

index 8e82751..a1c2eb4 100644 (file)
@@ -30,6 +30,7 @@ public class FujiXLiveViewControl implements ILiveViewControl, IFujiXCommunicati
     private static final int BUFFER_SIZE = 2048 * 1280;
     private static final int ERROR_LIMIT = 30;
     private boolean isStart = false;
+    private Socket lvSocket = null;
 
     FujiXLiveViewControl(@NonNull Activity activity, String ip, int portNumber)
     {
@@ -62,8 +63,10 @@ public class FujiXLiveViewControl implements ILiveViewControl, IFujiXCommunicati
         if (isStart)
         {
             // すでに受信スレッド動作中なので抜ける
+            Log.v(TAG, " LIVE VIEW IS ALREADY STARTED.");
             return;
         }
+        Log.v(TAG, " START LIVEVIEW... ");
         isStart = true;
         Thread thread = new Thread(new Runnable()
         {
@@ -72,14 +75,19 @@ public class FujiXLiveViewControl implements ILiveViewControl, IFujiXCommunicati
             {
                 try
                 {
-                    Socket socket = new Socket(ipAddress, portNumber);
-                    startReceive(socket);
+                    if (lvSocket == null)
+                    {
+                        lvSocket = new Socket(ipAddress, portNumber);
+                    }
+                    startReceive(lvSocket);
                 }
                 catch (Exception e)
                 {
                     Log.v(TAG, " IP : " + ipAddress + " port : " + portNumber);
                     e.printStackTrace();
                 }
+                //lvSocket = null;
+                Log.v(TAG, " STOP LIVEVIEW... ");
             }
         });
         try
@@ -97,6 +105,7 @@ public class FujiXLiveViewControl implements ILiveViewControl, IFujiXCommunicati
     {
         isStart = false;
     }
+
 /*
     private void startReceivePrevious(Socket socket)
     {
@@ -257,6 +266,7 @@ public class FujiXLiveViewControl implements ILiveViewControl, IFujiXCommunicati
             Log.v(TAG, "===== startReceive() aborted.");
             return;
         }
+        Log.v(TAG, " Receive (wait) image...");
 
         boolean findJpeg = false;
         boolean finishJpeg = false;
@@ -351,6 +361,7 @@ public class FujiXLiveViewControl implements ILiveViewControl, IFujiXCommunicati
                 isStart = false;
             }
         }
+/*
         try
         {
             isr.close();
@@ -360,5 +371,6 @@ public class FujiXLiveViewControl implements ILiveViewControl, IFujiXCommunicati
         {
             e.printStackTrace();
         }
+*/
     }
 }
index 9fc3855..41ed73d 100644 (file)
@@ -81,6 +81,7 @@ public class FujiXPlaybackControl implements IPlaybackControl, IFujiXCommandCall
     public void updateCameraFileInfo(ICameraFileInfo info)
     {
         //  なにもしない
+        Log.v(TAG, " updateCameraFileInfo() : " + info.getDatetime());
     }
 
     @Override
@@ -129,10 +130,8 @@ public class FujiXPlaybackControl implements IPlaybackControl, IFujiXCommandCall
             {
                 start = 1;
             }
-            String indexStr = name.substring(start, name.indexOf("."));
-            Log.v(TAG, "FujiX::downloadContent() : " + path + " " + name + " " + indexStr);
-            int index = Integer.parseInt(indexStr);
-            //FujiXImageContentInfo contentInfo = imageContentInfo.get(index);   // 特にデータを更新しないから大丈夫か?
+            int index = getIndexNumber(start, name);
+            Log.v(TAG, "FujiX::downloadContent() : " + path + " " + name + " " + index);
             if ((index > 0)&&(index <= imageContentInfo.size()))
             {
                 IFujiXCommandPublisher publisher = provider.getCommandPublisher();
index e531abf..70033f1 100644 (file)
@@ -118,7 +118,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
      *
      */
     @Override
-    public void onAttach(Context context)
+    public void onAttach(@NonNull Context context)
     {
         super.onAttach(context);
         Log.v(TAG, "onAttach()");
@@ -599,6 +599,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     @Override
     public void startLiveView()
     {
+        Log.v(TAG, " LiveViewFragment::startLiveView() ");
         ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod();
         if (liveViewControl == null)
         {
index 526794e..d84f63b 100644 (file)
@@ -212,7 +212,7 @@ public class ImageGridViewFragment extends Fragment implements ICameraRunModeCal
         if (!runMode.isRecordingMode())
         {
             // Threadで呼んではダメみたいだ...
-            runMode.changeRunMode(true, this);
+            //runMode.changeRunMode(true, this);
             super.onPause();
             Log.v(TAG, "onPause() End");
             return;