statusChecker = new FujiXStatusChecker(context, commandPublisher);
playbackControl = new FujiXPlaybackControl(context, this);
hardwareStatus = new FujiXHardwareStatus();
- runMode = new FujiXRunMode(commandPublisher);
+ runMode = new FujiXRunMode(this);
}
public void prepare()
import androidx.annotation.NonNull;
+import net.osdn.gokigen.gr2control.camera.ICameraConnection;
import net.osdn.gokigen.gr2control.camera.ICameraRunMode;
import net.osdn.gokigen.gr2control.camera.ICameraRunModeCallback;
-import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.FujiXCommandPublisher;
+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.connection.FujiXCameraModeChangeToLiveView;
import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.connection.FujiXCameraModeChangeToPlayback;
public class FujiXRunMode implements ICameraRunMode, IFujiXRunModeHolder, IFujiXCommandCallback
{
private final String TAG = toString();
+ private final IFujiXInterfaceProvider interfaceProvider;
private final FujiXCameraModeChangeToLiveView toLiveViewCommand;
private final FujiXCameraModeChangeToPlayback toPlaybackCommand;
private boolean isChanging = false;
private boolean isRecordingMode = false;
+ private boolean modeChangeIsPending = false;
private ICameraRunModeCallback runModeCallback = null;
- FujiXRunMode(@NonNull FujiXCommandPublisher commandPublisher)
+ FujiXRunMode(@NonNull IFujiXInterfaceProvider interfaceProvider)
{
- //
- toLiveViewCommand = new FujiXCameraModeChangeToLiveView(commandPublisher, this);
- toPlaybackCommand = new FujiXCameraModeChangeToPlayback(commandPublisher, this);
+ this.interfaceProvider = interfaceProvider;
+ toLiveViewCommand = new FujiXCameraModeChangeToLiveView(interfaceProvider.getCommandPublisher(), this);
+ toPlaybackCommand = new FujiXCameraModeChangeToPlayback(interfaceProvider.getCommandPublisher(), this);
}
@Override
{
// モードを切り替える
Log.v(TAG, "changeRunMode() : " + isRecording);
+
+ if (interfaceProvider.getCameraConnection().getConnectionStatus() != ICameraConnection.CameraConnectionStatus.CONNECTED)
+ {
+ //
+ Log.v(TAG, " ===== DOES NOT CONNECT TO CAMERA, SO PENDING...");
+ return;
+ }
+
this.runModeCallback = callback;
if (isRecording)
{
int id = Integer.parseInt(key, 16);
int value = statusHolder.get(id);
Log.v(TAG, "getItemStatus() value : " + value + " key : " + key + " [" + id + "]");
+ dumpStatus();
return (value + "");
}
catch (Exception e)
return ("? [" + key + "]");
}
+ private void dumpStatus()
+ {
+ try
+ {
+ Log.v(TAG, " - - - status - - - ");
+ for (int index = 0; index < statusHolder.size(); index++)
+ {
+ int key = statusHolder.keyAt(index);
+ int value = statusHolder.get(key);
+ Log.v(TAG, String.format("id : 0x%x value : %d (0x%x) ", key, value, value));
+ }
+ Log.v(TAG, " - - - status - - - ");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
+
}
{
try
{
- //Log.v(TAG, "Enqueue : " + command.getId());
+ //Log.v(TAG, " --- Enqueue : " + command.getId());
return (commandQueue.offer(command));
}
catch (Exception e)
if (isDumpReceiveLog)
{
// ログに受信メッセージを出力する
- Log.v(TAG, "receive_from_camera() : " + read_bytes + " bytes.");
+ Log.v(TAG, " receive_from_camera() : " + read_bytes + " bytes.");
dump_bytes("RECV[" + receive_body.length + "] ", receive_body);
}
- if (callback != null)
+ if (callback != null)
{
callback.receivedMessage(id, receive_body);
}
@Override
public boolean dumpLog()
{
- return (false);
+ return (true);
}
}
IFujiXCommandPublisher issuer = interfaceProvider.getCommandPublisher();
if (!issuer.isConnected())
{
+ Log.v(TAG, " --- CONNECT SOCKET --- ");
if (!interfaceProvider.getCommandCommunication().connect())
{
// 接続失敗...
@Override
public void receivedMessage(int id, byte[] rx_body)
{
- //Log.v(TAG, "receivedMessage : " + id + "[" + rx_body.length + " bytes]");
+ Log.v(TAG, "receivedMessage : " + id + "[" + rx_body.length + " bytes]");
//int bodyLength = 0;
switch (id)
{
public void startModeChange(IFujiXRunModeHolder runModeHolder)
{
- Log.v(TAG, "onClick");
+ Log.v(TAG, " startModeChange()");
try
{
if (runModeHolder != null)
if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION))
{
Log.v(TAG, "onReceiveBroadcastOfConnection() : CONNECTIVITY_ACTION");
-
WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
- if (wifiManager != null) {
+ if (wifiManager != null)
+ {
WifiInfo info = wifiManager.getConnectionInfo();
- if (wifiManager.isWifiEnabled() && info != null) {
- if (info.getNetworkId() != -1) {
+ if (wifiManager.isWifiEnabled() && info != null)
+ {
+ int netWorkId = info.getNetworkId();
+ if (netWorkId == -1)
+ {
Log.v(TAG, "Network ID is -1, there is no currently connected network.");
}
+ else
+ {
+ Log.v(TAG, " Network ID : " + netWorkId);
+ }
// 自動接続が指示されていた場合は、カメラとの接続処理を行う
connectToCamera();
} else {
- if (info == null) {
+ if (info == null)
+ {
Log.v(TAG, "NETWORK INFO IS NULL.");
} else {
Log.v(TAG, "isWifiEnabled : " + wifiManager.isWifiEnabled() + " NetworkId : " + info.getNetworkId());
}
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
Log.w(TAG, "onReceiveBroadcastOfConnection() EXCEPTION" + e.getMessage());
e.printStackTrace();
}
@Override
public CameraConnectionStatus getConnectionStatus()
{
- Log.v(TAG, "getConnectionStatus()");
+ Log.v(TAG, "getConnectionStatus() : " + connectionStatus);
return (connectionStatus);
}