OSDN Git Service

接続シーケンスはこれで。
authorMRSa <mrsa@myad.jp>
Mon, 16 Sep 2019 14:10:19 +0000 (23:10 +0900)
committerMRSa <mrsa@myad.jp>
Mon, 16 Sep 2019 14:10:19 +0000 (23:10 +0900)
app/src/main/java/net/osdn/gokigen/pkremote/camera/playback/CameraContentsRecognizer.java
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/connection/CanonCameraConnectSequenceForPlayback.java
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonConnection.java
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/status/PtpIpStatusChecker.java
app/src/main/res/values-ja/strings.xml
app/src/main/res/values/strings.xml

index e2912af..bafd007 100644 (file)
@@ -57,6 +57,7 @@ public class CameraContentsRecognizer implements ICameraContentsRecognizer, ICam
     @Override
     public void getRemoteCameraContentsList(boolean isReload, ICameraContentsListCallback callback)
     {
+        Log.v(TAG, "  --- getRemoteCameraContentsList() ---");
         contentsListCallback = callback;
         if ((isLoadedContents)&&(cameraContentsList != null)&&(!isReload))
         {
index 0a65c71..3a6e4d9 100644 (file)
@@ -248,7 +248,7 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
                 sendData[17] = (byte) (((0xff000000 & sequenceNumber) >>> 24) & 0x000000ff);
                 if (isDumpReceiveLog)
                 {
-                    Log.v(TAG, "SEQ No. : " + sequenceNumber);
+                    Log.v(TAG, "----- SEQ No. : " + sequenceNumber + " -----");
                 }
             }
 
@@ -289,7 +289,6 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
         try
         {
             sleep(delayMs);
-            Log.v(TAG, "  ----- receive_from_camera() ----- : " + isDumpReceiveLog + "  " + receiveAgain);
             boolean isFirstTime = true;
             int totalReadBytes;
             int receive_message_buffer_size = BUFFER_SIZE;
@@ -360,7 +359,7 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
                 if (isDumpReceiveLog)
                 {
                     // ログに受信メッセージを出力する
-                    Log.v(TAG, "receive_from_camera() : " + read_bytes + " bytes. [" + receive_message_buffer_size + "]");
+                    Log.v(TAG, "receive_from_camera() : " + read_bytes + " bytes.");
                     dump_bytes("RECV[" + receive_body.length + "] ", receive_body);
                 }
                if (callback != null)
index 28223de..37cab15 100644 (file)
@@ -15,10 +15,8 @@ import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpComma
 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.IPtpIpRunModeHolder;
 import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker;
 
-
 public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCommandCallback, IPtpIpMessages
 {
     private final String TAG = this.toString();
@@ -29,7 +27,6 @@ public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCo
     private final IPtpIpInterfaceProvider interfaceProvider;
     private final IPtpIpCommandPublisher commandIssuer;
     private final PtpIpStatusChecker statusChecker;
-    private boolean isBothLiveView = false;
 
     CanonCameraConnectSequenceForPlayback(@NonNull Activity context, @NonNull ICameraStatusReceiver statusReceiver, @NonNull final ICameraConnection cameraConnection, @NonNull IPtpIpInterfaceProvider interfaceProvider, @NonNull PtpIpStatusChecker statusChecker)
     {
@@ -47,18 +44,6 @@ public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCo
     {
         try
         {
-/*
-            try
-            {
-                SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
-                isBothLiveView = preferences.getBoolean(IPreferencePropertyAccessor.FUJIX_DISPLAY_CAMERA_VIEW, false);
-            }
-            catch (Exception e)
-            {
-                //isBothLiveView = false;
-                e.printStackTrace();
-            }
-*/
             // カメラとTCP接続
             IPtpIpCommandPublisher issuer = interfaceProvider.getCommandPublisher();
             if (!issuer.isConnected())
@@ -110,12 +95,8 @@ public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCo
     @Override
     public void receivedMessage(int id, byte[] rx_body)
     {
-        //Log.v(TAG, "receivedMessage : " + id + "[" + rx_body.length + " bytes]");
-        //int bodyLength = 0;
-        IPtpIpRunModeHolder runModeHolder;
         switch (id)
         {
-/**/
             case SEQ_REGISTRATION:
                 if (checkRegistrationMessage(rx_body))
                 {
@@ -156,105 +137,11 @@ public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCo
 
             case SEQ_SET_EVENT_MODE:
                 interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.canon_connect_connecting5), false, false, 0);
-                break;
-/*
-            case SEQ_START_2ND_READ:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting2), false, false, 0);
-                cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting));
-                if (rx_body.length == (int)rx_body[0])
-                {
-                    // なぜかもうちょっとデータが飛んでくるので待つ
-                    //commandIssuer.enqueueCommand(new ReceiveOnly(this));
-
-                    commandIssuer.enqueueCommand(new StartMessage3rd(this));
-                }
-                else
-                {
-                    commandIssuer.enqueueCommand(new StartMessage3rd(this));
-                }
-                break;
-
-            case SEQ_START_2ND_RECEIVE:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting3), false, false, 0);
-                commandIssuer.enqueueCommand(new StartMessage3rd(this));
-                break;
-
-            case SEQ_START_3RD:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting4), false, false, 0);
-                commandIssuer.enqueueCommand(new StartMessage4th(this));
-                break;
-
-            case SEQ_START_4TH:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting5), false, false, 0);
-                if (isBothLiveView)
-                {
-                    // カメラのLCDと遠隔のライブビューを同時に表示する場合...
-                    commandIssuer.enqueueCommand(new CameraRemoteMessage(this));
-                }
-                else
-                {
-                    commandIssuer.enqueueCommand(new StartMessage5th(this));
-                }
-                break;
-
-            case SEQ_START_5TH:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting6), false, false, 0);
-                commandIssuer.enqueueCommand(new QueryCameraCapabilities(this));
-                //commandIssuer.enqueueCommand(new StatusRequestMessage(this));
-                break;
-
-            case SEQ_QUERY_CAMERA_CAPABILITIES:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting7), false, false, 0);
-                commandIssuer.enqueueCommand(new CameraRemoteMessage(this));
-                break;
-
-            case SEQ_CAMERA_REMOTE:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting8), false, false, 0);
-                commandIssuer.enqueueCommand(new ChangeToPlayback1st(this));
-                runModeHolder = interfaceProvider.getRunModeHolder();
-                if (runModeHolder != null)
-                {
-                    runModeHolder.transitToPlaybackMode(false);
-                }
-                //connectFinished();
-                break;
-
-            case SEQ_CHANGE_TO_PLAYBACK_1ST:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting9), false, false, 0);
-                commandIssuer.enqueueCommand(new ChangeToPlayback2nd(this));
-                break;
-
-            case SEQ_CHANGE_TO_PLAYBACK_2ND:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting10), false, false, 0);
-                commandIssuer.enqueueCommand(new ChangeToPlayback3rd(this));
-                break;
-
-            case SEQ_CHANGE_TO_PLAYBACK_3RD:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting11), false, false, 0);
-                commandIssuer.enqueueCommand(new ChangeToPlayback4th(this));
-                break;
-
-            case SEQ_CHANGE_TO_PLAYBACK_4TH:
-                interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting12), false, false, 0);
-                commandIssuer.enqueueCommand(new StatusRequestMessage(this));
-                break;
-
-            case SEQ_STATUS_REQUEST:
                 interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connect_finished), false, false, 0);
-                IPtpIpCommandCallback callback = interfaceProvider.getStatusHolder();
-                if (callback != null)
-                {
-                    callback.receivedMessage(id, rx_body);
-                }
-                runModeHolder = interfaceProvider.getRunModeHolder();
-                if (runModeHolder != null)
-                {
-                    runModeHolder.transitToPlaybackMode(true);
-                }
                 connectFinished();
                 Log.v(TAG, "CHANGED PLAYBACK MODE : DONE.");
                 break;
-*/
+
             default:
                 Log.v(TAG, "RECEIVED UNKNOWN ID : " + id);
                 onConnectError(context.getString(R.string.connect_receive_unknown_message));
@@ -288,31 +175,20 @@ public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCo
         {
             e.printStackTrace();
         }
-        //commandIssuer.enqueueCommand(new CanonInitEventRequest(this, connectionNumber));
-        //commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_OPEN_SESSION, 0x1002, 4, 0x41));
     }
 
     private boolean checkRegistrationMessage(byte[] receiveData)
     {
         // データ(Connection Number)がないときにはエラーと判断する
-        if ((receiveData == null)||(receiveData.length < 12))
-        {
-            return (false);
-        }
-        return (true);
+        return (!((receiveData == null)||(receiveData.length < 12)));
     }
 
     private boolean checkEventInitialize(byte[] receiveData)
     {
         Log.v(TAG, "checkEventInitialize() ");
-        if (receiveData == null)
-        {
-            return (false);
-        }
-        return (true);
+        return (!(receiveData == null));
     }
 
-
     private void connectFinished()
     {
         try
@@ -323,7 +199,7 @@ public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCo
             // ちょっと待つ
             Thread.sleep(1000);
 
-            interfaceProvider.getAsyncEventCommunication().connect();
+            //interfaceProvider.getAsyncEventCommunication().connect();
             //interfaceProvider.getCameraStatusWatcher().startStatusWatch(interfaceProvider.getStatusListener());  ステータスの定期確認は実施しない
 
             // 接続成功!のメッセージを出す
@@ -349,7 +225,7 @@ public class CanonCameraConnectSequenceForPlayback implements Runnable, IPtpIpCo
                     // カメラとの接続確立を通知する
                     cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connected));
                     cameraStatusReceiver.onCameraConnected();
-                    Log.v(TAG, "onConnectNotify()");
+                    Log.v(TAG, " onConnectNotify()");
                 }
             });
             thread.start();
index e380d98..8f1fa50 100644 (file)
@@ -188,14 +188,14 @@ public class CanonConnection implements ICameraConnection
     @Override
     public CameraConnectionStatus getConnectionStatus()
     {
-        Log.v(TAG, "getConnectionStatus()");
+        Log.v(TAG, " getConnectionStatus()");
         return (connectionStatus);
     }
 
     @Override
     public void forceUpdateConnectionStatus(CameraConnectionStatus status)
     {
-        Log.v(TAG, "forceUpdateConnectionStatus()");
+        Log.v(TAG, " forceUpdateConnectionStatus()");
         connectionStatus = status;
     }
 
@@ -204,7 +204,7 @@ public class CanonConnection implements ICameraConnection
      */
     private void disconnectFromCamera(final boolean powerOff)
     {
-        Log.v(TAG, "disconnectFromCamera()");
+        Log.v(TAG, " disconnectFromCamera()");
         try
         {
             cameraExecutor.execute(new CanonCameraDisconnectSequence(context, interfaceProvider));
@@ -220,7 +220,7 @@ public class CanonConnection implements ICameraConnection
      */
     private void connectToCamera()
     {
-        Log.v(TAG, "connectToCamera()");
+        Log.v(TAG, " connectToCamera()");
         connectionStatus = CameraConnectionStatus.CONNECTING;
         try
         {
@@ -228,7 +228,7 @@ public class CanonConnection implements ICameraConnection
         }
         catch (Exception e)
         {
-            Log.v(TAG, "connectToCamera() EXCEPTION : " + e.getMessage());
+            Log.v(TAG, " connectToCamera() EXCEPTION : " + e.getMessage());
             e.printStackTrace();
         }
     }
index ece456a..0a2f43f 100644 (file)
@@ -13,7 +13,6 @@ import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpComma
 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.specific.CanonInitEventRequest;
-import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific.StatusRequestMessage;
 
 import java.io.BufferedReader;
 import java.io.DataOutputStream;
@@ -51,20 +50,6 @@ public class PtpIpStatusChecker implements IPtpIpCommandCallback, ICameraStatusW
         this.statusHolder = new PtpIpStatusHolder();
         this.ipAddress = ip;
         this.portNumber = portNumber;
-
-/*
-        try
-        {
-            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
-            String pollingWait = preferences.getString(IPreferencePropertyAccessor.FUJIX_COMMAND_POLLING_WAIT, IPreferencePropertyAccessor.FUJIX_COMMAND_POLLING_WAIT_DEFAULT_VALUE);
-            this.sleepMs = Integer.parseInt(pollingWait);
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            this.sleepMs = 400;
-        }
-*/
         Log.v(TAG, "POLLING WAIT : " + sleepMs);
     }
 
@@ -368,7 +353,7 @@ public class PtpIpStatusChecker implements IPtpIpCommandCallback, ICameraStatusW
     private void receive_from_camera(boolean isDumpReceiveLog, int id, IPtpIpCommandCallback callback, boolean receiveAgain, int delayMs) {
         try {
             sleep(delayMs);
-            Log.v(TAG, "  ----- receive_from_camera() ----- : " + isDumpReceiveLog + "  " + receiveAgain);
+
             boolean isFirstTime = true;
             int totalReadBytes;
             int receive_message_buffer_size = BUFFER_SIZE;
@@ -422,7 +407,7 @@ public class PtpIpStatusChecker implements IPtpIpCommandCallback, ICameraStatusW
                 }
                 if (isDumpReceiveLog) {
                     // ログに受信メッセージを出力する
-                    Log.v(TAG, " receive_from_camera() : " + read_bytes + " bytes. [" + receive_message_buffer_size + "]");
+                    Log.v(TAG, " receive_from_camera() : " + read_bytes + " bytes.");
                     dump_bytes("RECV[" + receive_body.length + "] ", receive_body);
                 }
                 if (callback != null) {
index 16b93b9..34a3d5a 100644 (file)
     <string name="pref_summary_sony_use_smartphone_transfer">うまく通信できない場合にチェックを入れてください。</string>
 
     <string name="connect_start_2">準備中&#8230;</string>
-    <string name="canon_connect_connecting1">接続中&#8230;(1/12)</string>
-    <string name="canon_connect_connecting2">接続中&#8230;(2/12)</string>
-    <string name="canon_connect_connecting3">接続中&#8230;(3/12)</string>
-    <string name="canon_connect_connecting4">接続中&#8230;(4/12)</string>
-    <string name="canon_connect_connecting5">接続中&#8230;(5/12)</string>
-    <string name="canon_connect_connecting6">接続中&#8230;(6/12)</string>
-    <string name="canon_connect_connecting7">接続中&#8230;(7/12)</string>
-    <string name="canon_connect_connecting8">接続中&#8230;(8/12)</string>
-    <string name="canon_connect_connecting9">接続中&#8230;(9/12)</string>
-    <string name="canon_connect_connecting10">接続中&#8230;(10/12)</string>
-    <string name="canon_connect_connecting11">接続中&#8230;(11/12)</string>
-    <string name="canon_connect_connecting12">接続中&#8230;(12/12)</string>
+    <string name="canon_connect_connecting1">接続中&#8230;(1/5)</string>
+    <string name="canon_connect_connecting2">接続中&#8230;(2/5)</string>
+    <string name="canon_connect_connecting3">接続中&#8230;(3/5)</string>
+    <string name="canon_connect_connecting4">接続中&#8230;(4/5)</string>
+    <string name="canon_connect_connecting5">接続中&#8230;(5/5)</string>
 
 </resources>
index 0c7345e..495e8b1 100644 (file)
     <string name="pref_summary_sony_use_smartphone_transfer">If you cannot communicate, please check this.</string>
 
     <string name="connect_start_2">Preparing&#8230;</string>
-    <string name="canon_connect_connecting1">Connecting&#8230;(1/12)</string>
-    <string name="canon_connect_connecting2">Connecting&#8230;(2/12)</string>
-    <string name="canon_connect_connecting3">Connecting&#8230;(3/12)</string>
-    <string name="canon_connect_connecting4">Connecting&#8230;(4/12)</string>
-    <string name="canon_connect_connecting5">Connecting&#8230;(5/12)</string>
-    <string name="canon_connect_connecting6">Connecting&#8230;(6/12)</string>
-    <string name="canon_connect_connecting7">Connecting&#8230;(7/12)</string>
-    <string name="canon_connect_connecting8">Connecting&#8230;(8/12)</string>
-    <string name="canon_connect_connecting9">Connecting&#8230;(9/12)</string>
-    <string name="canon_connect_connecting10">Connecting&#8230;(10/12)</string>
-    <string name="canon_connect_connecting11">Connecting&#8230;(11/12)</string>
-    <string name="canon_connect_connecting12">Connecting&#8230;(12/12)</string>
+    <string name="canon_connect_connecting1">Connecting&#8230;(1/5)</string>
+    <string name="canon_connect_connecting2">Connecting&#8230;(2/5)</string>
+    <string name="canon_connect_connecting3">Connecting&#8230;(3/5)</string>
+    <string name="canon_connect_connecting4">Connecting&#8230;(4/5)</string>
+    <string name="canon_connect_connecting5">Connecting&#8230;(5/5)</string>
 
 </resources>