CameraStatusListener statusListener = new CameraStatusListener();
olympus = new OlympusInterfaceProvider(context, provider);
ricohGr2 = new RicohGr2InterfaceProvider(context, provider);
- fujiX = new FujiXInterfaceProvider(context, provider, statusListener);
+ fujiX = new FujiXInterfaceProvider(context, provider, statusListener, informationReceiver);
//sony = new SonyCameraWrapper(context, provider);
this.informationReceiver = informationReceiver;
this.cameraContentsRecognizer = new CameraContentsRecognizer(context, this);
import androidx.annotation.NonNull;
+import net.osdn.gokigen.pkremote.IInformationReceiver;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraButtonControl;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraConnection;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraRunMode;
ICameraHardwareStatus getHardwareStatus();
ICameraRunMode getCameraRunMode();
+ IInformationReceiver getInformationReceiver();
+
void setAsyncEventReceiver(@NonNull IFujiXCommandCallback receiver);
}
import androidx.annotation.NonNull;
+import net.osdn.gokigen.pkremote.IInformationReceiver;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraButtonControl;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraConnection;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraRunMode;
private FujiXStatusChecker statusChecker;
private ICameraStatusUpdateNotify statusListener;
private FujiXPlaybackControl playbackControl;
+ private IInformationReceiver informationReceiver;
- public FujiXInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider, @NonNull ICameraStatusUpdateNotify statusListener)
+ public FujiXInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider, @NonNull ICameraStatusUpdateNotify statusListener, @NonNull IInformationReceiver informationReceiver)
{
this.activity = context;
commandPublisher = new FujiXCommandPublisher(CAMERA_IP, CONTROL_PORT);
this.hardwareStatus = new FujiXHardwareStatus();
this.fujiXButtonControl = new FujiXButtonControl();
this.playbackControl = new FujiXPlaybackControl(activity, this);
+ this.informationReceiver = informationReceiver;
}
@Override
}
@Override
+ public IInformationReceiver getInformationReceiver()
+ {
+ // ちょっとこの引き回しは気持ちがよくない...
+ return (informationReceiver);
+ }
+
+ @Override
public void setAsyncEventReceiver(@NonNull IFujiXCommandCallback receiver)
{
asyncReceiver.setEventSubscriber(receiver);
// ストリームを全部閉じる
try
{
- dos.close();
+ if (dos != null)
+ {
+ dos.close();
+ }
}
catch (Exception e)
{
try
{
- bufferedReader.close();
+ if (bufferedReader != null)
+ {
+ bufferedReader.close();
+ }
}
catch (Exception e)
{
try
{
- socket.close();
+ if (socket != null)
+ {
+ socket.close();
+ }
}
catch (Exception e)
{
import android.app.Activity;
import android.content.SharedPreferences;
+import android.graphics.Color;
import android.util.Log;
import androidx.annotation.NonNull;
import net.osdn.gokigen.pkremote.camera.vendor.fujix.wrapper.status.IFujiXRunModeHolder;
import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
+
public class FujiXCameraConnectSequenceForPlayback implements Runnable, IFujiXCommandCallback, IFujiXMessages
{
private final String TAG = this.toString();
if (!interfaceProvider.getCommandCommunication().connect())
{
// 接続失敗...
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.dialog_title_connect_failed), false, true, Color.RED);
onConnectError(context.getString(R.string.dialog_title_connect_failed));
return;
}
}
+ else
+ {
+ Log.v(TAG, "SOCKET IS ALREADY CONNECTED...");
+ }
// コマンドタスクの実行開始
issuer.start();
catch (Exception e)
{
e.printStackTrace();
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.dialog_title_connect_failed), false, true, Color.RED);
onConnectError(e.getLocalizedMessage());
}
}
break;
case SEQ_START:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting1), false, false, 0);
commandIssuer.enqueueCommand(new StartMessage2ndRead(this));
break;
case SEQ_START_2ND_READ:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting2), false, false, 0);
cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting));
if (rx_body.length == (int)rx_body[0])
{
break;
case SEQ_START_2ND_RECEIVE:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting3), false, false, 0);
commandIssuer.enqueueCommand(new StartMessage3rd(this));
break;
case SEQ_START_3RD:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting4), false, false, 0);
commandIssuer.enqueueCommand(new StartMessage4th(this));
break;
case SEQ_START_4TH:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting5), false, false, 0);
if (isBothLiveView)
{
// カメラのLCDと遠隔のライブビューを同時に表示する場合...
break;
case SEQ_START_5TH:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting6), false, false, 0);
commandIssuer.enqueueCommand(new QueryCameraCapabilities(this));
//commandIssuer.enqueueCommand(new StatusRequestMessage(this));
break;
case SEQ_QUERY_CAMERA_CAPABILITIES:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting7), false, false, 0);
commandIssuer.enqueueCommand(new CameraRemoteMessage(this));
break;
case SEQ_CAMERA_REMOTE:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting8), false, false, 0);
commandIssuer.enqueueCommand(new ChangeToPlayback1st(this));
runModeHolder = interfaceProvider.getRunModeHolder();
if (runModeHolder != null)
break;
case SEQ_CHANGE_TO_PLAYBACK_1ST:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting9), false, false, 0);
commandIssuer.enqueueCommand(new ChangeToPlayback2nd(this));
break;
case SEQ_CHANGE_TO_PLAYBACK_2ND:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting10), false, false, 0);
commandIssuer.enqueueCommand(new ChangeToPlayback3rd(this));
break;
case SEQ_CHANGE_TO_PLAYBACK_3RD:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting11), false, false, 0);
commandIssuer.enqueueCommand(new ChangeToPlayback4th(this));
break;
case SEQ_CHANGE_TO_PLAYBACK_4TH:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connecting12), false, false, 0);
commandIssuer.enqueueCommand(new StatusRequestMessage(this));
break;
case SEQ_STATUS_REQUEST:
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connect_finished), false, false, 0);
IFujiXCommandCallback callback = interfaceProvider.getStatusHolder();
if (callback != null)
{
private void sendRegistrationMessage()
{
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_start), false, false, 0);
cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start));
commandIssuer.enqueueCommand(new RegistrationMessage(this));
}
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)) {
// 応答エラー...
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.error_reply_from_camera), false, true, Color.RED);
return (false);
}
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.other_error_reply_from_camera), false, true, Color.RED);
return (false);
}
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.registration_reply_from_camera), false, false, 0);
return (true);
}
{
try
{
+ // 接続成功のメッセージを出す
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connected), false, false, 0);
+
// ちょっと待つ
Thread.sleep(1000);
+
interfaceProvider.getAsyncEventCommunication().connect();
//interfaceProvider.getCameraStatusWatcher().startStatusWatch(interfaceProvider.getStatusListener()); ステータスの定期確認は実施しない
+
+ // 接続成功!のメッセージを出す
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_connected), false, false, 0);
+
onConnectNotify();
}
catch (Exception e)
*/
private void onReceiveBroadcastOfConnection(Context context, Intent intent)
{
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_check_wifi), false, false, 0);
statusReceiver.onStatusNotify(context.getString(R.string.connect_check_wifi));
+
Log.v(TAG, context.getString(R.string.connect_check_wifi));
String action = intent.getAction();
public void startWatchWifiStatus(Context context)
{
Log.v(TAG, "startWatchWifiStatus()");
+ interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.connect_prepare), false, false, 0);
statusReceiver.onStatusNotify("prepare");
IntentFilter filter = new IntentFilter();
@Override
public void onClick(DialogInterface dialog, int which)
{
+ disconnect(false);
connect();
}
})
<string name="pref_summary_fujix_command_polling_wait">カメラ状態の確認間隔を調整します</string>
<string name="pref_fujix_connection_for_read">画像転送用の接続シーケンス</string>
<string name="pref_fujix_connection_for_read_summary">テスト用です</string>
- <string name="does_not_support_this_feature">この機能はこの接続方式では使用できません…</string>
+ <string name="does_not_support_this_feature">この接続方式では使用できません…</string>
+ <string name="error_reply_from_camera">カメラからエラー応答…</string>
+ <string name="other_error_reply_from_camera">カメラから不明なエラー応答…</string>
+ <string name="registration_reply_from_camera">接続要求</string>
+ <string name="connect_connected2">接続完了!</string>
+ <string name="connect_prepare">準備中…</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>
</resources>
<string name="pref_fujix_connection_for_read_summary">Test: for picture transfer connection.</string>
<string name="does_not_support_this_feature">Cannot support for this camera…</string>
+ <string name="error_reply_from_camera">The camera replies a errror…</string>
+ <string name="other_error_reply_from_camera">The camera replies a unknown errror…</string>
+ <string name="registration_reply_from_camera">Start a registration…</string>
+ <string name="connect_connected2">Connected.</string>
+ <string name="connect_prepare">Preparing…</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>
</resources>
android:summary="@string/pref_summary_auto_connect_camera" />
</PreferenceCategory>
+<!--
<PreferenceCategory
android:title="@string/pref_cat_camera">
android:summary="@string/pref_fujix_connection_for_read_summary"/>
</PreferenceCategory>
-
+-->
<PreferenceCategory
android:title="@string/pref_cat_others">