SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
useGrCommand = preferences.getBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
pentaxCaptureAfterAf = preferences.getBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false);
-
+ 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);
zoomControl = new RicohGr2CameraZoomLensControl();
buttonControl = new RicohGr2CameraButtonControl();
statusChecker = new RicohGr2StatusChecker(500, useGrCommand);
- playbackControl = new RicohGr2PlaybackControl();
+ playbackControl = new RicohGr2PlaybackControl(communicationTimeoutMs);
hardwareStatus = new RicohGr2HardwareStatus();
runMode = new RicohGr2RunMode();
}
private final String TAG = toString();
private final String getPhotoUrl = "http://192.168.0.1/v1/photos/";
private static final int DEFAULT_TIMEOUT = 5000;
+ private final int timeoutValue;
/*****
[操作メモ]
動画をダウンロードする : http://192.168.0.1/v1/photos/yyyRICOH/R0000xxx.MOV?size=full
*****/
- RicohGr2PlaybackControl()
+ RicohGr2PlaybackControl(int timeoutMSec)
{
-
+ this.timeoutValue = (timeoutMSec < DEFAULT_TIMEOUT) ? DEFAULT_TIMEOUT : timeoutMSec;
}
@Override
String contentList;
try
{
- contentList = SimpleHttpClient.httpGet(imageListurl, DEFAULT_TIMEOUT);
+ contentList = SimpleHttpClient.httpGet(imageListurl, timeoutValue);
if (contentList == null)
{
// ぬるぽ発行
try
{
JSONArray dirsArray = new JSONObject(contentList).getJSONArray("dirs");
- if (dirsArray != null)
+ // if (dirsArray != null)
{
int size = dirsArray.length();
for (int index = 0; index < size; index++)
Log.v(TAG, "updateCameraFileInfo() GET URL : " + url);
try
{
- String response = SimpleHttpClient.httpGet(url, DEFAULT_TIMEOUT);
+ String response = SimpleHttpClient.httpGet(url, timeoutValue);
if ((response == null)||(response.length() < 1))
{
return;
Log.v(TAG, "getContentInfo() GET URL : " + url);
try
{
- String response = SimpleHttpClient.httpGet(url, DEFAULT_TIMEOUT);
+ String response = SimpleHttpClient.httpGet(url, timeoutValue);
if ((response == null)||(response.length() < 1))
{
callback.onErrorOccurred(new NullPointerException());
Log.v(TAG, "downloadContentScreennail() GET URL : " + url);
try
{
- Bitmap bmp = SimpleHttpClient.httpGetBitmap(url, DEFAULT_TIMEOUT);
+ Bitmap bmp = SimpleHttpClient.httpGetBitmap(url, timeoutValue);
HashMap<String, Object> map = new HashMap<>();
map.put("Orientation", 0);
callback.onCompleted(bmp, map);
Log.v(TAG, "downloadContentThumbnail() GET URL : " + url);
try
{
- Bitmap bmp = SimpleHttpClient.httpGetBitmap(url, DEFAULT_TIMEOUT);
+ Bitmap bmp = SimpleHttpClient.httpGetBitmap(url, timeoutValue);
HashMap<String, Object> map = new HashMap<>();
map.put("Orientation", 0);
callback.onCompleted(bmp, map);
Log.v(TAG, "downloadContent() GET URL : " + url);
try
{
- SimpleHttpClient.httpGetBytes(url, DEFAULT_TIMEOUT, new SimpleHttpClient.IReceivedMessageCallback() {
+ SimpleHttpClient.httpGetBytes(url, timeoutValue, new SimpleHttpClient.IReceivedMessageCallback() {
@Override
public void onCompleted() {
callback.onCompleted();