package net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper;
-import android.app.Activity;
-import android.content.SharedPreferences;
-import android.support.annotation.NonNull;
-import android.support.v7.preference.PreferenceManager;
import android.util.Log;
import net.osdn.gokigen.gr2control.camera.ICameraStatus;
import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
import net.osdn.gokigen.gr2control.camera.utils.SimpleHttpClient;
import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
-import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
import java.util.ArrayList;
import java.util.List;
+import androidx.annotation.NonNull;
+
/**
*
*
private final String grCommandUrl = "http://192.168.0.1/_gr";
private final int sleepMs;
- private final boolean useGrCommand;
-
private int timeoutMs = 5000;
private boolean whileFetching = false;
private RicohGr2StatusHolder statusHolder;
+ private boolean useGR2command = false;
/**
*
*
*/
- RicohGr2StatusChecker(@NonNull Activity context, int sleepMs)
+ RicohGr2StatusChecker(int sleepMs)
{
- SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
- useGrCommand = preferences.getBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
this.sleepMs = sleepMs;
}
+ public void setUseGR2Command(boolean useGR2command)
+ {
+ this.useGR2command = useGR2command;
+ }
+
/**
*
*
*
*/
@Override
- public void stoptStatusWatch()
+ public void stopStatusWatch()
{
Log.v(TAG, "stoptStatusWatch()");
whileFetching = false;
{
String response;
String postData = key + "=" + value;
- if ((useGrCommand)&&(key.equals("exposureMode")))
+ if ((useGR2command)&&(key.equals("exposureMode")))
{
// 撮影モードを変更するときは、GR専用コマンドを送ることにする。
postData = "cmd=" + decideButtonCode(value);
response = SimpleHttpClient.httpPut(statusSetUrl, postData, timeoutMs);
Log.v(TAG, "SET PROPERTY : " + postData + " resp. (" + response.length() + "bytes.)");
}
- if (useGrCommand)
+ if (useGR2command)
{
// GR専用コマンドで、画面表示をリフレッシュ
response = SimpleHttpClient.httpPost(grCommandUrl, "cmd=mode refresh", timeoutMs);