{
private final String TAG = this.toString();
- private static final int SLEEP_MS = 3000; // 待機時間
+ private static final int SLEEP_MS = 300; // 動作チェック待ち時間
+ private static final int SLEEP_WAIT_MS = 3500; // 一覧確認の待機時間 (3.5秒おき)
private AppCompatActivity activity = null;
private FileAutoTransferMain transferMain = null;
{
if (transferMain != null)
{
+ // 現在時刻を取得する
+ long checkStartTime = System.currentTimeMillis();
+
// チェックして追加ファイルがあったらダウンロード
- transferMain.downloadFiles();
+ transferMain.checkFiles();
+
+ // 画像数確認と画像取得が終わるまで、ちょっと待機...
+ while (transferMain.isChecking())
+ {
+ Thread.sleep(SLEEP_MS);
+ }
+ long checkTime = Math.abs(System.currentTimeMillis() - checkStartTime);
+ if (checkTime < SLEEP_WAIT_MS)
+ {
+ // 画像数確認の時間が規定時間よりも短い場合は、しばらく待つ
+ Thread.sleep(SLEEP_WAIT_MS - checkTime);
+ }
}
count++;
Log.v(TAG, "TRANSFER LOOP : " + count);
-
- // ちょっと待機...
- Thread.sleep(SLEEP_MS);
}
catch (Exception e)
{
private HashMap<String, ICameraContent> contentHashMap;
private boolean getRaw = false;
private boolean smallSize = false;
+ private boolean isChecking = false;
FileAutoTransferMain(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider provider, @NonNull ITransferMessage messageInterface)
}
}
+ boolean isChecking()
+ {
+ return (isChecking);
+ }
+
/**
* 画像の自動転送 本処理
*
*/
- void downloadFiles()
+ void checkFiles()
{
try
{
Log.v(TAG, "CHECK FILE");
+ isChecking = true;
interfaceProvider.getPlaybackControl().getCameraContentList(this);
}
catch (Exception e)
{
e.printStackTrace();
}
+ isChecking = false;
}
// ICameraContentListCallback
{
Log.v(TAG, "RECEIVE FAILURE...");
e.printStackTrace();
+ isChecking = false;
}
}