--- /dev/null
+package net.osdn.gokigen.pkremote;
+
+public interface IInformationReceiver
+{
+ void updateMessage(final String message, final boolean isBold, final boolean isColor, final int color);
+}
import android.Manifest;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
+import android.graphics.Color;
+import android.graphics.Typeface;
import android.os.Bundle;
import androidx.annotation.NonNull;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
+import android.widget.TextView;
import net.osdn.gokigen.pkremote.camera.CameraInterfaceProvider;
import net.osdn.gokigen.pkremote.camera.interfaces.IInterfaceProvider;
*
*
*/
-public class MainActivity extends AppCompatActivity implements View.OnClickListener
+public class MainActivity extends AppCompatActivity implements View.OnClickListener, IInformationReceiver
{
private final String TAG = toString();
private IInterfaceProvider interfaceProvider = null;
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item)
- {
- switch (item.getItemId())
- {
+ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
+ switch (item.getItemId()) {
case R.id.navigation_home:
//
return (true);
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- try
- {
+ try {
ActionBar bar = getSupportActionBar();
- if (bar != null)
- {
+ if (bar != null) {
// タイトルバーは表示しない
bar.hide();
}
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
/**
- * パーミッション設定が終わった後...
- *
+ * パーミッション設定が終わった後...
*/
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults)
- {
+ public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
prepareClass();
onReadyClass();
/**
* クラスの初期化 (instantiate)
- *
*/
private void initializeClass()
{
- try
- {
+ try {
scenceUpdater = CameraSceneUpdater.newInstance(this);
- interfaceProvider = CameraInterfaceProvider.newInstance(this, scenceUpdater);
+ interfaceProvider = CameraInterfaceProvider.newInstance(this, scenceUpdater, this);
scenceUpdater.changeFirstFragment(interfaceProvider);
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
/**
- * 本クラスの準備
+ * 本クラスの準備
*/
- private void prepareClass()
- {
- try
- {
+ private void prepareClass() {
+ try {
mImageConnectButton.setOnClickListener(this);
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
/**
- * 初期化終了時の処理 (カメラへの自動接続)
+ * 初期化終了時の処理 (カメラへの自動接続)
*/
- private void onReadyClass()
- {
- try
- {
+ private void onReadyClass() {
+ try {
// カメラに自動接続するかどうか確認
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean isAutoConnectCamera = preferences.getBoolean(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
Log.v(TAG, "isAutoConnectCamera() : " + isAutoConnectCamera);
// カメラに接続する
- if (isAutoConnectCamera)
- {
+ if (isAutoConnectCamera) {
// 自動接続の指示があったとき
scenceUpdater.changeCameraConnection();
}
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
@Override
- public void onClick(View v)
- {
- try
- {
+ public void onClick(View v) {
+ try {
int id = v.getId();
- switch (id)
- {
+ switch (id) {
case R.id.button_wifi_connect:
// カメラとの接続を行う
scenceUpdater.changeCameraConnection();
default:
break;
}
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void updateMessage(final String message, final boolean isBold, final boolean isColor, final int color)
+ {
+ try {
+ final TextView messageArea = findViewById(R.id.message);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if ((messageArea != null) && (message != null))
+ {
+ messageArea.setText(message);
+ if (isBold)
+ {
+ messageArea.setTypeface(Typeface.DEFAULT_BOLD);
+ }
+ if (isColor)
+ {
+ messageArea.setTextColor(color);
+ }
+ else
+ {
+ messageArea.setTextColor(Color.DKGRAY);
+ }
+ messageArea.invalidate();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
}
catch (Exception e)
{
package net.osdn.gokigen.pkremote.camera;
-import android.app.Activity;
import android.content.SharedPreferences;
+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.liveview.ILiveViewListener;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentsRecognizer;
import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraHardwareStatus;
import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraInformation;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraRunMode;
import net.osdn.gokigen.pkremote.camera.interfaces.liveview.ILiveViewControl;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IPlaybackControl;
import net.osdn.gokigen.pkremote.camera.interfaces.control.IZoomLensControl;
+import net.osdn.gokigen.pkremote.camera.playback.CameraContentsRecognizer;
import net.osdn.gokigen.pkremote.camera.vendor.olympus.IOlympusInterfaceProvider;
import net.osdn.gokigen.pkremote.camera.vendor.olympus.wrapper.OlympusInterfaceProvider;
import net.osdn.gokigen.pkremote.camera.vendor.ricoh.wrapper.RicohGr2InterfaceProvider;
import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;
/**
//private final SonyCameraWrapper sony;
private final OlympusInterfaceProvider olympus;
private final RicohGr2InterfaceProvider ricohGr2;
- private final Activity context;
+ private final IInformationReceiver informationReceiver;
+ private final CameraContentsRecognizer cameraContentsRecognizer;
+ private final AppCompatActivity context;
private ICameraConnection.CameraConnectionMethod connectionMethod = ICameraConnection.CameraConnectionMethod.UNKNOWN;
- public static IInterfaceProvider newInstance(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
+ public static IInterfaceProvider newInstance(@NonNull AppCompatActivity context, @NonNull ICameraStatusReceiver provider, @NonNull IInformationReceiver informationReceiver)
{
- return (new CameraInterfaceProvider(context, provider));
+ return (new CameraInterfaceProvider(context, provider, informationReceiver));
}
/**
*
*
*/
- private CameraInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
+ private CameraInterfaceProvider(@NonNull AppCompatActivity context, @NonNull ICameraStatusReceiver provider, @NonNull IInformationReceiver informationReceiver)
{
this.context = context;
olympus = new OlympusInterfaceProvider(context, provider);
ricohGr2 = new RicohGr2InterfaceProvider(context, provider);
//sony = new SonyCameraWrapper(context, provider);
+ this.informationReceiver = informationReceiver;
+ this.cameraContentsRecognizer = new CameraContentsRecognizer(context, this);
}
@Override
*
*
*/
+ @Override
+ public IInformationReceiver getInformationReceiver()
+ {
+ return (informationReceiver);
+ }
+
+ @Override
+ public ICameraContentsRecognizer getCameraContentsRecognizer()
+ {
+ return (cameraContentsRecognizer);
+ }
+
+ /**
+ *
+ *
+ */
private ICameraConnection.CameraConnectionMethod getCammeraConnectionMethodImpl()
{
if (connectionMethod != ICameraConnection.CameraConnectionMethod.UNKNOWN)
package net.osdn.gokigen.pkremote.camera.interfaces;
+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;
import net.osdn.gokigen.pkremote.camera.interfaces.liveview.IDisplayInjector;
import net.osdn.gokigen.pkremote.camera.interfaces.liveview.ILiveViewControl;
import net.osdn.gokigen.pkremote.camera.interfaces.liveview.ILiveViewListener;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentsRecognizer;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IPlaybackControl;
import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraHardwareStatus;
import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraInformation;
IOlympusInterfaceProvider getOlympusInterfaceProvider();
ICameraConnection.CameraConnectionMethod getCammeraConnectionMethod();
- void resetCameraConnectionMethod();}
+ void resetCameraConnectionMethod();
+
+ IInformationReceiver getInformationReceiver();
+ ICameraContentsRecognizer getCameraContentsRecognizer();
+}
\ No newline at end of file
--- /dev/null
+package net.osdn.gokigen.pkremote.camera.interfaces.playback;
+
+import java.util.Date;
+
+public interface ICameraContent
+{
+ String getCameraId();
+ String getCardId();
+ String getContentPath();
+ String getContentName();
+ Date getCapturedDate();
+ void setCapturedDate(Date date);
+}
--- /dev/null
+package net.osdn.gokigen.pkremote.camera.interfaces.playback;
+
+import java.util.List;
+
+public interface ICameraContentListCallback
+{
+ void onCompleted(List<ICameraContent> contentList);
+ void onErrorOccurred(Exception e);
+}
--- /dev/null
+package net.osdn.gokigen.pkremote.camera.interfaces.playback;
+
+
+public interface ICameraContentsRecognizer
+{
+ void getRemoteCameraContentsList(ICameraContentsListCallback callback);
+
+ interface ICameraContentsListCallback
+ {
+ void contentsListCreated(int nofContents);
+ }
+}
package net.osdn.gokigen.pkremote.camera.interfaces.playback;
+import java.util.List;
+
/**
* 画像再生・取得用インタフェース
*
void downloadContentScreennail(String path, IDownloadThumbnailImageCallback callback);
void downloadContentThumbnail(String path, IDownloadThumbnailImageCallback callback);
void downloadContent(String path, boolean isSmallSize, IDownloadContentCallback callback);
+
+ void getCameraContentList(ICameraContentListCallback callback);
}
--- /dev/null
+package net.osdn.gokigen.pkremote.camera.playback;
+
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContent;
+
+import java.util.Date;
+
+public class CameraContentInfo implements ICameraContent
+{
+ private final String cameraId;
+ private final String cardId;
+ private final String contentPath;
+ private final String contentName;
+ private Date capturedDate;
+
+ public CameraContentInfo(String cameraId, String cardId, String contentPath, String contentName, Date date)
+ {
+ this.cameraId = cameraId;
+ this.cardId = cardId;
+ this.contentPath = contentPath;
+ this.contentName = contentName;
+ this.capturedDate = date;
+
+ }
+
+ @Override
+ public String getCameraId()
+ {
+ return (cameraId);
+ }
+
+ @Override
+ public String getCardId()
+ {
+ return (cardId);
+ }
+
+ @Override
+ public String getContentPath()
+ {
+ return (contentPath);
+ }
+
+ @Override
+ public String getContentName()
+ {
+ return (contentName);
+ }
+
+ @Override
+ public Date getCapturedDate()
+ {
+ return (capturedDate);
+ }
+
+ @Override
+ public void setCapturedDate(Date date)
+ {
+ this.capturedDate = date;
+ }
+}
--- /dev/null
+package net.osdn.gokigen.pkremote.camera.playback;
+
+import android.content.DialogInterface;
+import android.graphics.Color;
+import android.util.Log;
+
+import net.osdn.gokigen.pkremote.IInformationReceiver;
+import net.osdn.gokigen.pkremote.R;
+import net.osdn.gokigen.pkremote.camera.interfaces.IInterfaceProvider;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContent;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentListCallback;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentsRecognizer;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.IPlaybackControl;
+
+import java.util.Date;
+import java.util.List;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+
+/**
+ * 遠隔カメラのコンテンツを解析・保持するクラス
+ *
+ *
+ */
+public class CameraContentsRecognizer implements ICameraContentsRecognizer, ICameraContentListCallback
+{
+ private final String TAG = toString();
+ private final AppCompatActivity activity;
+ private final IInformationReceiver informationReceiver;
+ private final IInterfaceProvider interfaceProvider;
+ private ICameraContentsListCallback contentsListCallback = null;
+ private List<ICameraContent> cameraContentsList = null;
+
+ /**
+ *
+ *
+ */
+ public CameraContentsRecognizer(@NonNull AppCompatActivity activity, @NonNull IInterfaceProvider interfaceProvider)
+ {
+ this.activity = activity;
+ this.interfaceProvider = interfaceProvider;
+ this.informationReceiver = interfaceProvider.getInformationReceiver();
+ }
+
+ /**
+ *
+ *
+ */
+ @Override
+ public void getRemoteCameraContentsList(ICameraContentsListCallback callback)
+ {
+ contentsListCallback = callback;
+ getRemoteCameraContentsListImpl(this);
+ }
+
+ /**
+ *
+ *
+ */
+ private void getRemoteCameraContentsListImpl(final ICameraContentListCallback callback)
+ {
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run()
+ {
+ try
+ {
+ IPlaybackControl playbackControl = interfaceProvider.getPlaybackControl();
+ playbackControl.getCameraContentList(callback);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ try
+ {
+ if (informationReceiver != null)
+ {
+ informationReceiver.updateMessage(activity.getString(R.string.get_camera_contents_wait), false, false, 0);
+ }
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onCompleted(List<ICameraContent> contentList)
+ {
+ cameraContentsList = contentList;
+ if (contentsListCallback != null)
+ {
+ try
+ {
+ // 遠隔のカメラ内のコンテンツ一覧を引っ張ることができたよ、の通知
+ contentsListCallback.contentsListCreated(contentList.size());
+ if (informationReceiver != null)
+ {
+ informationReceiver.updateMessage(activity.getString(R.string.get_camera_contents_finished), false, false, 0);
+ }
+
+ // とりあえず、できたコンテンツ一覧をログにダンプしてみる。
+ dumpCameraContentList();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public void onErrorOccurred(Exception e)
+ {
+ cameraContentsList = null;
+ if (informationReceiver != null)
+ {
+ informationReceiver.updateMessage(activity.getString(R.string.get_camera_contents_error), false, true, Color.RED);
+ }
+
+ // 再試行する? の確認を出す
+ e.printStackTrace();
+ final AlertDialog.Builder builder = new AlertDialog.Builder(activity)
+ .setCancelable(true)
+ .setTitle(activity.getString(R.string.get_camera_contents_error))
+ .setMessage(activity.getString(R.string.get_camera_contents_error_retry))
+ .setPositiveButton(activity.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which)
+ {
+ getRemoteCameraContentsList(contentsListCallback);
+ }
+ });
+ activity.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ builder.show();
+ }
+ });
+ }
+
+ private void dumpCameraContentList()
+ {
+ Log.v(TAG, "dumpCameraContentList()");
+ if (cameraContentsList == null)
+ {
+ return;
+ }
+ try {
+ int index = 1;
+ for (ICameraContent content : cameraContentsList)
+ {
+ String cameraId = content.getCameraId();
+ String cardId = content.getCardId();
+ String path = content.getContentPath();
+ String name = content.getContentName();
+ Date date = content.getCapturedDate();
+ Log.v(TAG, index + " [" + cameraId + "] " + cardId + " : " + path + " " + name + " " + date);
+ index++;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
import android.graphics.BitmapFactory;
import android.util.Log;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContent;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentListCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraFileInfo;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IContentInfoCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadContentCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadContentListCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadThumbnailImageCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IPlaybackControl;
+import net.osdn.gokigen.pkremote.camera.playback.CameraContentInfo;
import net.osdn.gokigen.pkremote.camera.playback.CameraFileInfo;
import net.osdn.gokigen.pkremote.camera.playback.ProgressEvent;
callback.onErrorOccurred(e);
}
}
+
+ @Override
+ public void getCameraContentList(final ICameraContentListCallback callback)
+ {
+ if (callback == null)
+ {
+ // 何もせず戻る
+ return;
+ }
+ try
+ {
+ camera.downloadContentList(new OLYCamera.DownloadContentListCallback()
+ {
+ @Override
+ public void onCompleted(List<OLYCameraFileInfo> list)
+ {
+ List<ICameraContent> list2 = new ArrayList<>();
+ for (OLYCameraFileInfo fileInfo : list)
+ {
+ CameraContentInfo contentInfo = new CameraContentInfo("AirA01", "sd1", fileInfo.getDirectoryPath(), fileInfo.getDirectoryPath(), fileInfo.getDatetime());
+ list2.add(contentInfo);
+ }
+ callback.onCompleted(list2);
+ }
+
+ @Override
+ public void onErrorOccurred(Exception e)
+ {
+ callback.onErrorOccurred(e);
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ callback.onErrorOccurred(e);
+ }
+ }
}
zoomControl = new RicohGr2CameraZoomLensControl();
buttonControl = new RicohGr2CameraButtonControl();
statusChecker = new RicohGr2StatusChecker(500, useGrCommand);
- playbackControl = new RicohGr2PlaybackControl();
+ playbackControl = new RicohGr2PlaybackControl(statusChecker);
hardwareStatus = new RicohGr2HardwareStatus();
runMode = new RicohGr2RunMode();
}
import android.graphics.Bitmap;
import android.util.Log;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContent;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentListCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraFileInfo;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IContentInfoCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadContentListCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadContentCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadThumbnailImageCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IPlaybackControl;
+import net.osdn.gokigen.pkremote.camera.playback.CameraContentInfo;
import net.osdn.gokigen.pkremote.camera.playback.CameraFileInfo;
import net.osdn.gokigen.pkremote.camera.playback.ProgressEvent;
import net.osdn.gokigen.pkremote.camera.utils.SimpleHttpClient;
import org.json.JSONObject;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
{
private final String TAG = toString();
private final String getPhotoUrl = "http://192.168.0.1/v1/photos/";
+ private final RicohGr2StatusChecker statusChecker;
private static final int DEFAULT_TIMEOUT = 5000;
/*****
動画をダウンロードする : http://192.168.0.1/v1/photos/yyyRICOH/R0000xxx.MOV?size=full
*****/
- RicohGr2PlaybackControl()
+ RicohGr2PlaybackControl(RicohGr2StatusChecker statusChecker)
{
-
+ this.statusChecker = statusChecker;
}
@Override
e.printStackTrace();
}
}
+
+ private Date getCameraContentDate(@NonNull ICameraContent cameraContent)
+ {
+ return (cameraContent.getCapturedDate());
+ }
+
+ @Override
+ public void getCameraContentList(ICameraContentListCallback callback)
+ {
+ List<ICameraContent> fileList = new ArrayList<>();
+ String imageListurl = "http://192.168.0.1/v1/photos?limit=3000";
+ String contentList;
+ try
+ {
+ contentList = SimpleHttpClient.httpGet(imageListurl, DEFAULT_TIMEOUT);
+ if (contentList == null)
+ {
+ // ぬるぽ発行
+ callback.onErrorOccurred(new NullPointerException());
+ return;
+ }
+ }
+ catch (Exception e)
+ {
+ // 例外をそのまま転送
+ callback.onErrorOccurred(e);
+ return;
+ }
+ try
+ {
+ String cameraId = statusChecker.getCameraId();
+ JSONArray dirsArray = new JSONObject(contentList).getJSONArray("dirs");
+ if (dirsArray != null)
+ {
+ int size = dirsArray.length();
+ for (int index = 0; index < size; index++)
+ {
+ JSONObject object = dirsArray.getJSONObject(index);
+ String dirName = object.getString("name");
+ JSONArray filesArray = object.getJSONArray("files");
+ int nofFiles = filesArray.length();
+ for (int fileIndex = 0; fileIndex < nofFiles; fileIndex++)
+ {
+ String fileName = filesArray.getString(fileIndex);
+ ICameraContent cameraContent = new CameraContentInfo(cameraId, "sd1", dirName, fileName, new Date());
+ cameraContent.setCapturedDate(getCameraContentDate(cameraContent));
+ fileList.add(cameraContent);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ callback.onErrorOccurred(e);
+ return;
+ }
+ callback.onCompleted(fileList);
+ }
}
*
*
*/
+ String getCameraId()
+ {
+ if (statusHolder != null)
+ {
+ return (statusHolder.getCameraId());
+ }
+ return ("");
+ }
+
+ /**
+ *
+ *
+ */
@Override
public void startStatusWatch(@NonNull ICameraStatusUpdateNotify notifier)
{
buttonCode = "bdial P";
break;
case "auto":
+ default:
buttonCode = "bdial AUTO";
break;
}
private String meteringModeStatus = "";
private String wbModeStatus = "";
private String batteryStatus = "";
+ private String model = "";
+ private String serialNo = "";
/**
*
*
*
*/
+ String getCameraId()
+ {
+ return (model + " " + serialNo);
+ }
+
+ /**
+ *
+ *
+ */
List<String> getAvailableItemList(@NonNull String key)
{
List<String> itemList = new ArrayList<>();
boolean focus = getBooleanStatus(latestResultObject,"focused");
boolean focusLock = getBooleanStatus(latestResultObject,"focusLocked");
+ String modelRx = getStatusString(latestResultObject,"model");
+ String serialNoRx = getStatusString(latestResultObject,"serialNo");
+
if (result.contains("OK"))
{
if (!avStatus.equals(av))
focusLocked = focusLock;
notifier.updateFocusedStatus(focused, focusLocked);
}
+
+ if (!model.equals(modelRx))
+ {
+ model = modelRx;
+ }
+ if (!serialNo.equals(serialNoRx))
+ {
+ serialNo = serialNoRx;
+ }
}
System.gc();
}
import net.osdn.gokigen.pkremote.calendar.CalendarFragment;
import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraConnection;
import net.osdn.gokigen.pkremote.camera.interfaces.liveview.IStatusViewDrawer;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentsRecognizer;
import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusReceiver;
import net.osdn.gokigen.pkremote.camera.interfaces.IInterfaceProvider;
import net.osdn.gokigen.pkremote.logcat.LogCatFragment;
*
*
*/
-public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene
+public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene, ICameraContentsRecognizer.ICameraContentsListCallback
{
private final String TAG = toString();
private final AppCompatActivity activity;
private IInterfaceProvider interfaceProvider;
private IStatusViewDrawer statusViewDrawer;
+ private ICameraStatusReceiver anotherStatusReceiver = null;
private PreferenceFragmentCompat preferenceFragment = null;
private LogCatFragment logCatFragment = null;
statusViewDrawer.updateConnectionStatus(connection.getConnectionStatus());
}
}
+ if (anotherStatusReceiver != null)
+ {
+ anotherStatusReceiver.onStatusNotify(message);
+ }
}
catch (Exception e)
{
// ライブビューの開始... 今回は手動化。
//statusViewDrawer.startLiveView();
}
+ if (anotherStatusReceiver != null)
+ {
+ anotherStatusReceiver.onCameraConnected();
+ }
+ ICameraContentsRecognizer recognizer = interfaceProvider.getCameraContentsRecognizer();
+ if (recognizer != null)
+ {
+ // カメラ内のコンテンツ一覧を作成するように指示する
+ recognizer.getRemoteCameraContentsList(this);
+ }
}
catch (Exception e)
{
Log.v(TAG, "onCameraDisconnected()");
String message = activity.getString(R.string.camera_disconnected);
updateConnectionStatus(message, ICameraConnection.CameraConnectionStatus.DISCONNECTED);
- if (statusViewDrawer != null)
+ try
+ {
+ if (statusViewDrawer != null)
+ {
+ statusViewDrawer.updateStatusView(activity.getString(R.string.camera_disconnected));
+ statusViewDrawer.updateConnectionStatus(ICameraConnection.CameraConnectionStatus.DISCONNECTED);
+ }
+ if (anotherStatusReceiver != null)
+ {
+ anotherStatusReceiver.onCameraDisconnected();
+ }
+ }
+ catch (Exception e)
{
- statusViewDrawer.updateStatusView(activity.getString(R.string.camera_disconnected));
- statusViewDrawer.updateConnectionStatus(ICameraConnection.CameraConnectionStatus.DISCONNECTED);
+ e.printStackTrace();
}
}
statusViewDrawer.updateConnectionStatus(connectionStatus);
}
}
+ if (anotherStatusReceiver != null)
+ {
+ anotherStatusReceiver.onCameraOccursException(message, e);
+ }
}
catch (Exception ee)
{
}
}
+ @Override
+ public void setAnotherStatusReceiver(ICameraStatusReceiver statusReceiver)
+ {
+ this.anotherStatusReceiver = statusReceiver;
+ }
+
private ICameraConnection getCameraConnection(ICameraConnection.CameraConnectionMethod method)
{
Log.v(TAG, "method : " + method);
return (interfaceProvider.getCameraConnection());
}
+
+ @Override
+ public void contentsListCreated(int nofContents)
+ {
+ Log.v(TAG, "contentsListCreated() : " + nofContents);
+ }
}
package net.osdn.gokigen.pkremote.scene;
+import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusReceiver;
+
/**
*
*/
void changeSceneToApiList();
//void changeScenceToImageList();
void exitApplication();
+ void setAnotherStatusReceiver(ICameraStatusReceiver statusReceiver);
}
<string name="time_picker_end_separator"> </string>
<string name="information_month_picker">Set Year and Month</string>
+ <string name="get_camera_contents_wait">Check contents… wait</string>
+ <string name="get_camera_contents_error">Check contents… Error!</string>
+ <string name="get_camera_contents_finished">Check contents… finished</string>
+ <string name="get_camera_contents_error_retry">Try Again?</string>
+
</resources>