package net.osdn.gokigen.pkremote.camera.vendor.ptpip.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.pkremote.IInformationReceiver;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraButtonControl;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.playback.CanonPlaybackControl;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.IPtpIpRunModeHolder;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker;
+import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
public class PtpIpInterfaceProvider implements IPtpIpInterfaceProvider, IDisplayInjector
{
private static final int ASYNC_RESPONSE_PORT = 15741; // ??
private static final int CONTROL_PORT = 15740;
private static final int EVENT_PORT = 15740;
- private static final String CAMERA_IP = "192.168.0.1";
- private final Activity activity;
+ //private static final String CAMERA_IP = "192.168.0.1";
+ //private final Activity activity;
+
private final PtpIpRunMode runmode;
private final PtpIpHardwareStatus hardwareStatus;
- private PtpIpButtonControl ptpIpButtonControl;
- private CanonConnection canonConnection;
- private PtpIpCommandPublisher commandPublisher;
- private PtpIpLiveViewControl liveViewControl;
- private PtpIpAsyncResponseReceiver asyncReceiver;
- private PtpIpZoomControl zoomControl;
+ private final PtpIpButtonControl ptpIpButtonControl;
+ private final CanonConnection canonConnection;
+ private final PtpIpCommandPublisher commandPublisher;
+ private final PtpIpLiveViewControl liveViewControl;
+ private final PtpIpAsyncResponseReceiver asyncReceiver;
+ private final PtpIpZoomControl zoomControl;
//private PtpIpCaptureControl captureControl;
//private PtpIpFocusingControl focusingControl;
- private PtpIpStatusChecker statusChecker;
- private ICameraStatusUpdateNotify statusListener;
- private CanonPlaybackControl playbackControl;
- private IInformationReceiver informationReceiver;
+ private final PtpIpStatusChecker statusChecker;
+ private final ICameraStatusUpdateNotify statusListener;
+ private final CanonPlaybackControl playbackControl;
+ private final IInformationReceiver informationReceiver;
public PtpIpInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider, @NonNull ICameraStatusUpdateNotify statusListener, @NonNull IInformationReceiver informationReceiver)
{
- this.activity = context;
- commandPublisher = new PtpIpCommandPublisher(CAMERA_IP, CONTROL_PORT);
- liveViewControl = new PtpIpLiveViewControl(context, CAMERA_IP, STREAM_PORT);
- asyncReceiver = new PtpIpAsyncResponseReceiver(CAMERA_IP, ASYNC_RESPONSE_PORT);
- statusChecker = new PtpIpStatusChecker(activity, commandPublisher, CAMERA_IP, EVENT_PORT);
- canonConnection = new CanonConnection(context, provider, this, statusChecker);
+ //this.activity = context;
+ String ipAddress; // "192.168.0.1";
+ int sequenceType = 0;
+ try
+ {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ ipAddress = preferences.getString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ if (ipAddress == null)
+ {
+ ipAddress = "192.168.0.1";
+ }
+ try
+ {
+ String sequenceTypeStr = preferences.getString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ if (sequenceTypeStr != null)
+ {
+ sequenceType = Integer.parseInt(sequenceTypeStr);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ ipAddress = "192.168.0.1";
+ }
+
+ commandPublisher = new PtpIpCommandPublisher(ipAddress, CONTROL_PORT);
+ liveViewControl = new PtpIpLiveViewControl(context, ipAddress, STREAM_PORT);
+ asyncReceiver = new PtpIpAsyncResponseReceiver(ipAddress, ASYNC_RESPONSE_PORT);
+ statusChecker = new PtpIpStatusChecker(context, commandPublisher, ipAddress, EVENT_PORT);
+ canonConnection = new CanonConnection(context, provider, this, statusChecker, sequenceType);
zoomControl = new PtpIpZoomControl();
this.statusListener = statusListener;
this.runmode = new PtpIpRunMode();
this.hardwareStatus = new PtpIpHardwareStatus();
this.ptpIpButtonControl = new PtpIpButtonControl();
- this.playbackControl = new CanonPlaybackControl(activity, this);
+ this.playbackControl = new CanonPlaybackControl(context, this);
this.informationReceiver = informationReceiver;
}
--- /dev/null
+package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection
+
+import android.app.Activity
+import android.graphics.Color
+import android.util.Log
+import net.osdn.gokigen.pkremote.R
+import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraConnection
+import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusReceiver
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.IPtpIpInterfaceProvider
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandCallback
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpMessages
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandGeneric
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker
+
+class CanonCameraConnectSequenceForPlaybackType1(val context: Activity, val cameraStatusReceiver: ICameraStatusReceiver, val cameraConnection: ICameraConnection, val interfaceProvider: IPtpIpInterfaceProvider, val statusChecker: PtpIpStatusChecker) : Runnable, IPtpIpCommandCallback, IPtpIpMessages
+{
+ private val isDumpLog = true
+ private val commandIssuer = interfaceProvider.commandPublisher
+ //private var requestMessageCount = 0
+
+ override fun run()
+ {
+ try
+ {
+ Log.v(TAG, " CanonCameraConnectSequenceForPlaybackType1 START!")
+
+ // カメラとTCP接続
+ val issuer = interfaceProvider.commandPublisher
+ if (!issuer.isConnected)
+ {
+ if (!interfaceProvider.commandCommunication.connect())
+ {
+ // 接続失敗...
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.dialog_title_connect_failed_canon), false, true, Color.RED)
+ cameraConnection.alertConnectingFailed(context.getString(R.string.dialog_title_connect_failed_canon))
+ return
+ }
+ }
+ else
+ {
+ Log.v(TAG, "SOCKET IS ALREADY CONNECTED...")
+ }
+ // コマンドタスクの実行開始
+ issuer.start()
+
+ // 接続シーケンスの開始
+ sendRegistrationMessage()
+ }
+ catch (e: Exception)
+ {
+ e.printStackTrace()
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.dialog_title_connect_failed_canon), false, true, Color.RED)
+ cameraConnection.alertConnectingFailed(e.message)
+ }
+ }
+
+ override fun onReceiveProgress(currentBytes: Int, totalBytes: Int, body: ByteArray?)
+ {
+ Log.v(TAG, " $currentBytes/$totalBytes")
+ }
+
+ override fun isReceiveMulti(): Boolean
+ {
+ return false
+ }
+
+ @ExperimentalUnsignedTypes
+ override fun receivedMessage(id: Int, rx_body: ByteArray)
+ {
+ when (id)
+ {
+ IPtpIpMessages.SEQ_REGISTRATION -> if (checkRegistrationMessage(rx_body)) {
+ sendInitEventRequest(rx_body)
+ } else {
+ cameraConnection.alertConnectingFailed(context.getString(R.string.connect_error_message))
+ }
+ IPtpIpMessages.SEQ_EVENT_INITIALIZE -> if (checkEventInitialize(rx_body)) {
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting1), false, false, 0)
+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41))
+ } else {
+ cameraConnection.alertConnectingFailed(context.getString(R.string.connect_error_message))
+ }
+ IPtpIpMessages.SEQ_OPEN_SESSION -> {
+ Log.v(TAG, " SEQ_OPEN_SESSION ")
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting2), false, false, 0)
+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_INIT_SESSION, isDumpLog, 0, 0x902f))
+ }
+ IPtpIpMessages.SEQ_INIT_SESSION -> {
+ Log.v(TAG, " SEQ_INIT_SESSION ")
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting3), false, false, 0)
+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_CHANGE_REMOTE, isDumpLog, 0, 0x9114, 4, 0x15))
+ }
+ IPtpIpMessages.SEQ_CHANGE_REMOTE -> {
+ Log.v(TAG, " SEQ_CHANGE_REMOTE ")
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting4), false, false, 0)
+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_SET_EVENT_MODE, isDumpLog, 0, 0x9115, 4, 0x02))
+ }
+ IPtpIpMessages.SEQ_SET_EVENT_MODE -> {
+ Log.v(TAG, " SEQ_SET_EVENT_MODE ")
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting5), false, false, 0)
+ Log.v(TAG, " SEQ_DEVICE_PROPERTY_FINISHED ")
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connect_finished), false, false, 0)
+ connectFinished()
+ Log.v(TAG, "CHANGED MODE : DONE.")
+ }
+ else -> {
+ Log.v(TAG, "RECEIVED UNKNOWN ID : $id")
+ cameraConnection.alertConnectingFailed(context.getString(R.string.connect_receive_unknown_message))
+ }
+ }
+ }
+
+ private fun sendRegistrationMessage()
+ {
+ Log.v(TAG, " sendRegistrationMessage() ")
+
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_start), false, false, 0)
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start))
+ //commandIssuer.enqueueCommand(CanonRegistrationMessage(this))
+ }
+
+ @ExperimentalUnsignedTypes
+ private fun sendInitEventRequest(receiveData: ByteArray)
+ {
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_start_2), false, false, 0)
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start_2))
+ try
+ {
+ var eventConnectionNumber: Int = receiveData[8].toUByte().toInt() and 0xff
+ eventConnectionNumber += (receiveData[9].toUByte().toInt() and 0xff shl 8)
+ eventConnectionNumber += (receiveData[10].toUByte().toInt() and 0xff shl 16)
+ eventConnectionNumber += (receiveData[11].toUByte().toInt() and 0xff shl 24)
+ statusChecker.setEventConnectionNumber(eventConnectionNumber)
+ interfaceProvider.cameraStatusWatcher.startStatusWatch(interfaceProvider.statusListener)
+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41))
+ }
+ catch (e: Exception)
+ {
+ e.printStackTrace()
+ }
+ }
+
+ private fun checkRegistrationMessage(receiveData: ByteArray?): Boolean
+ {
+ // データ(Connection Number)がないときにはエラーと判断する
+ return !(receiveData == null || receiveData.size < 12)
+ }
+
+ private fun checkEventInitialize(receiveData: ByteArray?): Boolean
+ {
+ Log.v(TAG, "checkEventInitialize() ")
+ return receiveData != null
+ }
+
+ private fun connectFinished()
+ {
+ try
+ {
+ // 接続成功のメッセージを出す
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connected), false, false, 0)
+
+ // ちょっと待つ
+ Thread.sleep(1000)
+
+ // 接続成功!のメッセージを出す
+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connected), false, false, 0)
+ onConnectNotify()
+ }
+ catch (e: Exception)
+ {
+ e.printStackTrace()
+ }
+ }
+
+ private fun onConnectNotify()
+ {
+ try
+ {
+ val thread = Thread {
+ // カメラとの接続確立を通知する
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connected))
+ cameraStatusReceiver.onCameraConnected()
+ Log.v(TAG, " onConnectNotify()")
+ }
+ thread.start()
+ }
+ catch (e: Exception)
+ {
+ e.printStackTrace()
+ }
+ }
+
+ companion object
+ {
+ private const val TAG = "CanonConnectSeq.1"
+ }
+}
package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection;
import android.app.Activity;
+import android.util.Log;
import androidx.annotation.NonNull;
{
try
{
+ Log.v(TAG, " disconnect");
liveview.disconnect();
async.disconnect();
command.disconnect();
private final BroadcastReceiver connectionReceiver;
private final Executor cameraExecutor = Executors.newFixedThreadPool(1);
private final PtpIpStatusChecker statusChecker;
+ private final int sequenceType;
private CameraConnectionStatus connectionStatus = CameraConnectionStatus.UNKNOWN;
- public CanonConnection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IPtpIpInterfaceProvider interfaceProvider, @NonNull PtpIpStatusChecker statusChecker)
+ public CanonConnection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IPtpIpInterfaceProvider interfaceProvider, @NonNull PtpIpStatusChecker statusChecker, int sequenceType)
{
Log.v(TAG, "CanonConnection()");
this.context = context;
this.statusReceiver = statusReceiver;
this.interfaceProvider = interfaceProvider;
this.statusChecker = statusChecker;
+ this.sequenceType = sequenceType;
connectionReceiver = new BroadcastReceiver()
{
@Override
*/
private void disconnectFromCamera(final boolean powerOff)
{
- Log.v(TAG, " disconnectFromCamera()");
+ Log.v(TAG, " disconnectFromCamera() : " + powerOff);
try
{
cameraExecutor.execute(new CanonCameraDisconnectSequence(context, interfaceProvider));
connectionStatus = CameraConnectionStatus.CONNECTING;
try
{
- cameraExecutor.execute(new CanonCameraConnectSequenceForPlayback(context, statusReceiver, this, interfaceProvider, statusChecker));
+/*
+ if (sequenceType == 1)
+ {
+ cameraExecutor.execute(new CanonCameraConnectSequenceForPlaybackType1(context, statusReceiver, this, interfaceProvider, statusChecker));
+ }
+ else
+*/
+ {
+ cameraExecutor.execute(new CanonCameraConnectSequenceForPlayback(context, statusReceiver, this, interfaceProvider, statusChecker));
+ }
}
catch (Exception e)
{
String THUMBNAIL_IMAGE_CACHE_SIZE = "thumbnail_image_cache_size";
String THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE = "120";
+ String CANON_HOST_IP = "canon_host_ip";
+ String CANON_HOST_IP_DEFAULT_VALUE = "192.168.0.1";
+
+ String CANON_CONNECTION_SEQUENCE = "canon_connection_mode";
+ String CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE = "0";
+
/*
//String GR2_DISPLAY_MODE = "gr2_display_mode";
//String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0";
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
{
editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
+ }
editor.apply();
}
catch (Exception e)
<string name="pref_thumbnail_image_cache_size">サムネイル画像キャッシュ数</string>
<string name="pref_summary_thumbnail_image_cache_size">小メモリ機の場合には、この値を減らしてください。(初期値:120)</string>
+ <string name="pref_canon_host_ip">カメラIPアドレス</string>
+ <string name="pref_summary_canon_host_ip">通常、変更は不要です (初期値:192.168.0.1)</string>
+
+ <string name="pref_canon_connection_mode">接続シーケンス</string>
+ <string name="pref_summary_canon_connection_mode">通常、変更は不要です (初期値: TYPE0)</string>
+
</resources>
<item>sd2</item>
</string-array>
+ <string-array name="canon_connection_mode">
+ <item>TYPE0</item>
+ <item>TYPE1</item>
+ <item>TYPE2</item>
+ </string-array>
+
+ <string-array name="canon_connection_mode_value">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ </string-array>
+
</resources>
<string name="pref_thumbnail_image_cache_size">Thumbnail image cache size</string>
<string name="pref_summary_thumbnail_image_cache_size">If you use low memory machine, please decrease this value.(default:120)</string>
+ <string name="pref_canon_host_ip">Camera IP Address</string>
+ <string name="pref_summary_canon_host_ip">default: 192.168.0.1 </string>
+
+ <string name="pref_canon_connection_mode">Connection Sequence</string>
+ <string name="pref_summary_canon_connection_mode">default: TYPE0 </string>
+
</resources>
android:defaultValue="20"
android:summary="@string/pref_summary_canon_receive_wait" />
+ <EditTextPreference
+ android:key="canon_host_ip"
+ android:title="@string/pref_canon_host_ip"
+ android:defaultValue="192.168.0.1"
+ android:summary="@string/pref_summary_canon_host_ip" />
+
+ <ListPreference
+ android:title="@string/pref_canon_connection_mode"
+ android:summary="@string/pref_summary_canon_connection_mode"
+ android:entryValues="@array/canon_connection_mode_value"
+ android:entries="@array/canon_connection_mode"
+ android:key="canon_connection_mode"
+ android:defaultValue="0"/>
+
<!--
<PreferenceScreen