applicationId "net.osdn.gokigen.gr2control"
minSdkVersion 14
targetSdkVersion 29
- versionCode 1002007
- versionName "1.2.7"
+ versionCode 1003001
+ versionName "1.3.1"
}
buildTypes {
release {
import android.app.Activity;
import android.content.SharedPreferences;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.FujiXInterfaceProvider;
import net.osdn.gokigen.gr2control.camera.olympus.IOlympusInterfaceProvider;
import net.osdn.gokigen.gr2control.camera.olympus.wrapper.OlympusInterfaceProvider;
import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl;
//private final SonyCameraWrapper sony;
private final OlympusInterfaceProvider olympus;
private final RicohGr2InterfaceProvider ricohGr2;
+ private final FujiXInterfaceProvider fujiX;
private final Activity context;
private ICameraConnection.CameraConnectionMethod connectionMethod = ICameraConnection.CameraConnectionMethod.UNKNOWN;
this.context = context;
olympus = new OlympusInterfaceProvider(context, provider);
ricohGr2 = new RicohGr2InterfaceProvider(context, provider);
+ fujiX = new FujiXInterfaceProvider(context, provider);
//sony = new SonyCameraWrapper(context, provider);
}
{
return (olympus.getOlyCameraConnection());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getCameraConnection());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getRicohGr2CameraConnection());
{
return (olympus.getButtonControl());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getButtonControl());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getButtonControl());
{
return (olympus.getDisplayInjector());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getDisplayInjector());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getDisplayInjector());
{
return (olympus.getLiveViewControl());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getLiveViewControl());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getLiveViewControl());
{
return (olympus.getLiveViewListener());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getLiveViewListener());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getLiveViewListener());
{
return (olympus.getFocusingControl());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getFocusingControl());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getFocusingControl());
{
return (olympus.getCameraInformation());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getCameraInformation());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getCameraInformation());
{
return (olympus.getZoomLensControl());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getZoomLensControl());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getZoomLensControl());
{
return (olympus.getCaptureControl());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getCaptureControl());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getCaptureControl());
{
return (olympus.getCameraStatusListHolder());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getCameraStatusListHolder());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getCameraStatusListHolder());
{
return (olympus.getCameraStatusWatcher());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getCameraStatusWatcher());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getCameraStatusWatcher());
{
return (olympus.getPlaybackControl());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getPlaybackControl());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getPlaybackControl());
{
return (olympus.getHardwareStatus());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getHardwareStatus());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getHardwareStatus());
{
return (olympus.getCameraRunMode());
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+ {
+ return (fujiX.getCameraRunMode());
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
{
return (ricohGr2.getCameraRunMode());
{
ret = ICameraConnection.CameraConnectionMethod.RICOH_GR2;
}
+ else if (connectionMethod.contains("FUJI_X"))
+ {
+ ret = ICameraConnection.CameraConnectionMethod.FUJI_X;
+ }
else // if (connectionMethod.contains("OPC"))
{
ret = ICameraConnection.CameraConnectionMethod.OPC;
package net.osdn.gokigen.gr2control.camera.fuji_x;
+import androidx.annotation.NonNull;
+
import net.osdn.gokigen.gr2control.camera.ICameraButtonControl;
import net.osdn.gokigen.gr2control.camera.ICameraConnection;
import net.osdn.gokigen.gr2control.camera.ICameraHardwareStatus;
import net.osdn.gokigen.gr2control.camera.IFocusingControl;
import net.osdn.gokigen.gr2control.camera.ILiveViewControl;
import net.osdn.gokigen.gr2control.camera.ICameraRunMode;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandPublisher;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommunication;
import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl;
import net.osdn.gokigen.gr2control.camera.IZoomLensControl;
+import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener;
/**
*/
public interface IFujiXInterfaceProvider
{
- ICameraConnection getRicohGr2CameraConnection();
+ ICameraConnection getCameraConnection();
ILiveViewControl getLiveViewControl();
ILiveViewListener getLiveViewListener();
IFocusingControl getFocusingControl();
ICameraHardwareStatus getHardwareStatus();
ICameraRunMode getCameraRunMode();
+
+
+ IFujiXCommunication getLiveviewCommunication();
+ IFujiXCommunication getAsyncEventCommunication();
+ IFujiXCommunication getCommandCommunication();
+ IFujiXCommandCallback getStatusHolder();
+ ICameraStatusUpdateNotify getStatusListener();
+ IFujiXCommandPublisher getCommandPublisher();
+ void setAsyncEventReceiver(@NonNull IFujiXCommandCallback receiver);
}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper;
+
+import android.app.Activity;
+import android.content.SharedPreferences;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.preference.PreferenceManager;
+
+import net.osdn.gokigen.gr2control.camera.ICameraButtonControl;
+import net.osdn.gokigen.gr2control.camera.ICameraConnection;
+import net.osdn.gokigen.gr2control.camera.ICameraHardwareStatus;
+import net.osdn.gokigen.gr2control.camera.ICameraInformation;
+import net.osdn.gokigen.gr2control.camera.ICameraRunMode;
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
+import net.osdn.gokigen.gr2control.camera.ICameraStatusReceiver;
+import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
+import net.osdn.gokigen.gr2control.camera.ICaptureControl;
+import net.osdn.gokigen.gr2control.camera.IDisplayInjector;
+import net.osdn.gokigen.gr2control.camera.IFocusingControl;
+import net.osdn.gokigen.gr2control.camera.IFocusingModeNotify;
+import net.osdn.gokigen.gr2control.camera.ILiveViewControl;
+import net.osdn.gokigen.gr2control.camera.IZoomLensControl;
+import net.osdn.gokigen.gr2control.camera.fuji_x.IFujiXInterfaceProvider;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandPublisher;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommunication;
+import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl;
+import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2CameraButtonControl;
+import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2CameraCaptureControl;
+import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2CameraFocusControl;
+import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2CameraZoomLensControl;
+import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2HardwareStatus;
+import net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper.connection.RicohGr2Connection;
+import net.osdn.gokigen.gr2control.liveview.IAutoFocusFrameDisplay;
+import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
+import net.osdn.gokigen.gr2control.liveview.IIndicatorControl;
+import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener;
+import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
+
+public class FujiXInterfaceProvider implements IFujiXInterfaceProvider, IDisplayInjector
+{
+ private final String TAG = toString();
+ //private final Activity activity;
+ //private final ICameraStatusReceiver provider;
+ private final RicohGr2Connection gr2Connection;
+ private final RicohGr2CameraButtonControl buttonControl;
+ private final FujiXStatusChecker statusChecker;
+ private final FujiXPlaybackControl playbackControl;
+ private final RicohGr2HardwareStatus hardwareStatus;
+ private final FujiXRunMode runMode;
+
+ private FujiXLiveViewControl liveViewControl;
+ private RicohGr2CameraCaptureControl captureControl;
+ private RicohGr2CameraZoomLensControl zoomControl;
+ private RicohGr2CameraFocusControl focusControl;
+
+ /**
+ *
+ *
+ */
+ public FujiXInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
+ {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ int communicationTimeoutMs = 5000; // デフォルトは 5000ms とする
+ try
+ {
+ communicationTimeoutMs = Integer.parseInt(preferences.getString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT_DEFAULT_VALUE)) * 1000;
+ if (communicationTimeoutMs < 5000)
+ {
+ communicationTimeoutMs = 5000; // 最小値は 5000msとする。
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ //this.activity = context;
+ //this.provider = provider;
+ gr2Connection = new RicohGr2Connection(context, provider);
+ liveViewControl = new FujiXLiveViewControl();
+ zoomControl = new RicohGr2CameraZoomLensControl();
+ buttonControl = new RicohGr2CameraButtonControl();
+ statusChecker = new FujiXStatusChecker(500);
+ playbackControl = new FujiXPlaybackControl(communicationTimeoutMs);
+ hardwareStatus = new RicohGr2HardwareStatus();
+ runMode = new FujiXRunMode();
+ }
+
+ public void prepare()
+ {
+ Log.v(TAG, "prepare()");
+ }
+
+ @Override
+ public void injectDisplay(IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator, IFocusingModeNotify focusingModeNotify)
+ {
+ Log.v(TAG, "injectDisplay()");
+ focusControl = new RicohGr2CameraFocusControl(true, frameDisplayer, indicator);
+ captureControl = new RicohGr2CameraCaptureControl(true, false, frameDisplayer, statusChecker);
+ }
+
+ @Override
+ public ICameraConnection getCameraConnection()
+ {
+ return (gr2Connection);
+ }
+
+ @Override
+ public ILiveViewControl getLiveViewControl()
+ {
+ return (liveViewControl);
+ }
+
+ @Override
+ public ILiveViewListener getLiveViewListener()
+ {
+ if (liveViewControl == null)
+ {
+ return (null);
+ }
+ return (liveViewControl.getLiveViewListener());
+ }
+
+ @Override
+ public IFocusingControl getFocusingControl()
+ {
+ return (focusControl);
+ }
+
+ @Override
+ public ICameraInformation getCameraInformation()
+ {
+ return (null);
+ }
+
+ @Override
+ public IZoomLensControl getZoomLensControl()
+ {
+ return (zoomControl);
+ }
+
+ @Override
+ public ICaptureControl getCaptureControl()
+ {
+ return (captureControl);
+ }
+
+ @Override
+ public IDisplayInjector getDisplayInjector()
+ {
+ return (this);
+ }
+
+ @Override
+ public ICameraStatus getCameraStatusListHolder()
+ {
+ return (statusChecker);
+ }
+
+ @Override
+ public ICameraButtonControl getButtonControl()
+ {
+ return (buttonControl);
+ }
+
+ @Override
+ public ICameraStatusWatcher getCameraStatusWatcher()
+ {
+ return (statusChecker);
+ }
+
+ @Override
+ public IPlaybackControl getPlaybackControl()
+ {
+ return (playbackControl);
+ }
+
+ @Override
+ public ICameraHardwareStatus getHardwareStatus()
+ {
+ return (hardwareStatus);
+ }
+
+ @Override
+ public ICameraRunMode getCameraRunMode()
+ {
+ return (runMode);
+ }
+
+ @Override
+ public IFujiXCommunication getLiveviewCommunication() {
+ return null;
+ }
+
+ @Override
+ public IFujiXCommunication getAsyncEventCommunication() {
+ return null;
+ }
+
+ @Override
+ public IFujiXCommunication getCommandCommunication()
+ {
+ return (null);
+ }
+
+ @Override
+ public IFujiXCommandCallback getStatusHolder()
+ {
+ return null;
+ }
+
+ @Override
+ public ICameraStatusUpdateNotify getStatusListener() {
+ return null;
+ }
+
+ @Override
+ public IFujiXCommandPublisher getCommandPublisher()
+ {
+ return null;
+ }
+
+ @Override
+ public void setAsyncEventReceiver(@NonNull IFujiXCommandCallback receiver)
+ {
+
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper;
+
+import net.osdn.gokigen.gr2control.camera.ILiveViewControl;
+import net.osdn.gokigen.gr2control.liveview.liveviewlistener.CameraLiveViewListenerImpl;
+import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener;
+
+public class FujiXLiveViewControl implements ILiveViewControl
+{
+ private final String TAG = toString();
+ private final CameraLiveViewListenerImpl liveViewListener;
+
+ /**
+ *
+ *
+ */
+ FujiXLiveViewControl()
+ {
+ this.liveViewListener = new CameraLiveViewListenerImpl();
+ }
+
+
+ @Override
+ public void changeLiveViewSize(String size)
+ {
+
+ }
+
+ @Override
+ public void startLiveView(boolean isCameraScreen)
+ {
+
+ }
+
+ @Override
+ public void stopLiveView()
+ {
+
+ }
+
+ @Override
+ public void updateDigitalZoom()
+ {
+
+ }
+
+ @Override
+ public void updateMagnifyingLiveViewScale(boolean isChangeScale)
+ {
+
+ }
+
+ @Override
+ public float getMagnifyingLiveViewScale()
+ {
+ return 0;
+ }
+
+ @Override
+ public float getDigitalZoomScale()
+ {
+ return 0;
+ }
+
+
+ public ILiveViewListener getLiveViewListener()
+ {
+ return (liveViewListener);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.ICameraFileInfo;
+import net.osdn.gokigen.gr2control.camera.playback.IContentInfoCallback;
+import net.osdn.gokigen.gr2control.camera.playback.IDownloadContentCallback;
+import net.osdn.gokigen.gr2control.camera.playback.IDownloadContentListCallback;
+import net.osdn.gokigen.gr2control.camera.playback.IDownloadThumbnailImageCallback;
+import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl;
+
+public class FujiXPlaybackControl implements IPlaybackControl
+{
+ private final String TAG = toString();
+ private static final int DEFAULT_TIMEOUT = 5000;
+ private final int timeoutValue;
+
+ FujiXPlaybackControl(int timeoutMSec)
+ {
+ this.timeoutValue = Math.max(DEFAULT_TIMEOUT, timeoutMSec); // (timeoutMSec < DEFAULT_TIMEOUT) ? DEFAULT_TIMEOUT : timeoutMSec;
+ }
+
+
+ @Override
+ public String getRawFileSuffix()
+ {
+ return null;
+ }
+
+ @Override
+ public void downloadContentList(@NonNull IDownloadContentListCallback callback)
+ {
+
+ }
+
+ @Override
+ public void getContentInfo(@NonNull String path, @NonNull IContentInfoCallback callback)
+ {
+
+ }
+
+ @Override
+ public void updateCameraFileInfo(ICameraFileInfo info)
+ {
+
+ }
+
+ @Override
+ public void downloadContentScreennail(@NonNull String path, @NonNull IDownloadThumbnailImageCallback callback)
+ {
+
+ }
+
+ @Override
+ public void downloadContentThumbnail(@NonNull String path, @NonNull IDownloadThumbnailImageCallback callback)
+ {
+
+ }
+
+ @Override
+ public void downloadContent(@NonNull String path, boolean isSmallSize, @NonNull IDownloadContentCallback callback)
+ {
+
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper;
+
+import net.osdn.gokigen.gr2control.camera.ICameraRunMode;
+
+public class FujiXRunMode implements ICameraRunMode
+{
+
+ FujiXRunMode()
+ {
+
+ }
+
+
+ @Override
+ public void changeRunMode(boolean isRecording)
+ {
+
+ }
+
+ @Override
+ public boolean isRecordingMode()
+ {
+ return false;
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
+import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
+import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FujiXStatusChecker implements ICameraStatusWatcher, ICameraStatus
+{
+ private final String TAG = toString();
+ private final int sleepMs;
+
+ FujiXStatusChecker(int sleepMs)
+ {
+ this.sleepMs = sleepMs;
+
+ }
+
+ @NonNull
+ @Override
+ public List<String> getStatusList(@NonNull String key)
+ {
+ List<String> statusList = new ArrayList<>();
+
+ return (statusList);
+ }
+
+ @Override
+ public String getStatus(@NonNull String key)
+ {
+ return (null);
+ }
+
+ @Override
+ public void setStatus(@NonNull String key, @NonNull String value)
+ {
+
+ }
+
+ @Override
+ public void startStatusWatch(@NonNull ICameraStatusUpdateNotify notifier)
+ {
+
+ }
+
+ @Override
+ public void stopStatusWatch()
+ {
+
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper;
+
+public class FujiXStatusHolder
+{
+
+
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper;
+
+public interface IFujiXRunModeHolder
+{
+ void transitToRecordingMode(boolean isFinished);
+ void transitToPlaybackMode(boolean isFinished);
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command;
+
+public interface IFujiXCommand
+{
+ // メッセージの識別子
+ int getId();
+
+ // 短い長さのメッセージを受け取ったときに再度受信するか
+ boolean receiveAgainShortLengthMessage();
+
+ // シーケンス番号を埋め込むかどうか
+ boolean useSequenceNumber();
+
+ // シーケンス番号を更新(+1)するかどうか
+ boolean isIncrementSeqNumber();
+
+ // コマンドの受信待ち時間(単位:ms)
+ int receiveDelayMs();
+
+ // 送信するメッセージボディ
+ byte[] commandBody();
+
+ // 送信するメッセージボディ(連続送信する場合)
+ byte[] commandBody2();
+
+ // コマンド送信結果(応答)の通知先
+ IFujiXCommandCallback responseCallback();
+
+ // デバッグ用: ログ(logcat)に通信結果を残すかどうか
+ boolean dumpLog();
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command;
+
+public interface IFujiXCommandCallback
+{
+ void receivedMessage(int id, byte[] rx_body);
+ void onReceiveProgress(int currentBytes, int totalBytes, byte[] rx_body);
+ boolean isReceiveMulti();
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command;
+
+import androidx.annotation.NonNull;
+
+public interface IFujiXCommandPublisher
+{
+ boolean isConnected();
+ boolean enqueueCommand(@NonNull IFujiXCommand command);
+
+ void start();
+ void stop();
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command;
+
+public interface IFujiXCommunication
+{
+ boolean connect();
+ void disconnect();
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command;
+
+public interface IFujiXMessages
+{
+ int SEQ_DUMMY = 0;
+ int SEQ_REGISTRATION = 1;
+ int SEQ_START = 2;
+ int SEQ_START_2ND = 3;
+ int SEQ_START_2ND_READ = 10;
+ int SEQ_START_2ND_RECEIVE = 4;
+ int SEQ_START_3RD = 5;
+ int SEQ_START_4TH = 6;
+ int SEQ_CAMERA_REMOTE = 7;
+ int SEQ_START_5TH = 8;
+ int SEQ_STATUS_REQUEST = 9;
+ int SEQ_QUERY_CAMERA_CAPABILITIES = 11;
+
+ int SEQ_CHANGE_TO_PLAYBACK_1ST = 12;
+ int SEQ_CHANGE_TO_PLAYBACK_2ND = 13;
+ int SEQ_CHANGE_TO_PLAYBACK_3RD = 14;
+ int SEQ_CHANGE_TO_PLAYBACK_4TH = 15;
+
+ int SEQ_CHANGE_TO_LIVEVIEW_1ST = 16;
+ int SEQ_CHANGE_TO_LIVEVIEW_2ND = 17;
+ int SEQ_CHANGE_TO_LIVEVIEW_3RD = 18;
+ int SEQ_CHANGE_TO_LIVEVIEW_4TH = 19;
+ int SEQ_CHANGE_TO_LIVEVIEW_5TH = 20;
+
+ int SEQ_SET_PROPERTY_VALUE = 21;
+ int SEQ_FOCUS_LOCK = 22;
+ int SEQ_FOCUS_UNLOCK = 23;
+ int SEQ_CAPTURE = 24;
+
+ int SEQ_IMAGE_INFO = 25;
+ int SEQ_THUMBNAIL = 26;
+ int SEQ_FULL_IMAGE = 27;
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+
+public class CaptureCommand extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public CaptureCommand(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CAPTURE);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : shutter (0x100e)
+ (byte)0x0e, (byte)0x10,
+
+ // sequence number
+ (byte)0x0B, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+
+public class CommandGeneric extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+ private final int bodySize;
+ private final byte id0;
+ private final byte id1;
+ private final byte data0;
+ private final byte data1;
+ private final byte data2;
+ private final byte data3;
+ private final byte data4;
+ private final byte data5;
+ private final byte data6;
+ private final byte data7;
+
+ public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id)
+ {
+ this.callback = callback;
+ this.bodySize = 0;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = 0;
+ data1 = 0;
+ data2 = 0;
+ data3 = 0;
+
+ data4 = 0;
+ data5 = 0;
+ data6 = 0;
+ data7 = 0;
+ }
+
+ public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value));
+ data5 = ((byte)((0x0000ff00 & value) >> 8));
+ data6 = ((byte)((0x00ff0000 & value) >> 16));
+ data7 = ((byte)((0xff000000 & value) >> 24));
+ }
+
+ public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value2));
+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
+ data7 = ((byte)((0xff000000 & value2) >> 24));
+ }
+
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (999);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ if (bodySize == 2)
+ {
+ return (new byte[]{
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x01, (byte) 0x00,
+
+ // message_header.type
+ id0, id1,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // data ...
+ data0, data1,
+ });
+ }
+ else if (bodySize == 4)
+ {
+ return (new byte[]{
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x01, (byte) 0x00,
+
+ // message_header.type
+ id0, id1,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // data ...
+ data0, data1, data2, data3,
+ });
+ }
+ else if (bodySize == 8)
+ {
+ return (new byte[]{
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x01, (byte) 0x00,
+
+ // message_header.type
+ id0, id1,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // data ...
+ data0, data1, data2, data3, data4, data5, data6, data7,
+ });
+ }
+ else // ボディ長が 2, 4, 8 以外の場合...
+ {
+ return (new byte[]{
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x01, (byte) 0x00,
+
+ // message_header.type
+ id0, id1,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ });
+ }
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class FocusLock extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+ private final byte pointX;
+ private final byte pointY;
+
+ public FocusLock(byte pointX, byte pointY, @NonNull IFujiXCommandCallback callback)
+ {
+ this.pointX = pointX;
+ this.pointY = pointY;
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_FOCUS_LOCK);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : focus_point (0x9026)
+ (byte)0x26, (byte)0x90,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ pointY, pointX, (byte)0x02, (byte)0x03,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class FocusUnlock extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public FocusUnlock(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_FOCUS_UNLOCK);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : focus_unlock (0x9027)
+ (byte)0x27, (byte)0x90,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommand;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class FujiXCommandBase implements IFujiXCommand
+{
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_DUMMY);
+ }
+
+ @Override
+ public boolean receiveAgainShortLengthMessage()
+ {
+ return (true);
+ }
+
+ @Override
+ public boolean useSequenceNumber()
+ {
+ return (true);
+ }
+
+ @Override
+ public boolean isIncrementSeqNumber()
+ {
+ return (true);
+ }
+
+ @Override
+ public int receiveDelayMs()
+ {
+ return (100);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[12]);
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (null);
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (null);
+ }
+
+ @Override
+ public boolean dumpLog()
+ {
+ return (true);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class GetFullImage extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+ private final byte lower;
+ private final byte upper;
+
+ public GetFullImage(int indexNumber, @NonNull IFujiXCommandCallback callback)
+ {
+ this.lower = ((byte) (0x000000ff & indexNumber));
+ this.upper = ((byte)((0x0000ff00 & indexNumber) >> 8));
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_FULL_IMAGE);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : full_image (0x101b)
+ (byte)0x1b, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ... (index number)
+ lower, upper, (byte)0x00, (byte)0x00,
+
+ // 現物合わせ1 : 0~
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ // 現物合わせ2 : ~0x01000000 bytes
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
+ });
+ }
+ @Override
+ public boolean dumpLog()
+ {
+ return (false);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+
+public class GetImageInfo extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+ private final int id;
+ private final byte lower;
+ private final byte upper;
+
+ public GetImageInfo(int id, int indexNumber, @NonNull IFujiXCommandCallback callback)
+ {
+ this.id = id;
+ this.lower = ((byte) (0x000000ff & indexNumber));
+ this.upper = ((byte)((0x0000ff00 & indexNumber) >> 8));
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (id);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : image_info (0x1008)
+ (byte)0x08, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ lower, upper, (byte)0x00, (byte)0x00,
+ });
+ }
+ @Override
+ public boolean dumpLog()
+ {
+ return (false);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class GetThumbNail extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+ private final byte lower;
+ private final byte upper;
+
+ public GetThumbNail(int indexNumber, @NonNull IFujiXCommandCallback callback)
+ {
+ this.lower = ((byte) (0x000000ff & indexNumber));
+ this.upper = ((byte)((0x0000ff00 & indexNumber) >> 8));
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_THUMBNAIL);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : ThumbNail (0x100a)
+ (byte)0x0a, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ lower, upper, (byte)0x00, (byte)0x00,
+ });
+ }
+ @Override
+ public boolean dumpLog()
+ {
+ return (false);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class QueryCameraCapabilities extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public QueryCameraCapabilities(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_QUERY_CAMERA_CAPABILITIES);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : camera_capabilities (0x902b)
+ (byte)0x2b, (byte)0x90,
+
+ // sequence number
+ (byte)0x07, (byte)0x00, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+
+public class ReceiveOnly extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ReceiveOnly(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_START_2ND_RECEIVE);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (null);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class SetPropertyValue extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+ private final int bodySize;
+ private final byte id0;
+ private final byte id1;
+ private final byte data0;
+ private final byte data1;
+ private final byte data2;
+ private final byte data3;
+ private final byte data4;
+ private final byte data5;
+ private final byte data6;
+ private final byte data7;
+
+ public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id)
+ {
+ this.callback = callback;
+ this.bodySize = 0;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = 0;
+ data1 = 0;
+ data2 = 0;
+ data3 = 0;
+
+ data4 = 0;
+ data5 = 0;
+ data6 = 0;
+ data7 = 0;
+ }
+
+ public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value));
+ data5 = ((byte)((0x0000ff00 & value) >> 8));
+ data6 = ((byte)((0x00ff0000 & value) >> 16));
+ data7 = ((byte)((0xff000000 & value) >> 24));
+ }
+
+ public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value2));
+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
+ data7 = ((byte)((0xff000000 & value2) >> 24));
+ }
+
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_SET_PROPERTY_VALUE);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte)0x16, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる)
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // command code
+ id0, id1, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ if (bodySize == 2)
+ {
+ return (new byte[]{
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x02, (byte) 0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte) 0x16, (byte) 0x10,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // ...data...
+ data0, data1,
+ });
+ }
+ else if (bodySize == 4)
+ {
+ return (new byte[]{
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x02, (byte) 0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte) 0x16, (byte) 0x10,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // ...data...
+ data0, data1, data2, data3,
+ });
+ }
+ else if (bodySize == 8)
+ {
+ return (new byte[]{
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x02, (byte) 0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte) 0x16, (byte) 0x10,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // ...data...
+ data0, data1, data2, data3, data4, data5, data6, data7
+ });
+ }
+ else // その他... (ボディ長の指定が 2, 4, 8 以外の場合は ボディ長なし としてしまう)
+ {
+ return (new byte[]{
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x02, (byte) 0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte) 0x16, (byte) 0x10,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ });
+ }
+
+ }
+
+ @Override
+ public boolean dumpLog()
+ {
+ return (true);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+
+public class StatusRequestMessage extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public StatusRequestMessage(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_STATUS_REQUEST);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015) : 0xd212 (status_request)
+ (byte)0x15, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public boolean dumpLog()
+ {
+ return (false);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToLiveView1st extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToLiveView1st(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_1ST);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x00, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x06, (byte)0x00,
+
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToLiveView2nd extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToLiveView2nd(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_2ND);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x01, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x05, (byte)0x00,
+
+ });
+ }
+
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToLiveView3rd extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToLiveView3rd(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_3RD);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015) : 0xd212 (status_request)
+ (byte)0x15, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToLiveView4th extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToLiveView4th(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_4TH);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x07, (byte)0x00, (byte)0x02, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToLiveView5th extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToLiveView5th(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_5TH);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : 0x101c
+ (byte)0x1c, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToPlayback1st extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToPlayback1st(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_1ST);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x00, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x06, (byte)0x00,
+
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToPlayback2nd extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToPlayback2nd(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_2ND);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x01, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x0b, (byte)0x00,
+
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToPlayback3rd extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToPlayback3rd(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_3RD);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015) : 0xd212 (status_request)
+ (byte)0x15, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x25, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class ChangeToPlayback4th extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public ChangeToPlayback4th(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_4TH);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x25, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x02, (byte)0x00,
+
+ });
+ }
+
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class CameraRemoteMessage extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public CameraRemoteMessage(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_CAMERA_REMOTE);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : camera_remote (0x101c)
+ (byte)0x1c, (byte)0x10,
+
+ // sequence number
+ (byte)0x09, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class RegistrationMessage extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public RegistrationMessage(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_REGISTRATION);
+ }
+
+ @Override
+ public boolean receiveAgainShortLengthMessage()
+ {
+ return (false);
+ }
+
+ @Override
+ public boolean useSequenceNumber()
+ {
+ return (false);
+ }
+
+ @Override
+ public boolean isIncrementSeqNumber()
+ {
+ return (false);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // header
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xf2, (byte)0xe4, (byte)0x53, (byte)0x8f,
+ (byte)0xad, (byte)0xa5, (byte)0x48, (byte)0x5d, (byte)0x87, (byte)0xb2, (byte)0x7f, (byte)0x0b,
+ (byte)0xd3, (byte)0xd5, (byte)0xde, (byte)0xd0, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+/**/
+ // device_name 'GOKIGEN___a01Series'
+ (byte)0x47, (byte)0x00, (byte)0x4f, (byte)0x00, (byte)0x4b, (byte)0x00, (byte)0x49, (byte)0x00,
+ (byte)0x47, (byte)0x00, (byte)0x45, (byte)0x00, (byte)0x4e, (byte)0x00, (byte)0x5f, (byte)0x00,
+ (byte)0x5f, (byte)0x00, (byte)0x5f, (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x30, (byte)0x00,
+ (byte)0x31, (byte)0x00, (byte)0x53, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x72, (byte)0x00,
+ (byte)0x69, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+/**/
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class StartMessage extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public StartMessage(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_START);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : START (0x1002) : OpenSession
+ (byte)0x02, (byte)0x10,
+
+ // sequence number
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class StartMessage2nd extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public StartMessage2nd(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_START_2ND);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : START (0x1002) : OpenSession
+ (byte)0x02, (byte)0x10,
+
+ // sequence number
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.connection.FujiXCameraConnectSequence;
+
+public class StartMessage2ndRead extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public StartMessage2ndRead(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_START_2ND_READ);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015) : 0xd212 (status_request)
+ (byte)0x15, (byte)0x10,
+
+ // sequence number
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class StartMessage3rd extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public StartMessage3rd(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_START_3RD);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x01, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : SetDevicePropValue
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x05, (byte)0x00,
+
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class StartMessage4th extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public StartMessage4th(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_START_4TH);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015) : 0xdf24
+ (byte)0x15, (byte)0x10,
+
+ // sequence number
+ (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
+
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start;
+
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.FujiXCommandBase;
+
+public class StartMessage5th extends FujiXCommandBase
+{
+ private final IFujiXCommandCallback callback;
+
+ public StartMessage5th(@NonNull IFujiXCommandCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public IFujiXCommandCallback responseCallback()
+ {
+ return (callback);
+ }
+
+ @Override
+ public int getId()
+ {
+ return (IFujiXMessages.SEQ_START_5TH);
+ }
+
+ @Override
+ public byte[] commandBody()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : 0xdf24
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
+ });
+ }
+
+ @Override
+ public byte[] commandBody2()
+ {
+ return (new byte[] {
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016) : 0x00020007
+ (byte)0x16, (byte)0x10,
+
+ // sequence number
+ (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x07, (byte)0x00, (byte)0x02, (byte)0x00,
+ });
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.connection;
+
+import android.app.Activity;
+import android.content.SharedPreferences;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.preference.PreferenceManager;
+
+import net.osdn.gokigen.gr2control.R;
+import net.osdn.gokigen.gr2control.camera.ICameraConnection;
+import net.osdn.gokigen.gr2control.camera.ICameraStatusReceiver;
+import net.osdn.gokigen.gr2control.camera.fuji_x.IFujiXInterfaceProvider;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandPublisher;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.QueryCameraCapabilities;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.StatusRequestMessage;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start.CameraRemoteMessage;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start.RegistrationMessage;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start.StartMessage;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start.StartMessage2nd;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start.StartMessage3rd;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start.StartMessage4th;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.start.StartMessage5th;
+import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
+
+
+public class FujiXCameraConnectSequence implements Runnable, IFujiXCommandCallback
+{
+ private final String TAG = this.toString();
+
+
+ private final Activity context;
+ private final ICameraConnection cameraConnection;
+ private final ICameraStatusReceiver cameraStatusReceiver;
+ private final IFujiXInterfaceProvider interfaceProvider;
+ private final IFujiXCommandPublisher commandIssuer;
+ private boolean isBothLiveView = false;
+
+ FujiXCameraConnectSequence(@NonNull Activity context, @NonNull ICameraStatusReceiver statusReceiver, @NonNull final ICameraConnection cameraConnection, @NonNull IFujiXInterfaceProvider interfaceProvider)
+ {
+ Log.v(TAG, "FujiXCameraConnectSequence");
+ this.context = context;
+ this.cameraConnection = cameraConnection;
+ this.cameraStatusReceiver = statusReceiver;
+ this.interfaceProvider = interfaceProvider;
+ this.commandIssuer = interfaceProvider.getCommandPublisher();
+ }
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ try
+ {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ isBothLiveView = preferences.getBoolean(IPreferencePropertyAccessor.FUJI_X_DISPLAY_CAMERA_VIEW, false);
+ }
+ catch (Exception e)
+ {
+ //isBothLiveView = false;
+ e.printStackTrace();
+ }
+
+ // カメラとTCP接続
+ IFujiXCommandPublisher issuer = interfaceProvider.getCommandPublisher();
+ if (!issuer.isConnected())
+ {
+ if (!interfaceProvider.getCommandCommunication().connect())
+ {
+ // 接続失敗...
+ onConnectError(context.getString(R.string.dialog_title_connect_failed_fuji));
+ return;
+ }
+ }
+ // コマンドタスクの実行開始
+ issuer.start();
+
+ // 接続シーケンスの開始
+ sendRegistrationMessage();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ onConnectError(e.getLocalizedMessage());
+ }
+ }
+
+ private void onConnectError(String reason)
+ {
+ cameraConnection.alertConnectingFailed(reason);
+ }
+
+ @Override
+ public void onReceiveProgress(int currentBytes, int totalBytes, byte[] body)
+ {
+ Log.v(TAG, " " + currentBytes + "/" + totalBytes);
+ }
+
+ @Override
+ public boolean isReceiveMulti()
+ {
+ return (false);
+ }
+
+ @Override
+ public void receivedMessage(int id, byte[] rx_body)
+ {
+ //Log.v(TAG, "receivedMessage : " + id + "[" + rx_body.length + " bytes]");
+ //int bodyLength = 0;
+ switch (id)
+ {
+ case IFujiXMessages.SEQ_REGISTRATION:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting));
+ if (checkRegistrationMessage(rx_body))
+ {
+ commandIssuer.enqueueCommand(new StartMessage(this));
+ }
+ break;
+
+ case IFujiXMessages.SEQ_START:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting1));
+ commandIssuer.enqueueCommand(new StartMessage2nd(this));
+ break;
+
+ case IFujiXMessages.SEQ_START_2ND:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting2));
+ 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 IFujiXMessages.SEQ_START_2ND_RECEIVE:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting3));
+ commandIssuer.enqueueCommand(new StartMessage3rd(this));
+ break;
+
+ case IFujiXMessages.SEQ_START_3RD:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting4));
+ commandIssuer.enqueueCommand(new StartMessage4th(this));
+ break;
+
+ case IFujiXMessages.SEQ_START_4TH:
+ if (isBothLiveView)
+ {
+ // カメラのLCDと遠隔のライブビューを同時に表示する場合...
+ commandIssuer.enqueueCommand(new CameraRemoteMessage(this));
+ }
+ else
+ {
+ commandIssuer.enqueueCommand(new StartMessage5th(this));
+ }
+ break;
+ case IFujiXMessages.SEQ_START_5TH:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting6));
+ commandIssuer.enqueueCommand(new StatusRequestMessage(this));
+ break;
+
+ case IFujiXMessages.SEQ_STATUS_REQUEST:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting8));
+ commandIssuer.enqueueCommand(new QueryCameraCapabilities(this));
+ break;
+
+ case IFujiXMessages.SEQ_QUERY_CAMERA_CAPABILITIES:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting10));
+ commandIssuer.enqueueCommand(new CameraRemoteMessage(this));
+ break;
+
+ case IFujiXMessages.SEQ_CAMERA_REMOTE:
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting12));
+ connectFinished();
+ break;
+
+ default:
+ Log.v(TAG, "RECEIVED UNKNOWN ID : " + id);
+ onConnectError(context.getString(R.string.connect_receive_unknown_message));
+ break;
+ }
+ }
+
+ private void sendRegistrationMessage()
+ {
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start));
+ commandIssuer.enqueueCommand(new RegistrationMessage(this));
+ }
+
+ private boolean checkRegistrationMessage(byte[] receiveData)
+ {
+ // 応答エラーかどうかをチェックする
+ if (receiveData.length == 8)
+ {
+ if ((receiveData[0] == 0x05) && (receiveData[1] == 0x00) && (receiveData[2] == 0x00) && (receiveData[3] == 0x00) &&
+ (receiveData[4] == 0x19) && (receiveData[5] == 0x20) && (receiveData[6] == 0x00) && (receiveData[7] == 0x00)) {
+ // 応答エラー...
+ return (false);
+ }
+ return (false);
+ }
+ return (true);
+ }
+
+
+ private void connectFinished()
+ {
+ try
+ {
+ // ちょっと待つ
+ Thread.sleep(1000);
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connected));
+ interfaceProvider.getAsyncEventCommunication().connect();
+ interfaceProvider.getCameraStatusWatcher().startStatusWatch(interfaceProvider.getStatusListener());
+ onConnectNotify();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void onConnectNotify()
+ {
+ try
+ {
+ final Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ // カメラとの接続確立を通知する
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connected));
+ cameraStatusReceiver.onCameraConnected();
+ Log.v(TAG, "onConnectNotify()");
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.connection;
+
+import android.app.Activity;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.IFujiXInterfaceProvider;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommunication;
+
+
+class FujiXCameraDisconnectSequence implements Runnable
+{
+ private final String TAG = this.toString();
+ private final Activity activity;
+ private final IFujiXCommunication command;
+ private final IFujiXCommunication async;
+ private final IFujiXCommunication liveview;
+
+
+ FujiXCameraDisconnectSequence(Activity activity, @NonNull IFujiXInterfaceProvider interfaceProvider)
+ {
+ this.activity = activity;
+ this.command = interfaceProvider.getCommandCommunication();
+ this.async = interfaceProvider.getAsyncEventCommunication();
+ this.liveview = interfaceProvider.getLiveviewCommunication();
+ }
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ liveview.disconnect();
+ async.disconnect();
+ command.disconnect();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.connection;
+
+import android.util.Log;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.IFujiXRunModeHolder;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandPublisher;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.StatusRequestMessage;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToLiveView1st;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToLiveView2nd;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToLiveView3rd;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToLiveView4th;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToLiveView5th;
+
+
+public class FujiXCameraModeChangeToLiveView implements View.OnClickListener, IFujiXCommandCallback
+{
+ private final String TAG = toString();
+ private final IFujiXCommandPublisher publisher;
+ private final IFujiXCommandCallback callback;
+ private IFujiXRunModeHolder runModeHolder = null;
+
+ public FujiXCameraModeChangeToLiveView(@NonNull IFujiXCommandPublisher publisher, @Nullable IFujiXCommandCallback callback)
+ {
+ this.publisher = publisher;
+ this.callback = callback;
+ }
+
+ public void startModeChange(IFujiXRunModeHolder runModeHolder)
+ {
+ Log.v(TAG, "onClick");
+ try
+ {
+ if (runModeHolder != null)
+ {
+ this.runModeHolder = runModeHolder;
+ this.runModeHolder.transitToRecordingMode(false);
+ }
+ publisher.enqueueCommand(new ChangeToLiveView1st(this));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onClick(View v)
+ {
+ Log.v(TAG, "onClick");
+ startModeChange(null);
+ }
+
+ @Override
+ public void onReceiveProgress(int currentBytes, int totalBytes, byte[] body)
+ {
+ Log.v(TAG, " " + currentBytes + "/" + totalBytes);
+ }
+
+ @Override
+ public boolean isReceiveMulti()
+ {
+ return (false);
+ }
+
+ @Override
+ public void receivedMessage(int id, byte[] rx_body)
+ {
+ //Log.v(TAG, "receivedMessage : " + id + "[" + rx_body.length + " bytes]");
+ //int bodyLength = 0;
+ try
+ {
+ switch (id)
+ {
+ case IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_1ST:
+ publisher.enqueueCommand(new ChangeToLiveView2nd(this));
+ break;
+
+ case IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_2ND:
+ publisher.enqueueCommand(new ChangeToLiveView3rd(this));
+ break;
+
+ case IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_3RD:
+ publisher.enqueueCommand(new ChangeToLiveView4th(this));
+ break;
+ case IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_4TH:
+ publisher.enqueueCommand(new ChangeToLiveView5th(this));
+ break;
+
+ case IFujiXMessages.SEQ_CHANGE_TO_LIVEVIEW_5TH:
+ publisher.enqueueCommand(new StatusRequestMessage(this));
+ break;
+
+ case IFujiXMessages.SEQ_STATUS_REQUEST:
+ if (callback != null)
+ {
+ callback.receivedMessage(id, rx_body);
+ }
+ if (runModeHolder != null)
+ {
+ runModeHolder.transitToRecordingMode(true);
+ }
+ Log.v(TAG, "CHANGED LIVEVIEW MODE : DONE.");
+ break;
+
+ default:
+ Log.v(TAG, "RECEIVED UNKNOWN ID : " + id);
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.connection;
+
+import android.util.Log;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.IFujiXRunModeHolder;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandPublisher;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.StatusRequestMessage;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToPlayback1st;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToPlayback2nd;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToPlayback3rd;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.changemode.ChangeToPlayback4th;
+
+public class FujiXCameraModeChangeToPlayback implements View.OnClickListener, IFujiXCommandCallback
+{
+ private final String TAG = toString();
+ private final IFujiXCommandPublisher publisher;
+ private final IFujiXCommandCallback callback;
+ private IFujiXRunModeHolder runModeHolder = null;
+
+ public FujiXCameraModeChangeToPlayback(@NonNull IFujiXCommandPublisher publisher, @Nullable IFujiXCommandCallback callback)
+ {
+ this.publisher = publisher;
+ this.callback = callback;
+ }
+
+ public void startModeChange(IFujiXRunModeHolder runModeHolder)
+ {
+ Log.v(TAG, "onClick");
+ try
+ {
+ if (runModeHolder != null)
+ {
+ this.runModeHolder = runModeHolder;
+ this.runModeHolder.transitToPlaybackMode(false);
+ }
+ publisher.enqueueCommand(new ChangeToPlayback1st(this));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+
+ @Override
+ public void onClick(View v)
+ {
+ Log.v(TAG, "onClick");
+ startModeChange(null);
+ }
+
+ @Override
+ public void onReceiveProgress(int currentBytes, int totalBytes, byte[] body)
+ {
+ Log.v(TAG, " " + currentBytes + "/" + totalBytes);
+ }
+
+ @Override
+ public boolean isReceiveMulti()
+ {
+ return (false);
+ }
+
+ @Override
+ public void receivedMessage(int id, byte[] rx_body)
+ {
+ //Log.v(TAG, "receivedMessage : " + id + "[" + rx_body.length + " bytes]");
+ //int bodyLength = 0;
+ try
+ {
+ switch (id)
+ {
+ case IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_1ST:
+ publisher.enqueueCommand(new ChangeToPlayback2nd(this));
+ break;
+
+ case IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_2ND:
+ publisher.enqueueCommand(new ChangeToPlayback3rd(this));
+ break;
+
+ case IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_3RD:
+ publisher.enqueueCommand(new ChangeToPlayback4th(this));
+ break;
+
+ case IFujiXMessages.SEQ_CHANGE_TO_PLAYBACK_4TH:
+ publisher.enqueueCommand(new StatusRequestMessage(this));
+ break;
+
+ case IFujiXMessages.SEQ_STATUS_REQUEST:
+ if (callback != null)
+ {
+ callback.receivedMessage(id, rx_body);
+ }
+ if (runModeHolder != null)
+ {
+ runModeHolder.transitToPlaybackMode(true);
+ }
+ Log.v(TAG, "CHANGED PLAYBACK MODE : DONE.");
+ break;
+
+ default:
+ Log.v(TAG, "RECEIVED UNKNOWN ID : " + id);
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.connection;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.provider.Settings;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
+
+import net.osdn.gokigen.gr2control.R;
+import net.osdn.gokigen.gr2control.camera.ICameraConnection;
+import net.osdn.gokigen.gr2control.camera.ICameraStatusReceiver;
+import net.osdn.gokigen.gr2control.camera.fuji_x.IFujiXInterfaceProvider;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+public class FujiXConnection implements ICameraConnection
+{
+ private final String TAG = toString();
+ private final Activity context;
+ private final ICameraStatusReceiver statusReceiver;
+ private final IFujiXInterfaceProvider interfaceProvider;
+ private final BroadcastReceiver connectionReceiver;
+ private final Executor cameraExecutor = Executors.newFixedThreadPool(1);
+ private CameraConnectionStatus connectionStatus = CameraConnectionStatus.UNKNOWN;
+
+ public FujiXConnection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IFujiXInterfaceProvider interfaceProvider)
+ {
+ Log.v(TAG, "FujiXConnection()");
+ this.context = context;
+ this.statusReceiver = statusReceiver;
+ this.interfaceProvider = interfaceProvider;
+ connectionReceiver = new BroadcastReceiver()
+ {
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ onReceiveBroadcastOfConnection(context, intent);
+ }
+ };
+ }
+
+ /**
+ *
+ *
+ */
+ private void onReceiveBroadcastOfConnection(Context context, Intent intent)
+ {
+ statusReceiver.onStatusNotify(context.getString(R.string.connect_check_wifi));
+
+ Log.v(TAG, context.getString(R.string.connect_check_wifi));
+
+ String action = intent.getAction();
+ if (action == null)
+ {
+ Log.v(TAG, "intent.getAction() : null");
+ return;
+ }
+
+ try
+ {
+ if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION))
+ {
+ Log.v(TAG, "onReceiveBroadcastOfConnection() : CONNECTIVITY_ACTION");
+
+ WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+ if (wifiManager != null) {
+ WifiInfo info = wifiManager.getConnectionInfo();
+ if (wifiManager.isWifiEnabled() && info != null) {
+ if (info.getNetworkId() != -1) {
+ Log.v(TAG, "Network ID is -1, there is no currently connected network.");
+ }
+ // 自動接続が指示されていた場合は、カメラとの接続処理を行う
+ connectToCamera();
+ } else {
+ if (info == null) {
+ Log.v(TAG, "NETWORK INFO IS NULL.");
+ } else {
+ Log.v(TAG, "isWifiEnabled : " + wifiManager.isWifiEnabled() + " NetworkId : " + info.getNetworkId());
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ Log.w(TAG, "onReceiveBroadcastOfConnection() EXCEPTION" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void startWatchWifiStatus(Context context)
+ {
+ Log.v(TAG, "startWatchWifiStatus()");
+ statusReceiver.onStatusNotify(context.getString(R.string.connect_prepare));
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
+ filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
+ context.registerReceiver(connectionReceiver, filter);
+ }
+
+ @Override
+ public void stopWatchWifiStatus(Context context)
+ {
+ Log.v(TAG, "stopWatchWifiStatus()");
+ context.unregisterReceiver(connectionReceiver);
+ disconnect(false);
+ }
+
+ @Override
+ public void disconnect(boolean powerOff)
+ {
+ Log.v(TAG, "disconnect()");
+ disconnectFromCamera(powerOff);
+ connectionStatus = CameraConnectionStatus.DISCONNECTED;
+ statusReceiver.onCameraDisconnected();
+ }
+
+ @Override
+ public void connect()
+ {
+ Log.v(TAG, "connect()");
+ connectToCamera();
+ }
+
+ @Override
+ public void alertConnectingFailed(String message)
+ {
+ Log.v(TAG, "alertConnectingFailed() : " + message);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context)
+ .setTitle(context.getString(R.string.dialog_title_connect_failed_fuji))
+ .setMessage(message)
+ .setPositiveButton(context.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which)
+ {
+ disconnect(false);
+ connect();
+ }
+ })
+ .setNeutralButton(R.string.dialog_title_button_network_settings, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which)
+ {
+ try
+ {
+ // Wifi 設定画面を表示する
+ context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ }
+ catch (android.content.ActivityNotFoundException ex)
+ {
+ // Activity が存在しなかった...設定画面が起動できなかった
+ Log.v(TAG, "android.content.ActivityNotFoundException...");
+
+ // この場合は、再試行と等価な動きとする
+ connect();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ context.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ builder.show();
+ }
+ });
+ }
+
+ @Override
+ public CameraConnectionStatus getConnectionStatus()
+ {
+ Log.v(TAG, "getConnectionStatus()");
+ return (connectionStatus);
+ }
+
+ @Override
+ public void forceUpdateConnectionStatus(CameraConnectionStatus status)
+ {
+ Log.v(TAG, "forceUpdateConnectionStatus()");
+ connectionStatus = status;
+ }
+
+ /**
+ * カメラとの切断処理
+ */
+ private void disconnectFromCamera(final boolean powerOff)
+ {
+ Log.v(TAG, "disconnectFromCamera()");
+ try
+ {
+ cameraExecutor.execute(new FujiXCameraDisconnectSequence(context, interfaceProvider));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * カメラとの接続処理
+ */
+ private void connectToCamera()
+ {
+ Log.v(TAG, "connectToCamera()");
+ connectionStatus = CameraConnectionStatus.CONNECTING;
+ try
+ {
+ boolean isReadOnly = false;
+ interfaceProvider.getCommandPublisher();
+ cameraExecutor.execute(new FujiXCameraConnectSequence(context, statusReceiver, this, interfaceProvider));
+ }
+ catch (Exception e)
+ {
+ Log.v(TAG, "connectToCamera() EXCEPTION : " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
ICaptureControl getCaptureControl();
ICameraButtonControl getButtonControl();
IDisplayInjector getDisplayInjector();
-
IOlyCameraPropertyProvider getCameraPropertyProvider();
-
ICameraStatus getCameraStatusListHolder();
ICameraStatusWatcher getCameraStatusWatcher();
IPlaybackControl getPlaybackControl();
-
ICameraHardwareStatus getHardwareStatus();
ICameraRunMode getCameraRunMode();
}
ICameraButtonControl getButtonControl();
ICameraStatusWatcher getCameraStatusWatcher();
IPlaybackControl getPlaybackControl();
-
ICameraHardwareStatus getHardwareStatus();
ICameraRunMode getCameraRunMode();
}
<string name="dialog_message_power_off">カメラの電源を切り、アプリケーションを終了します。</string>
<string name="dialog_message_exit">アプリケーションを終了します。</string>
<string name="dialog_title_button_retry">再試行</string>
+ <string name="dialog_title_connect_failed_fuji">接続失敗(FUJI)</string>
<string name="dialog_title_connect_failed">接続失敗</string>
<string name="dialog_title_button_network_settings">WiFi設定</string>
<string name="dialog_message_loading_properties">しばらくお待ち下さい…</string>
<string name="pref_wifi_settings">WiFi設定</string>
<string name="pref_summary_wifi_settings"> </string>
+ <string name="connect_prepare">準備中…</string>
+ <string name="connect_connecting">接続中</string>
+ <string name="connect_connecting1">接続中…(1/12)</string>
+ <string name="connect_connecting2">接続中…(2/12)</string>
+ <string name="connect_connecting3">接続中…(3/12)</string>
+ <string name="connect_connecting4">接続中…(4/12)</string>
+ <string name="connect_connecting5">接続中…(5/12)</string>
+ <string name="connect_connecting6">接続中…(6/12)</string>
+ <string name="connect_connecting7">接続中…(7/12)</string>
+ <string name="connect_connecting8">接続中…(8/12)</string>
+ <string name="connect_connecting9">接続中…(9/12)</string>
+ <string name="connect_connecting10">接続中…(10/12)</string>
+ <string name="connect_connecting11">接続中…(11/12)</string>
+ <string name="connect_connecting12">接続中…(12/12)</string>
+ <string name="connect_connect_finished">カメラと接続</string>
+ <string name="connect_receive_unknown_message">不明な応答を受信しました。</string>
</resources>
<string name="dialog_message_exit">Exit Application</string>
+ <string name="dialog_title_connect_failed_fuji">Connect failed(FUJI)</string>
<string name="dialog_title_connect_failed">Connect failed</string>
<string name="dialog_title_button_retry">Retry</string>
<string name="dialog_title_button_network_settings">WiFi Settings</string>
<string name="pref_wifi_settings">WIFI Settings</string>
<string name="pref_summary_wifi_settings"> </string>
+ <string name="connect_prepare">Preparing…</string>
+ <string name="connect_connecting">connecting…</string>
+ <string name="connect_connecting1">Connecting…(1/12)</string>
+ <string name="connect_connecting2">Connecting…(2/12)</string>
+ <string name="connect_connecting3">Connecting…(3/12)</string>
+ <string name="connect_connecting4">Connecting…(4/12)</string>
+ <string name="connect_connecting5">Connecting…(5/12)</string>
+ <string name="connect_connecting6">Connecting…(6/12)</string>
+ <string name="connect_connecting7">Connecting…(7/12)</string>
+ <string name="connect_connecting8">Connecting…(8/12)</string>
+ <string name="connect_connecting9">Connecting…(9/12)</string>
+ <string name="connect_connecting10">Connecting…(10/12)</string>
+ <string name="connect_connecting11">Connecting…(11/12)</string>
+ <string name="connect_connecting12">Connecting…(12/12)</string>
+ <string name="connect_connect_finished">Connect Finished.</string>
+ <string name="connect_receive_unknown_message">RECEIVED UNKNOWN ID MESSAGE</string>
+
</resources>