OSDN Git Service

ちょっとだけ準備。
authorMRSa <mrsa@myad.jp>
Wed, 22 May 2019 15:36:24 +0000 (00:36 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 22 May 2019 15:36:24 +0000 (00:36 +0900)
app/src/main/java/net/osdn/gokigen/cameratest/fuji/Connection.java
app/src/main/java/net/osdn/gokigen/cameratest/fuji/MessageSequence.java

index b0122f7..5297495 100644 (file)
@@ -303,4 +303,34 @@ public class Connection implements IFujiStatusRequest
         }
         return (false);
     }
+
+    public boolean updateProperty(int commandCode, int setValue)
+    {
+        ReceivedDataHolder rx_bytes;
+        try {
+            byte high = (byte) ((0x0000ff00 & commandCode) >> 8);
+            byte low = (byte) (0x000000ff & commandCode);
+
+            byte data0 = (byte)((0xff000000 & setValue) >> 24);
+            byte data1 = (byte)((0x00ff0000 & setValue) >> 16);
+            byte data2 = (byte)((0x0000ff00 & setValue) >> 8);
+            byte data3 = (byte)((0x000000ff & setValue));
+
+            // two_part messageを発行 (その1)
+            comm.send_to_camera(sequence.update_property_1(high, low), true);
+            rx_bytes = comm.receive_from_camera();
+            dump_bytes(15, rx_bytes);
+            Thread.sleep(50);
+
+            // two_part messageを発行 (その2)
+            comm.send_to_camera(sequence.update_property_2(data0, data1, data2, data3), false);
+            rx_bytes = comm.receive_from_camera();
+            dump_bytes(16, rx_bytes);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (false);
+    }
 }
index 40e68fe..425cb03 100644 (file)
@@ -393,13 +393,13 @@ class MessageSequence
                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
                 (byte)0x01, (byte)0x00,
 
-                // message_header.type : two_part (0x1016)  : SetDevicePropValue
+                // message_header.type : two_part (0x1016)
                 (byte)0x16, (byte)0x10,
 
                 // message_id (0~1づつ繰り上がる)
                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
 
-                // data ...
+                // command code
                low, high,
         });
     }
@@ -410,13 +410,13 @@ class MessageSequence
                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
                 (byte)0x02, (byte)0x00,
 
-                // message_header.type : two_part (0x1016)  : SetDevicePropValue
+                // message_header.type : two_part (0x1016)
                 (byte)0x16, (byte)0x10,
 
                 // message_id (0~1づつ繰り上がる...けど two-part messageなので同じ)
                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
 
-                // data ...
+                // data...
                 data3, data2, data1, data0,
         });
     }