private final MessageSequence sequence;
private final Communication comm;
private final FujiStatusChecker statusChecker;
+ private boolean pauseRequestStatus = false;
public Connection(@NonNull Activity activity, @NonNull ILiveViewImage imageViewer, @NonNull IFujiStatusNotify notify)
{
ReceivedDataHolder rx_bytes;
comm.connect_socket();
- comm.send_to_camera(sequence.registration_message(), false);
+ comm.send_to_camera(sequence.registration_message(), false, false);
rx_bytes = comm.receive_from_camera();
dump_bytes(0, rx_bytes);
Thread.sleep(50);
}
// start_messageを送信
- comm.send_to_camera(sequence.start_message(), true);
+ comm.send_to_camera(sequence.start_message(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(1, rx_bytes);
Thread.sleep(50);
// なんだろう?? (送信が必要なようだが)
- comm.send_to_camera(sequence.start_message2(), true);
+ comm.send_to_camera(sequence.start_message2(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(2, rx_bytes);
Thread.sleep(50);
// two_part messageを発行 (その1)
- comm.send_to_camera(sequence.start_message3_1(), true);
+ comm.send_to_camera(sequence.start_message3_1(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(3, rx_bytes);
Thread.sleep(50);
if (rx_bytes.getData().length <= 50)
{
// two_part messageを発行 (その2)
- comm.send_to_camera(sequence.start_message3_2(), false);
+ comm.send_to_camera(sequence.start_message3_2(), false, false);
rx_bytes = comm.receive_from_camera();
dump_bytes(4, rx_bytes);
Thread.sleep(50);
}
// remote mode
- comm.send_to_camera(sequence.start_message4(), true);
+ comm.send_to_camera(sequence.start_message4(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(5, rx_bytes);
Thread.sleep(50);
if (!isBothLiveView)
{
// two_part messageを発行 (その1)
- comm.send_to_camera(sequence.start_message5_1(), true);
+ comm.send_to_camera(sequence.start_message5_1(), true, false);
rx_bytes = comm.receive_from_camera();
dump_bytes(6, rx_bytes);
Thread.sleep(50);
// two_part messageを発行 (その2)
- comm.send_to_camera(sequence.start_message5_2(), false);
+ comm.send_to_camera(sequence.start_message5_2(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(7, rx_bytes);
Thread.sleep(50);
// ????
- comm.send_to_camera(sequence.start_message6(), true);
+ comm.send_to_camera(sequence.start_message6(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(8, rx_bytes);
Thread.sleep(50);
// ????
- comm.send_to_camera(sequence.start_message7(), true);
+ comm.send_to_camera(sequence.query_camera_capabilities(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(9, rx_bytes);
Thread.sleep(50);
// ????
- comm.send_to_camera(sequence.start_message8(), true);
+ comm.send_to_camera(sequence.start_message8(), true, true);
rx_bytes = comm.receive_from_camera();
dump_bytes(10, rx_bytes);
Thread.sleep(50);
}
// リモート制御の開始!
- comm.send_to_camera(sequence.camera_remote_message(), true);
+ comm.send_to_camera(sequence.camera_remote_message(), true, true);
// 応答OKの場合は、8バイト ({0x03, 0x00, 0x01, 0x20} + {0x10, 0x02, 0x00, 0x00} )が応答されるはず
rx_bytes = comm.receive_from_camera();
{
try
{
- comm.send_to_camera(sequence.reset_message(), true);
+ comm.send_to_camera(sequence.reset_message(), true, true);
ReceivedDataHolder rx_bytes = comm.receive_from_camera();
dump_bytes(0, rx_bytes);
statusChecker.stop();
@Override
public boolean requestStatus()
{
+ if (pauseRequestStatus)
+ {
+ // ステータス更新を一時停止する。
+ return (false);
+ }
try
{
- comm.send_to_camera(sequence.status_request_message(), true);
+ comm.send_to_camera(sequence.status_request_message(), true, true);
ReceivedDataHolder rx_bytes = comm.receive_from_camera();
if (rx_bytes.getData().length > 0)
{
byte y = (byte) (0x000000ff & Math.round(point.y));
Log.v(TAG, "DRIVE AF (" + x + "," + y + ")");
- comm.send_to_camera(sequence.execute_focus_lock(x, y), true);
+ comm.send_to_camera(sequence.execute_focus_lock(x, y), true, true);
ReceivedDataHolder rx_bytes = comm.receive_from_camera();
dump_bytes(16, rx_bytes);
{
currentValue = FILM_SIMULATION_MIN;
}
- return (updateProperty(FILM_SIMULATION, currentValue));
+ return (updateProperty(FILM_SIMULATION, currentValue, true));
}
catch (Exception e)
{
{
currentValue = IMAGE_ASPECT_MIN;
}
- return (updateProperty(IMAGE_ASPECT, currentValue));
+ return (updateProperty(IMAGE_ASPECT, currentValue, true));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ public boolean execute_query_camera_capability()
+ {
+ pauseRequestStatus = true;
+ try
+ {
+ comm.send_to_camera(sequence.query_camera_capabilities(), true, true);
+ Thread.sleep(50);
+ ReceivedDataHolder rx_bytes = comm.receive_from_camera();
+ dump_bytes(21, rx_bytes);
}
catch (Exception e)
{
e.printStackTrace();
}
+ pauseRequestStatus = false;
return (false);
}
{
try
{
- comm.send_to_camera(sequence.execute_focus_unlock(), true);
+ comm.send_to_camera(sequence.execute_focus_unlock(), true, true);
ReceivedDataHolder rx_bytes = comm.receive_from_camera();
dump_bytes(17, rx_bytes);
{
try
{
- comm.send_to_camera(sequence.execute_shutter_message(), true);
+ comm.send_to_camera(sequence.execute_shutter_message(), true, true);
ReceivedDataHolder rx_bytes = comm.receive_from_camera();
dump_bytes(14, rx_bytes);
return (false);
}
- public boolean updateProperty(int commandCode, int setValue)
+ private boolean updateProperty(int commandCode, int setValue, boolean isShort)
{
+ pauseRequestStatus = true;
ReceivedDataHolder rx_bytes;
try {
byte high = (byte) ((0x0000ff00 & commandCode) >> 8);
byte data3 = (byte)((0x000000ff & setValue));
// two_part messageを発行 (その1)
- comm.send_to_camera(sequence.update_property_1(high, low), true);
+ comm.send_to_camera(sequence.update_property_1(high, low), true, false);
+ Thread.sleep(50);
rx_bytes = comm.receive_from_camera();
- dump_bytes(15, rx_bytes);
+ dump_bytes(19, rx_bytes);
+/*
+ // two_part messageを発行 (その1) : ダミーでもう一発...!
+ comm.send_to_camera(sequence.update_property_1(high, low), true, false);
Thread.sleep(50);
-
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(15, rx_bytes);
+*/
// two_part messageを発行 (その2)
- comm.send_to_camera(sequence.update_property_2(data0, data1, data2, data3), false);
+ comm.send_to_camera((isShort) ? sequence.update_property_2(data2, data3) : sequence.update_property_2(data0, data1, data2, data3), true, true);
+ Thread.sleep(50);
rx_bytes = comm.receive_from_camera();
- dump_bytes(16, rx_bytes);
+ dump_bytes(20, rx_bytes);
}
catch (Exception e)
{
e.printStackTrace();
}
+ pauseRequestStatus = false;
return (false);
}
}