*
*
*/
- public static SimpleHttpSendCommandDialog newInstance(@Nullable String urlToSend, @NonNull ILiveViewControl liveViewControl, @Nullable Map<String, String> headerMap)
+ public static SimpleHttpSendCommandDialog newInstance(@Nullable String urlToSend, @Nullable ILiveViewControl liveViewControl, @Nullable Map<String, String> headerMap)
{
SimpleHttpSendCommandDialog instance = new SimpleHttpSendCommandDialog();
instance.prepare(urlToSend, liveViewControl, headerMap);
*
*
*/
- private void prepare(@Nullable String urlToSend, @NonNull ILiveViewControl liveViewControl, @Nullable Map<String, String> headerMap)
+ private void prepare(@Nullable String urlToSend, @Nullable ILiveViewControl liveViewControl, @Nullable Map<String, String> headerMap)
{
if ((urlToSend == null)||(!urlToSend.contains("http://")))
{
final Button toRunningButton = alertView.findViewById(R.id.change_to_liveview);
final Button toPlaybackButton = alertView.findViewById(R.id.change_to_playback);
- toRunningButton.setOnClickListener(this);
- toPlaybackButton.setOnClickListener(this);
+ if (liveViewControl != null)
+ {
+ toRunningButton.setOnClickListener(this);
+ toPlaybackButton.setOnClickListener(this);
+ }
+ else
+ {
+ // ライブビューのオン・オフ切り替えボタンを非表示にする
+ toRunningButton.setVisibility(View.GONE);
+ toPlaybackButton.setVisibility(View.GONE);
+ }
sendButton.setOnClickListener(this);
alertDialog.setCancelable(true);
try
{
reply = SimpleHttpClient.httpGetWithHeader(url, headerMap, null, TIMEOUT_MS);
}
- Log.v(TAG, "URL : " + url + " RESPONSE : " + reply);
+ Log.v(TAG, "URL : " + url + " "+ param + " RESP : " + reply);
final String response = reply;
activity.runOnUiThread(new Runnable() {
@Override
import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusReceiver;
import net.osdn.gokigen.pkremote.camera.utils.SimpleHttpClient;
-import java.util.HashMap;
-import java.util.Map;
-
+/**
+ * Thetaとの接続シーケンス
+ *
+ */
public class ThetaCameraConnectSequence implements Runnable
{
private final String TAG = this.toString();
@Override
public void run()
{
- final String camInfoUrl = "http://192.168.0.10/get_caminfo.cgi";
- final String getCommandListUrl = "http://192.168.0.10/get_commandlist.cgi";
- final String getConnectModeUrl = "http://192.168.0.10/get_connectmode.cgi";
+ final String oscInfoUrl = "http://192.168.1.1/osc/info";
+ final String commandsExecuteUrl = "http://192.168.1.1/osc/commands/execute";
+ final String startSessionData = "{\"name\":\"camera.startSession\",\"parameters\":{\"timeout\":0}}";
+ final String getStateUrl = "http://192.168.1.1/osc/state";
final int TIMEOUT_MS = 5000;
try
{
- Map<String, String> headerMap = new HashMap<>();
- headerMap.put("User-Agent", "OlympusCameraKit"); // "OI.Share"
- headerMap.put("X-Protocol", "OlympusCameraKit"); // "OI.Share"
-
- String response = SimpleHttpClient.httpGetWithHeader(getConnectModeUrl, headerMap, null, TIMEOUT_MS);
- Log.v(TAG, " " + getConnectModeUrl + " " + response);
+ String response = SimpleHttpClient.httpGet(oscInfoUrl, TIMEOUT_MS);
+ Log.v(TAG, " " + oscInfoUrl + " " + response);
if (response.length() > 0)
{
- String response2 = SimpleHttpClient.httpGetWithHeader(getCommandListUrl, headerMap, null, TIMEOUT_MS);
- Log.v(TAG, " " + getCommandListUrl + " " + response2);
- String response3 = SimpleHttpClient.httpGetWithHeader(camInfoUrl, headerMap, null, TIMEOUT_MS);
- Log.v(TAG, " " + camInfoUrl + " " + response3);
+ String response2 = SimpleHttpClient.httpPost(commandsExecuteUrl, startSessionData, TIMEOUT_MS);
+ Log.v(TAG, " " + commandsExecuteUrl + " " + startSessionData + " " + response2);
+
+ String response3 = SimpleHttpClient.httpPost(getStateUrl, "", TIMEOUT_MS);
+ Log.v(TAG, " " + getStateUrl + " " + response3);
onConnectNotify();
}
String CANON_RECEIVE_WAIT = "nikon_receive_wait";
String CANON_RECEIVE_WAIT_DEFAULT_VALUE = "20";
+ String HTTP_COMMAND_SEND_DIALOG = "send_command_dialog";
+
/*
//String GR2_DISPLAY_MODE = "gr2_display_mode";
//String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0";
import androidx.preference.PreferenceManager;
import net.osdn.gokigen.pkremote.R;
+import net.osdn.gokigen.pkremote.camera.utils.SimpleHttpSendCommandDialog;
import net.osdn.gokigen.pkremote.camera.vendor.theta.operation.ThetaCameraPowerOff;
import net.osdn.gokigen.pkremote.logcat.LogCatViewer;
import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
import static net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor.DEBUG_INFO;
import static net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor.EXIT_APPLICATION;
+import static net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor.HTTP_COMMAND_SEND_DIALOG;
import static net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor.WIFI_SETTINGS;
/**
try
{
//super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.preferences_panasonic);
+ addPreferencesFromResource(R.xml.preferences_theta);
ListPreference connectionMethod = findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD);
connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
findPreference(EXIT_APPLICATION).setOnPreferenceClickListener(powerOffController);
findPreference(DEBUG_INFO).setOnPreferenceClickListener(logCatViewer);
findPreference(WIFI_SETTINGS).setOnPreferenceClickListener(this);
+ findPreference(HTTP_COMMAND_SEND_DIALOG).setOnPreferenceClickListener(this);
//findPreference("panasonic_api_list").setOnPreferenceClickListener(cameraApiListViewer);
}
catch (Exception e)
try
{
String preferenceKey = preference.getKey();
+ Log.v(TAG, " onPreferenceClick : " + preferenceKey);
if (preferenceKey.contains(WIFI_SETTINGS))
{
// Wifi 設定画面を表示する
- Log.v(TAG, " onPreferenceClick : " + preferenceKey);
if (context != null)
{
context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
}
}
+ else if (preferenceKey.contains(HTTP_COMMAND_SEND_DIALOG))
+ {
+ // HTTP送信ダイアログを表示する
+ SimpleHttpSendCommandDialog.newInstance("http://192.168.1.1/", null, null).show(context.getSupportFragmentManager(), "sendCommandDialog");
+ }
return (true);
}
catch (Exception e)
<string name="pref_canon_receive_wait">応答受信待ち時間(単位:ms)</string>
<string name="pref_summary_canon_receive_wait">おかしい場合に値を大きくします</string>
+ <string name="pref_show_send_dialog">HTTP送信</string>
+ <string name="pref_summary_show_send_dialog"> </string>
<string name="dialog_http_command_title_command">HTTP送信</string>
- <string name="http_dialog_http_url_hint">http://192.168.0.10/</string>
+ <string name="http_dialog_http_url_hint">http://192.168.1.1/</string>
<string name="http_dialog_method_hint">GET/POST/PUT</string>
<string name="http_dialog_service_hint">(service)</string>
<string name="http_dialog_command_hint">(command)</string>
<string name="pref_canon_receive_wait">Receive reply wait(ms)</string>
<string name="pref_summary_canon_receive_wait"> </string>
+ <string name="pref_show_send_dialog">HTTP Send Message</string>
+ <string name="pref_summary_show_send_dialog"> </string>
<string name="dialog_http_command_title_command">HTTP Send Message</string>
- <string name="http_dialog_http_url_hint">http://192.168.0.10/</string>
+ <string name="http_dialog_http_url_hint">http://192.168.1.1/</string>
<string name="http_dialog_method_hint">GET/POST/PUT</string>
<string name="http_dialog_service_hint">(service)</string>
<string name="http_dialog_command_hint">(command)</string>
</PreferenceCategory>
-<!--
<PreferenceCategory
android:title="@string/pref_cat_camera">
+ <PreferenceScreen
+ android:key="send_command_dialog"
+ android:title="@string/pref_show_send_dialog"
+ android:summary="@string/pref_summary_show_send_dialog" />
+
+<!--
<CheckBoxPreference
android:key="capture_both_camera_and_live_view"
android:title="@string/pref_capture_both_camera_and_live_view" />
-
- </PreferenceCategory>
-->
+ </PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_cat_initialize">