{
boolean ret = false;
- ret = connect_to_camera();
-
+ if (connect_to_camera())
+ {
+ ret = get_current_settings();
+ }
return (ret);
}
/*
応答エラーの場合は この値が返ってくるはず = {0x05, 0x00, 0x00, 0x00, 0x19, 0x20, 0x00, 0x00};
*/
+
+ // start_messageを送信
comm.send_to_camera(sequence.start_message());
rx_bytes = comm.receive_from_camera();
dump_bytes(indexNumber, rx_bytes);
indexNumber++;
+/**/
+ // なんだろう?? (必要なようだが)
+ comm.send_to_camera(sequence.start_message2());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+/**/
+
+ // two_part messageを発行 (その1)
+ comm.send_to_camera(sequence.start_message3_1());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+ // two_part messageを発行 (その2)
+ comm.send_to_camera(sequence.start_message3_2());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+ // remote mode
+ comm.send_to_camera(sequence.start_message4());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+
+ // two_part messageを発行 (その1)
+ comm.send_to_camera(sequence.start_message5_1());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+ // two_part messageを発行 (その2)
+ comm.send_to_camera(sequence.start_message5_2());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+
+ // ????
+ comm.send_to_camera(sequence.start_message6());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+
+ // ????
+ comm.send_to_camera(sequence.start_message7());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+ // ????
+ comm.send_to_camera(sequence.start_message8());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+ // ????
+ comm.send_to_camera(sequence.start_message9());
+
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(indexNumber, rx_bytes);
+ indexNumber++;
+
+
+/*
comm.send_to_camera(sequence.start_message2());
//byte[] rx_bytes = comm.receive_from_camera();
rx_bytes = comm.receive_from_camera();
dump_bytes(indexNumber, rx_bytes);
indexNumber++;
+*/
/*
応答OKの場合は、8バイト ({0x03, 0x00, 0x01, 0x20} + {0x10, 0x02, 0x00, 0x00} )が応答されるはず
fuji_twopart_message(sockfd, msg4_1, msg4_2);
*/
+ // 別のポートもオープンしておく
+ comm.start_stream();
+ comm.start_response();
+
+ Log.v(TAG, "connect_to_camera DONE.");
return (true);
}
return (false);
}
+ private boolean get_current_settings()
+ {
+ try
+ {
+ comm.send_to_camera(sequence.status_request_message());
+
+ ReceivedData rx_bytes = comm.receive_from_camera();
+ dump_bytes(12, rx_bytes);
+
+ // なんで2回... でもやってみる
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(13, rx_bytes);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+
private void dump_bytes(int indexNumber,ReceivedData data)
{
}
System.gc();
}
+
+ public boolean execute_shutter()
+ {
+ try
+ {
+ comm.send_to_camera(sequence.execute_shutter_message());
+
+ ReceivedData rx_bytes = comm.receive_from_camera();
+ dump_bytes(14, rx_bytes);
+
+ // なんで2回... でもやってみる
+ rx_bytes = comm.receive_from_camera();
+ dump_bytes(15, rx_bytes);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
}
(byte)0xad, (byte)0xa5, (byte)0x48, (byte)0x5d, (byte)0x87, (byte)0xb2, (byte)0x7f, (byte)0x0b,
(byte)0xd3, (byte)0xd5, (byte)0xde, (byte)0xd0, // (byte)0x02, (byte)0x78, (byte)0xa8, (byte)0xc0,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+/**/
// device_name 'ASUS_Z01BDA-2348'
(byte)0x41, (byte)0x00, (byte)0x53, (byte)0x00, (byte)0x55, (byte)0x00, (byte)0x53, (byte)0x00,
(byte)0x5f, (byte)0x00, (byte)0x5a, (byte)0x00, (byte)0x30, (byte)0x00, (byte)0x31, (byte)0x00,
(byte)0x42, (byte)0x00, (byte)0x44, (byte)0x00, (byte)0x41, (byte)0x00, (byte)0x2d, (byte)0x00,
(byte)0x32, (byte)0x00, (byte)0x33, (byte)0x00, (byte)0x34, (byte)0x00, (byte)0x38, (byte)0x00,
-
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-
-/*
- (byte)0xb0, (byte)0x00, (byte)0xf5, (byte)0x00, (byte)0x5d, (byte)0x00, (byte)0xa1, (byte)0x00,
- (byte)0x7f, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-*/
-/**/
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
/**/
/*
- // device_name 'GOKIGEN device 0'
+ // device_name 'GOKIGEN____0123'
(byte)0x47, (byte)0x00, (byte)0x4f, (byte)0x00, (byte)0x4b, (byte)0x00, (byte)0x49, (byte)0x00,
- (byte)0x47, (byte)0x00, (byte)0x45, (byte)0x00, (byte)0x4e, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x47, (byte)0x00, (byte)0x45, (byte)0x00, (byte)0x4e, (byte)0x00, (byte)0x5f, (byte)0x00,
+ (byte)0x5f, (byte)0x00, (byte)0x5f, (byte)0x00, (byte)0x5f, (byte)0x00, (byte)0x30, (byte)0x00,
+ (byte)0x31, (byte)0x00, (byte)0x32, (byte)0x00, (byte)0x33, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte) 0x01, (byte) 0x00, (byte) 0x02, (byte) 0x10, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00,
*/
- // START (0x1002)
- (byte)0x10, (byte)0x02,
- // index
- (byte)0x00, (byte)0x01,
- // data
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : START (0x1002)
+ (byte)0x02, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる)
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
(byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
});
}
-
byte[] start_message2()
{
return (new byte[] {
- //
+/*
+ // 現物...
(byte) 0x01, (byte) 0x00, (byte) 0x15, (byte) 0x10, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x12, (byte) 0xd2, (byte) 0x00, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015)
+ (byte)0x15, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる)
+ (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
+
+ });
+ }
+
+ byte[] start_message3_1()
+ {
+ return (new byte[] {
/*
- // START (0x1002)
- (byte)0x10, (byte)0x02,
- // index
- (byte)0x00, (byte)0x01,
- // data
- (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+ // 現物...
+ (byte) 0x01, (byte) 0x00, (byte) 0x16, (byte) 0x10, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01, (byte) 0xdf, (byte) 0x00, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte)0x16, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる)
+ (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x01, (byte)0xdf, (byte)0x00, (byte)0x00,
+
+ });
+ }
+
+ byte[] start_message3_2()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x02, (byte) 0x00, (byte) 0x16, (byte) 0x10, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x05, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte)0x16, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる...けど two-part messageなので同じ)
+ (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x05, (byte)0x00,
+
+ });
+ }
+
+
+ byte[] start_message4()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x01, (byte) 0x00, (byte) 0x15, (byte) 0x10, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x24, (byte) 0xdf, (byte) 0x00, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015)
+ (byte)0x15, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる)
+ (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
+
+ });
+ }
+
+ byte[] start_message5_1()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x01, (byte) 0x00, (byte) 0x16, (byte) 0x10, (byte) 0x05, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x24, (byte) 0xdf, (byte) 0x00, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte)0x16, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる)
+ (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
+
+ });
+ }
+
+ byte[] start_message5_2()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x02, (byte) 0x00, (byte) 0x16, (byte) 0x10, (byte) 0x05, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x02, (byte)0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte)0x16, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる...けど two-part messageなので同じ)
+ (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x07, (byte)0x00, (byte)0x02, (byte)0x00,
+
+ });
+ }
+
+ byte[] start_message6()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x01, (byte) 0x00, (byte) 0x15, (byte) 0x10, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x12, (byte) 0xd2, (byte) 0x00, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015)
+ (byte)0x15, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる...)
+ (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
+
+ });
+ }
+
+
+ byte[] start_message7()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x01, (byte) 0x00, (byte) 0x2b, (byte) 0x90, (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : camera_capabilities (0x902b)
+ (byte)0x2b, (byte)0x90,
+
+ // message_id (0~1づつ繰り上がる...)
+ (byte)0x07, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ });
+ }
+
+
+ byte[] start_message8()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x01, (byte) 0x00, (byte) 0x15, (byte) 0x10, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x12, (byte) 0xd2, (byte) 0x00, (byte) 0x00
*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015)
+ (byte)0x15, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる...)
+ (byte)0x08, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
+
});
}
+ byte[] start_message9()
+ {
+ return (new byte[] {
+/*
+ // 現物...
+ (byte) 0x01, (byte) 0x00, (byte) 0x1c, (byte) 0x10, (byte) 0x09, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+*/
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : camera_remote (0x101c)
+ (byte)0x1c, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる...)
+ (byte)0x09, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ });
+ }
+
+
+ byte[] status_request_message()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : single_part (0x1015)
+ (byte)0x15, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる...)
+ (byte)0x0A, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
+ });
+ }
+
+
+ byte[] execute_shutter_message()
+ {
+ return (new byte[] {
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte)0x01, (byte)0x00,
+
+ // message_header.type : shutter (0x100e)
+ (byte)0x0e, (byte)0x10,
+
+ // message_id (0~1づつ繰り上がる...
+ (byte)0x0B, (byte)0x00, (byte)0x00, (byte)0x00,
+
+ // data ...
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ });
+ }
+
+
byte[] two_part_message_One()
{
return (new byte[] {