OSDN Git Service

コマンド送信ダイアログで、送信可能最大データ長を16バイトまで拡張する。
authorMRSa <mrsa@myad.jp>
Wed, 6 May 2020 08:05:57 +0000 (17:05 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 6 May 2020 08:05:57 +0000 (17:05 +0900)
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/cameraproperty/FujiXCameraCommandSendDialog.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/command/messages/CommandGeneric.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/command/messages/SetPropertyValue.java
app/src/main/res/layout-land/fujix_request_command_layout.xml
app/src/main/res/layout/fujix_request_command_layout.xml

index bad15b8..fa9bd32 100644 (file)
@@ -81,6 +81,8 @@ public class FujiXCameraCommandSendDialog  extends DialogFragment
             final EditText edit_command_id = alertView.findViewById(R.id.edit_command_id);
             final EditText edit_message_body1 = alertView.findViewById(R.id.edit_message_body1);
             final EditText edit_message_body2 = alertView.findViewById(R.id.edit_message_body2);
+            final EditText edit_message_body3 = alertView.findViewById(R.id.edit_message_body3);
+            final EditText edit_message_body4 = alertView.findViewById(R.id.edit_message_body4);
             final Spinner selection_command_id = alertView.findViewById(R.id.spinner_selection_command_id);
             final Spinner selection_message_type = alertView.findViewById(R.id.spinner_selection_message_type);
             final Spinner selection_message_body_length = alertView.findViewById(R.id.spinner_selection_message_body_length);
@@ -108,13 +110,23 @@ public class FujiXCameraCommandSendDialog  extends DialogFragment
                             int id = parseInt(edit_command_id);
                             int value1 = parseInt(edit_message_body1);
                             int value2 = parseInt(edit_message_body2);
+                            int value3 = parseInt(edit_message_body3);
+                            int value4 = parseInt(edit_message_body4);
                             if (selectedMessageTypePosition == 0)
                             {
-                                // single
+                                // single type
                                 if (selectedBodyLengthPosition == 0)
                                 {
                                     commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id));
                                 }
+                                else if (selectedBodyLengthPosition == 5)
+                                {
+                                    commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 16, value1, value2, value3, value4));
+                                }
+                                else if (selectedBodyLengthPosition == 4)
+                                {
+                                    commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 12, value1, value2, value3));
+                                }
                                 else if (selectedBodyLengthPosition == 3)
                                 {
                                     commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 8, value1, value2));
@@ -130,11 +142,19 @@ public class FujiXCameraCommandSendDialog  extends DialogFragment
                             }
                             else
                             {
-                                // multi
+                                // multi type
                                 if (selectedBodyLengthPosition == 0)
                                 {
                                     commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id));
                                 }
+                                else if (selectedBodyLengthPosition == 5)
+                                {
+                                    commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 16, value1, value2, value3, value4));
+                                }
+                                else if (selectedBodyLengthPosition == 4)
+                                {
+                                    commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 12, value1, value2, value3));
+                                }
                                 else if (selectedBodyLengthPosition == 3)
                                 {
                                     commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 8, value1, value2));
@@ -430,6 +450,8 @@ public class FujiXCameraCommandSendDialog  extends DialogFragment
             adapter.add("2");
             adapter.add("4");
             adapter.add("8");
+            adapter.add("12");
+            adapter.add("16");
 
             spinner.setAdapter(adapter);
             spinner.setSelection(selectedBodyLengthPosition);
index daba715..327d1a6 100644 (file)
@@ -18,6 +18,14 @@ public class CommandGeneric extends FujiXCommandBase
     private final byte data5;
     private final byte data6;
     private final byte data7;
+    private final byte data8;
+    private final byte data9;
+    private final byte dataA;
+    private final byte dataB;
+    private final byte dataC;
+    private final byte dataD;
+    private final byte dataE;
+    private final byte dataF;
 
     public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id)
     {
@@ -36,6 +44,16 @@ public class CommandGeneric extends FujiXCommandBase
         data5 = 0;
         data6 = 0;
         data7 = 0;
+
+        data8 = 0;
+        data9 = 0;
+        dataA = 0;
+        dataB = 0;
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
     }
 
     public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value)
@@ -55,6 +73,16 @@ public class CommandGeneric extends FujiXCommandBase
         data5 = ((byte)((0x0000ff00 & value) >> 8));
         data6 = ((byte)((0x00ff0000 & value) >> 16));
         data7 = ((byte)((0xff000000 & value) >> 24));
+
+        data8 = 0;
+        data9 = 0;
+        dataA = 0;
+        dataB = 0;
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
     }
 
     public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2)
@@ -74,6 +102,74 @@ public class CommandGeneric extends FujiXCommandBase
         data5 = ((byte)((0x0000ff00 & value2) >> 8));
         data6 = ((byte)((0x00ff0000 & value2) >> 16));
         data7 = ((byte)((0xff000000 & value2) >> 24));
+
+        data8 = 0;
+        data9 = 0;
+        dataA = 0;
+        dataB = 0;
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
+    }
+
+    public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3)
+    {
+        this.callback = callback;
+        this.bodySize = bodySize;
+
+        id0 = ((byte) (0x000000ff & id));
+        id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+        data0 = ((byte) (0x000000ff & value));
+        data1 = ((byte)((0x0000ff00 & value) >> 8));
+        data2 = ((byte)((0x00ff0000 & value) >> 16));
+        data3 = ((byte)((0xff000000 & value) >> 24));
+
+        data4 = ((byte) (0x000000ff & value2));
+        data5 = ((byte)((0x0000ff00 & value2) >> 8));
+        data6 = ((byte)((0x00ff0000 & value2) >> 16));
+        data7 = ((byte)((0xff000000 & value2) >> 24));
+
+        data8 = ((byte) (0x000000ff & value3));
+        data9 = ((byte)((0x0000ff00 & value3) >> 8));
+        dataA = ((byte)((0x00ff0000 & value3) >> 16));
+        dataB = ((byte)((0xff000000 & value3) >> 24));
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
+    }
+
+    public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3, int value4)
+    {
+        this.callback = callback;
+        this.bodySize = bodySize;
+
+        id0 = ((byte) (0x000000ff & id));
+        id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+        data0 = ((byte) (0x000000ff & value));
+        data1 = ((byte)((0x0000ff00 & value) >> 8));
+        data2 = ((byte)((0x00ff0000 & value) >> 16));
+        data3 = ((byte)((0xff000000 & value) >> 24));
+
+        data4 = ((byte) (0x000000ff & value2));
+        data5 = ((byte)((0x0000ff00 & value2) >> 8));
+        data6 = ((byte)((0x00ff0000 & value2) >> 16));
+        data7 = ((byte)((0xff000000 & value2) >> 24));
+
+        data8 = ((byte) (0x000000ff & value3));
+        data9 = ((byte)((0x0000ff00 & value3) >> 8));
+        dataA = ((byte)((0x00ff0000 & value3) >> 16));
+        dataB = ((byte)((0xff000000 & value3) >> 24));
+
+        dataC = ((byte) (0x000000ff & value4));
+        dataD = ((byte)((0x0000ff00 & value4) >> 8));
+        dataE = ((byte)((0x00ff0000 & value4) >> 16));
+        dataF = ((byte)((0xff000000 & value4) >> 24));
     }
 
 
@@ -143,7 +239,43 @@ public class CommandGeneric extends FujiXCommandBase
                     data0, data1, data2, data3, data4, data5, data6, data7,
             });
         }
-        else //  ボディ長が 2, 4, 8 以外の場合...
+        else if (bodySize == 12)
+        {
+            return (new byte[]{
+
+                    // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+                    (byte) 0x01, (byte) 0x00,
+
+                    // message_header.type
+                    id0, id1,
+
+                    // sequence number
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+                    // data ...
+                    data0, data1, data2, data3, data4, data5, data6, data7,
+                    data8, data9, dataA, dataB,
+            });
+        }
+        else if (bodySize == 16)
+        {
+            return (new byte[]{
+
+                    // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+                    (byte) 0x01, (byte) 0x00,
+
+                    // message_header.type
+                    id0, id1,
+
+                    // sequence number
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+                    // data ...
+                    data0, data1, data2, data3, data4, data5, data6, data7,
+                    data8, data9, dataA, dataB, dataC, dataD, dataE, dataF,
+            });
+        }
+        else //  ボディ長が 2, 4, 8, 12, 16 以外の場合...
         {
             return (new byte[]{
 
index b27c8bd..417ea8d 100644 (file)
@@ -19,6 +19,14 @@ public class SetPropertyValue extends FujiXCommandBase
     private final byte data5;
     private final byte data6;
     private final byte data7;
+    private final byte data8;
+    private final byte data9;
+    private final byte dataA;
+    private final byte dataB;
+    private final byte dataC;
+    private final byte dataD;
+    private final byte dataE;
+    private final byte dataF;
 
     public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id)
     {
@@ -37,6 +45,16 @@ public class SetPropertyValue extends FujiXCommandBase
         data5 = 0;
         data6 = 0;
         data7 = 0;
+
+        data8 = 0;
+        data9 = 0;
+        dataA = 0;
+        dataB = 0;
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
     }
 
     public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id,  int bodySize, int value)
@@ -56,6 +74,16 @@ public class SetPropertyValue extends FujiXCommandBase
         data5 = ((byte)((0x0000ff00 & value) >> 8));
         data6 = ((byte)((0x00ff0000 & value) >> 16));
         data7 = ((byte)((0xff000000 & value) >> 24));
+
+        data8 = 0;
+        data9 = 0;
+        dataA = 0;
+        dataB = 0;
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
     }
 
     public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id,  int bodySize, int value, int value2)
@@ -75,6 +103,75 @@ public class SetPropertyValue extends FujiXCommandBase
         data5 = ((byte)((0x0000ff00 & value2) >> 8));
         data6 = ((byte)((0x00ff0000 & value2) >> 16));
         data7 = ((byte)((0xff000000 & value2) >> 24));
+
+        data8 = 0;
+        data9 = 0;
+        dataA = 0;
+        dataB = 0;
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
+    }
+
+
+    public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id,  int bodySize, int value, int value2, int value3)
+    {
+        this.callback = callback;
+        this.bodySize = bodySize;
+
+        id0 = ((byte) (0x000000ff & id));
+        id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+        data0 = ((byte) (0x000000ff & value));
+        data1 = ((byte)((0x0000ff00 & value) >> 8));
+        data2 = ((byte)((0x00ff0000 & value) >> 16));
+        data3 = ((byte)((0xff000000 & value) >> 24));
+
+        data4 = ((byte) (0x000000ff & value2));
+        data5 = ((byte)((0x0000ff00 & value2) >> 8));
+        data6 = ((byte)((0x00ff0000 & value2) >> 16));
+        data7 = ((byte)((0xff000000 & value2) >> 24));
+
+        data8 = ((byte) (0x000000ff & value3));
+        data9 = ((byte)((0x0000ff00 & value3) >> 8));
+        dataA = ((byte)((0x00ff0000 & value3) >> 16));
+        dataB = ((byte)((0xff000000 & value3) >> 24));
+
+        dataC = 0;
+        dataD = 0;
+        dataE = 0;
+        dataF = 0;
+    }
+
+    public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id,  int bodySize, int value, int value2, int value3, int value4)
+    {
+        this.callback = callback;
+        this.bodySize = bodySize;
+
+        id0 = ((byte) (0x000000ff & id));
+        id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+        data0 = ((byte) (0x000000ff & value));
+        data1 = ((byte)((0x0000ff00 & value) >> 8));
+        data2 = ((byte)((0x00ff0000 & value) >> 16));
+        data3 = ((byte)((0xff000000 & value) >> 24));
+
+        data4 = ((byte) (0x000000ff & value2));
+        data5 = ((byte)((0x0000ff00 & value2) >> 8));
+        data6 = ((byte)((0x00ff0000 & value2) >> 16));
+        data7 = ((byte)((0xff000000 & value2) >> 24));
+
+        data8 = ((byte) (0x000000ff & value3));
+        data9 = ((byte)((0x0000ff00 & value3) >> 8));
+        dataA = ((byte)((0x00ff0000 & value3) >> 16));
+        dataB = ((byte)((0xff000000 & value3) >> 24));
+
+        dataC = ((byte) (0x000000ff & value4));
+        dataD = ((byte)((0x0000ff00 & value4) >> 8));
+        dataE = ((byte)((0x00ff0000 & value4) >> 16));
+        dataF = ((byte)((0xff000000 & value4) >> 24));
     }
 
 
@@ -159,7 +256,24 @@ public class SetPropertyValue extends FujiXCommandBase
                     data0, data1, data2, data3, data4, data5, data6, data7
             });
         }
-        else // その他... (ボディ長の指定が 2, 4, 8 以外の場合は ボディ長なし としてしまう)
+        else if (bodySize == 12)
+        {
+            return (new byte[]{
+                    // 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,
+
+                    // sequence number
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+                    // ...data...
+                    data0, data1, data2, data3, data4, data5, data6, data7,
+                    data8, data9, dataA, dataB,
+            });
+        }
+        else if (bodySize == 16)
         {
             return (new byte[]{
                     // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
@@ -170,9 +284,25 @@ public class SetPropertyValue extends FujiXCommandBase
 
                     // sequence number
                     (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+                    // ...data...
+                    data0, data1, data2, data3, data4, data5, data6, data7,
+                    data8, data9, dataA, dataB, dataC, dataD, dataE, dataF,
             });
         }
+        else // その他... (ボディ長の指定が 2, 4, 8 以外の場合は ボディ長なし としてしまう)
+        {
+            return (new byte[]{
+                    // 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,
 
+                    // sequence number
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            });
+        }
     }
 
     @Override
index 0fc1765..4a04647 100644 (file)
                 android:hint="@string/dialog_message_body2_hint"
                 />
 
+            <EditText android:id="@+id/edit_message_body3"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:autoLink="all"
+                android:linksClickable="true"
+                android:inputType="text"
+                android:hint="@string/dialog_message_body3_hint"
+                />
+
+            <EditText android:id="@+id/edit_message_body4"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:autoLink="all"
+                android:linksClickable="true"
+                android:inputType="text"
+                android:hint="@string/dialog_message_body4_hint"
+                />
+
             <Button
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
index 2776887..b137625 100644 (file)
                 android:hint="@string/dialog_message_body2_hint"
                 />
 
+            <EditText android:id="@+id/edit_message_body3"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:autoLink="all"
+                android:linksClickable="true"
+                android:inputType="text"
+                android:hint="@string/dialog_message_body3_hint"
+                />
+
+            <EditText android:id="@+id/edit_message_body4"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:autoLink="all"
+                android:linksClickable="true"
+                android:inputType="text"
+                android:hint="@string/dialog_message_body4_hint"
+                />
+
             <Button
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"