• R/O
  • HTTP
  • SSH
  • HTTPS

Gr2Control: コミット

Ricoh GR2 Control App for Android.


コミットメタ情報

リビジョン2fec2789cf42bbd233b2b2227bd4e0cd54e7660e (tree)
日時2020-05-06 17:05:57
作者MRSa <mrsa@myad...>
コミッターMRSa

ログメッセージ

コマンド送信ダイアログで、送信可能最大データ長を16バイトまで拡張する。

変更サマリ

差分

--- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/cameraproperty/FujiXCameraCommandSendDialog.java
+++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/cameraproperty/FujiXCameraCommandSendDialog.java
@@ -81,6 +81,8 @@ public class FujiXCameraCommandSendDialog extends DialogFragment
8181 final EditText edit_command_id = alertView.findViewById(R.id.edit_command_id);
8282 final EditText edit_message_body1 = alertView.findViewById(R.id.edit_message_body1);
8383 final EditText edit_message_body2 = alertView.findViewById(R.id.edit_message_body2);
84+ final EditText edit_message_body3 = alertView.findViewById(R.id.edit_message_body3);
85+ final EditText edit_message_body4 = alertView.findViewById(R.id.edit_message_body4);
8486 final Spinner selection_command_id = alertView.findViewById(R.id.spinner_selection_command_id);
8587 final Spinner selection_message_type = alertView.findViewById(R.id.spinner_selection_message_type);
8688 final Spinner selection_message_body_length = alertView.findViewById(R.id.spinner_selection_message_body_length);
@@ -108,13 +110,23 @@ public class FujiXCameraCommandSendDialog extends DialogFragment
108110 int id = parseInt(edit_command_id);
109111 int value1 = parseInt(edit_message_body1);
110112 int value2 = parseInt(edit_message_body2);
113+ int value3 = parseInt(edit_message_body3);
114+ int value4 = parseInt(edit_message_body4);
111115 if (selectedMessageTypePosition == 0)
112116 {
113- // single
117+ // single type
114118 if (selectedBodyLengthPosition == 0)
115119 {
116120 commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id));
117121 }
122+ else if (selectedBodyLengthPosition == 5)
123+ {
124+ commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 16, value1, value2, value3, value4));
125+ }
126+ else if (selectedBodyLengthPosition == 4)
127+ {
128+ commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 12, value1, value2, value3));
129+ }
118130 else if (selectedBodyLengthPosition == 3)
119131 {
120132 commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 8, value1, value2));
@@ -130,11 +142,19 @@ public class FujiXCameraCommandSendDialog extends DialogFragment
130142 }
131143 else
132144 {
133- // multi
145+ // multi type
134146 if (selectedBodyLengthPosition == 0)
135147 {
136148 commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id));
137149 }
150+ else if (selectedBodyLengthPosition == 5)
151+ {
152+ commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 16, value1, value2, value3, value4));
153+ }
154+ else if (selectedBodyLengthPosition == 4)
155+ {
156+ commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 12, value1, value2, value3));
157+ }
138158 else if (selectedBodyLengthPosition == 3)
139159 {
140160 commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 8, value1, value2));
@@ -430,6 +450,8 @@ public class FujiXCameraCommandSendDialog extends DialogFragment
430450 adapter.add("2");
431451 adapter.add("4");
432452 adapter.add("8");
453+ adapter.add("12");
454+ adapter.add("16");
433455
434456 spinner.setAdapter(adapter);
435457 spinner.setSelection(selectedBodyLengthPosition);
--- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/command/messages/CommandGeneric.java
+++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/command/messages/CommandGeneric.java
@@ -18,6 +18,14 @@ public class CommandGeneric extends FujiXCommandBase
1818 private final byte data5;
1919 private final byte data6;
2020 private final byte data7;
21+ private final byte data8;
22+ private final byte data9;
23+ private final byte dataA;
24+ private final byte dataB;
25+ private final byte dataC;
26+ private final byte dataD;
27+ private final byte dataE;
28+ private final byte dataF;
2129
2230 public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id)
2331 {
@@ -36,6 +44,16 @@ public class CommandGeneric extends FujiXCommandBase
3644 data5 = 0;
3745 data6 = 0;
3846 data7 = 0;
47+
48+ data8 = 0;
49+ data9 = 0;
50+ dataA = 0;
51+ dataB = 0;
52+
53+ dataC = 0;
54+ dataD = 0;
55+ dataE = 0;
56+ dataF = 0;
3957 }
4058
4159 public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value)
@@ -55,6 +73,16 @@ public class CommandGeneric extends FujiXCommandBase
5573 data5 = ((byte)((0x0000ff00 & value) >> 8));
5674 data6 = ((byte)((0x00ff0000 & value) >> 16));
5775 data7 = ((byte)((0xff000000 & value) >> 24));
76+
77+ data8 = 0;
78+ data9 = 0;
79+ dataA = 0;
80+ dataB = 0;
81+
82+ dataC = 0;
83+ dataD = 0;
84+ dataE = 0;
85+ dataF = 0;
5886 }
5987
6088 public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2)
@@ -74,6 +102,74 @@ public class CommandGeneric extends FujiXCommandBase
74102 data5 = ((byte)((0x0000ff00 & value2) >> 8));
75103 data6 = ((byte)((0x00ff0000 & value2) >> 16));
76104 data7 = ((byte)((0xff000000 & value2) >> 24));
105+
106+ data8 = 0;
107+ data9 = 0;
108+ dataA = 0;
109+ dataB = 0;
110+
111+ dataC = 0;
112+ dataD = 0;
113+ dataE = 0;
114+ dataF = 0;
115+ }
116+
117+ public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3)
118+ {
119+ this.callback = callback;
120+ this.bodySize = bodySize;
121+
122+ id0 = ((byte) (0x000000ff & id));
123+ id1 = ((byte)((0x0000ff00 & id) >> 8));
124+
125+ data0 = ((byte) (0x000000ff & value));
126+ data1 = ((byte)((0x0000ff00 & value) >> 8));
127+ data2 = ((byte)((0x00ff0000 & value) >> 16));
128+ data3 = ((byte)((0xff000000 & value) >> 24));
129+
130+ data4 = ((byte) (0x000000ff & value2));
131+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
132+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
133+ data7 = ((byte)((0xff000000 & value2) >> 24));
134+
135+ data8 = ((byte) (0x000000ff & value3));
136+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
137+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
138+ dataB = ((byte)((0xff000000 & value3) >> 24));
139+
140+ dataC = 0;
141+ dataD = 0;
142+ dataE = 0;
143+ dataF = 0;
144+ }
145+
146+ public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3, int value4)
147+ {
148+ this.callback = callback;
149+ this.bodySize = bodySize;
150+
151+ id0 = ((byte) (0x000000ff & id));
152+ id1 = ((byte)((0x0000ff00 & id) >> 8));
153+
154+ data0 = ((byte) (0x000000ff & value));
155+ data1 = ((byte)((0x0000ff00 & value) >> 8));
156+ data2 = ((byte)((0x00ff0000 & value) >> 16));
157+ data3 = ((byte)((0xff000000 & value) >> 24));
158+
159+ data4 = ((byte) (0x000000ff & value2));
160+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
161+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
162+ data7 = ((byte)((0xff000000 & value2) >> 24));
163+
164+ data8 = ((byte) (0x000000ff & value3));
165+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
166+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
167+ dataB = ((byte)((0xff000000 & value3) >> 24));
168+
169+ dataC = ((byte) (0x000000ff & value4));
170+ dataD = ((byte)((0x0000ff00 & value4) >> 8));
171+ dataE = ((byte)((0x00ff0000 & value4) >> 16));
172+ dataF = ((byte)((0xff000000 & value4) >> 24));
77173 }
78174
79175
@@ -143,7 +239,43 @@ public class CommandGeneric extends FujiXCommandBase
143239 data0, data1, data2, data3, data4, data5, data6, data7,
144240 });
145241 }
146- else // ボディ長が 2, 4, 8 以外の場合...
242+ else if (bodySize == 12)
243+ {
244+ return (new byte[]{
245+
246+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
247+ (byte) 0x01, (byte) 0x00,
248+
249+ // message_header.type
250+ id0, id1,
251+
252+ // sequence number
253+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
254+
255+ // data ...
256+ data0, data1, data2, data3, data4, data5, data6, data7,
257+ data8, data9, dataA, dataB,
258+ });
259+ }
260+ else if (bodySize == 16)
261+ {
262+ return (new byte[]{
263+
264+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
265+ (byte) 0x01, (byte) 0x00,
266+
267+ // message_header.type
268+ id0, id1,
269+
270+ // sequence number
271+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
272+
273+ // data ...
274+ data0, data1, data2, data3, data4, data5, data6, data7,
275+ data8, data9, dataA, dataB, dataC, dataD, dataE, dataF,
276+ });
277+ }
278+ else // ボディ長が 2, 4, 8, 12, 16 以外の場合...
147279 {
148280 return (new byte[]{
149281
--- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/command/messages/SetPropertyValue.java
+++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/command/messages/SetPropertyValue.java
@@ -19,6 +19,14 @@ public class SetPropertyValue extends FujiXCommandBase
1919 private final byte data5;
2020 private final byte data6;
2121 private final byte data7;
22+ private final byte data8;
23+ private final byte data9;
24+ private final byte dataA;
25+ private final byte dataB;
26+ private final byte dataC;
27+ private final byte dataD;
28+ private final byte dataE;
29+ private final byte dataF;
2230
2331 public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id)
2432 {
@@ -37,6 +45,16 @@ public class SetPropertyValue extends FujiXCommandBase
3745 data5 = 0;
3846 data6 = 0;
3947 data7 = 0;
48+
49+ data8 = 0;
50+ data9 = 0;
51+ dataA = 0;
52+ dataB = 0;
53+
54+ dataC = 0;
55+ dataD = 0;
56+ dataE = 0;
57+ dataF = 0;
4058 }
4159
4260 public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value)
@@ -56,6 +74,16 @@ public class SetPropertyValue extends FujiXCommandBase
5674 data5 = ((byte)((0x0000ff00 & value) >> 8));
5775 data6 = ((byte)((0x00ff0000 & value) >> 16));
5876 data7 = ((byte)((0xff000000 & value) >> 24));
77+
78+ data8 = 0;
79+ data9 = 0;
80+ dataA = 0;
81+ dataB = 0;
82+
83+ dataC = 0;
84+ dataD = 0;
85+ dataE = 0;
86+ dataF = 0;
5987 }
6088
6189 public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2)
@@ -75,6 +103,75 @@ public class SetPropertyValue extends FujiXCommandBase
75103 data5 = ((byte)((0x0000ff00 & value2) >> 8));
76104 data6 = ((byte)((0x00ff0000 & value2) >> 16));
77105 data7 = ((byte)((0xff000000 & value2) >> 24));
106+
107+ data8 = 0;
108+ data9 = 0;
109+ dataA = 0;
110+ dataB = 0;
111+
112+ dataC = 0;
113+ dataD = 0;
114+ dataE = 0;
115+ dataF = 0;
116+ }
117+
118+
119+ public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3)
120+ {
121+ this.callback = callback;
122+ this.bodySize = bodySize;
123+
124+ id0 = ((byte) (0x000000ff & id));
125+ id1 = ((byte)((0x0000ff00 & id) >> 8));
126+
127+ data0 = ((byte) (0x000000ff & value));
128+ data1 = ((byte)((0x0000ff00 & value) >> 8));
129+ data2 = ((byte)((0x00ff0000 & value) >> 16));
130+ data3 = ((byte)((0xff000000 & value) >> 24));
131+
132+ data4 = ((byte) (0x000000ff & value2));
133+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
134+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
135+ data7 = ((byte)((0xff000000 & value2) >> 24));
136+
137+ data8 = ((byte) (0x000000ff & value3));
138+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
139+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
140+ dataB = ((byte)((0xff000000 & value3) >> 24));
141+
142+ dataC = 0;
143+ dataD = 0;
144+ dataE = 0;
145+ dataF = 0;
146+ }
147+
148+ public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3, int value4)
149+ {
150+ this.callback = callback;
151+ this.bodySize = bodySize;
152+
153+ id0 = ((byte) (0x000000ff & id));
154+ id1 = ((byte)((0x0000ff00 & id) >> 8));
155+
156+ data0 = ((byte) (0x000000ff & value));
157+ data1 = ((byte)((0x0000ff00 & value) >> 8));
158+ data2 = ((byte)((0x00ff0000 & value) >> 16));
159+ data3 = ((byte)((0xff000000 & value) >> 24));
160+
161+ data4 = ((byte) (0x000000ff & value2));
162+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
163+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
164+ data7 = ((byte)((0xff000000 & value2) >> 24));
165+
166+ data8 = ((byte) (0x000000ff & value3));
167+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
168+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
169+ dataB = ((byte)((0xff000000 & value3) >> 24));
170+
171+ dataC = ((byte) (0x000000ff & value4));
172+ dataD = ((byte)((0x0000ff00 & value4) >> 8));
173+ dataE = ((byte)((0x00ff0000 & value4) >> 16));
174+ dataF = ((byte)((0xff000000 & value4) >> 24));
78175 }
79176
80177
@@ -159,7 +256,24 @@ public class SetPropertyValue extends FujiXCommandBase
159256 data0, data1, data2, data3, data4, data5, data6, data7
160257 });
161258 }
162- else // その他... (ボディ長の指定が 2, 4, 8 以外の場合は ボディ長なし としてしまう)
259+ else if (bodySize == 12)
260+ {
261+ return (new byte[]{
262+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
263+ (byte) 0x02, (byte) 0x00,
264+
265+ // message_header.type : two_part (0x1016)
266+ (byte) 0x16, (byte) 0x10,
267+
268+ // sequence number
269+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
270+
271+ // ...data...
272+ data0, data1, data2, data3, data4, data5, data6, data7,
273+ data8, data9, dataA, dataB,
274+ });
275+ }
276+ else if (bodySize == 16)
163277 {
164278 return (new byte[]{
165279 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
@@ -170,9 +284,25 @@ public class SetPropertyValue extends FujiXCommandBase
170284
171285 // sequence number
172286 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
287+
288+ // ...data...
289+ data0, data1, data2, data3, data4, data5, data6, data7,
290+ data8, data9, dataA, dataB, dataC, dataD, dataE, dataF,
173291 });
174292 }
293+ else // その他... (ボディ長の指定が 2, 4, 8 以外の場合は ボディ長なし としてしまう)
294+ {
295+ return (new byte[]{
296+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
297+ (byte) 0x02, (byte) 0x00,
298+
299+ // message_header.type : two_part (0x1016)
300+ (byte) 0x16, (byte) 0x10,
175301
302+ // sequence number
303+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
304+ });
305+ }
176306 }
177307
178308 @Override
--- a/app/src/main/res/layout-land/fujix_request_command_layout.xml
+++ b/app/src/main/res/layout-land/fujix_request_command_layout.xml
@@ -169,6 +169,24 @@
169169 android:hint="@string/dialog_message_body2_hint"
170170 />
171171
172+ <EditText android:id="@+id/edit_message_body3"
173+ android:layout_width="fill_parent"
174+ android:layout_height="wrap_content"
175+ android:autoLink="all"
176+ android:linksClickable="true"
177+ android:inputType="text"
178+ android:hint="@string/dialog_message_body3_hint"
179+ />
180+
181+ <EditText android:id="@+id/edit_message_body4"
182+ android:layout_width="fill_parent"
183+ android:layout_height="wrap_content"
184+ android:autoLink="all"
185+ android:linksClickable="true"
186+ android:inputType="text"
187+ android:hint="@string/dialog_message_body4_hint"
188+ />
189+
172190 <Button
173191 android:layout_width="wrap_content"
174192 android:layout_height="wrap_content"
--- a/app/src/main/res/layout/fujix_request_command_layout.xml
+++ b/app/src/main/res/layout/fujix_request_command_layout.xml
@@ -170,6 +170,24 @@
170170 android:hint="@string/dialog_message_body2_hint"
171171 />
172172
173+ <EditText android:id="@+id/edit_message_body3"
174+ android:layout_width="fill_parent"
175+ android:layout_height="wrap_content"
176+ android:autoLink="all"
177+ android:linksClickable="true"
178+ android:inputType="text"
179+ android:hint="@string/dialog_message_body3_hint"
180+ />
181+
182+ <EditText android:id="@+id/edit_message_body4"
183+ android:layout_width="fill_parent"
184+ android:layout_height="wrap_content"
185+ android:autoLink="all"
186+ android:linksClickable="true"
187+ android:inputType="text"
188+ android:hint="@string/dialog_message_body4_hint"
189+ />
190+
173191 <Button
174192 android:layout_width="wrap_content"
175193 android:layout_height="wrap_content"
旧リポジトリブラウザで表示