OSDN Git Service

Seq番号の更新を見直し、接続の安定性を上げる。
[gokigen/FujiCam.git] / app / src / main / java / net / osdn / gokigen / cameratest / fuji / MessageSequence.java
1 package net.osdn.gokigen.cameratest.fuji;
2
3 class MessageSequence
4 {
5
6     static final int IMAGE_INFO = 0x1008;
7     static final int THUMBNAIL = 0x100a;
8
9     static final int FULL_IMAGE = 0x101b;
10     static final int CAMERA_LAST_IMAGE = 0x9022;
11
12     static final int CAMERA_CAPABILITIES = 0x902b;
13
14     static final int SHUTTER_SPEED = 0x902c;
15     static final int APERTURE = 0x902d;
16
17     byte[] registration_message()
18     {
19         return (new byte[] {
20                 // length byte :  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
21                 // header
22                 (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xf2, (byte)0xe4, (byte)0x53, (byte)0x8f,
23                 (byte)0xad, (byte)0xa5, (byte)0x48, (byte)0x5d, (byte)0x87, (byte)0xb2, (byte)0x7f, (byte)0x0b,
24                 (byte)0xd3, (byte)0xd5, (byte)0xde, (byte)0xd0, // (byte)0x02, (byte)0x78, (byte)0xa8, (byte)0xc0,
25                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
26
27 /**/
28                 // device_name 'GOKIGEN____012345678'
29                 (byte)0x47, (byte)0x00, (byte)0x4f, (byte)0x00, (byte)0x4b, (byte)0x00, (byte)0x49, (byte)0x00,
30                 (byte)0x47, (byte)0x00, (byte)0x45, (byte)0x00, (byte)0x4e, (byte)0x00, (byte)0x5f, (byte)0x00,
31                 (byte)0x5f, (byte)0x00, (byte)0x5f, (byte)0x00, (byte)0x5f, (byte)0x00, (byte)0x30, (byte)0x00,
32                 (byte)0x31, (byte)0x00, (byte)0x32, (byte)0x00, (byte)0x33, (byte)0x00, (byte)0x34, (byte)0x00,
33                 (byte)0x35, (byte)0x00, (byte)0x36, (byte)0x00, (byte)0x37, (byte)0x00, (byte)0x38, (byte)0x00,
34                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
35                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
36 /**/
37         });
38     }
39
40     byte[] stop_message()
41     {
42         return (new byte[] {
43                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
44                 (byte)0x01, (byte)0x00,
45
46                 // message_header.type : STOP (0x1003)
47                 (byte)0x03, (byte)0x10,
48
49                 // message_id (0~1づつ繰り上がる)
50                 (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
51         });
52     }
53
54     byte[] reset_message()
55     {
56         return (new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, });
57     }
58
59     byte[] start_message()
60     {
61         return (new byte[] {
62                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
63                 (byte)0x01, (byte)0x00,
64
65                 // message_header.type : START (0x1002)  : OpenSession
66                 (byte)0x02, (byte)0x10,
67
68                 // message_id (0~1づつ繰り上がる)
69                 (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
70
71                 // data ...
72                 (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
73         });
74     }
75
76     byte[] start_message2()
77     {
78         return (new byte[] {
79                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
80                 (byte)0x01, (byte)0x00,
81
82                 // message_header.type : single_part (0x1015) : GetDevicePropValue
83                 (byte)0x15, (byte)0x10,
84
85                 // message_id (0~1づつ繰り上がる)
86                 (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00,
87
88                 // data ...
89                 (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
90
91         });
92     }
93
94     byte[] start_message3_1()
95     {
96         return (new byte[] {
97                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
98                 (byte)0x01, (byte)0x00,
99
100                 // message_header.type : two_part (0x1016) : SetDevicePropValue
101                 (byte)0x16, (byte)0x10,
102
103                 // message_id (0~1づつ繰り上がる)
104                 (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
105
106                 // data ...
107                 (byte)0x01, (byte)0xdf, (byte)0x00, (byte)0x00,
108
109         });
110     }
111
112     byte[] start_message3_2()
113     {
114         return (new byte[] {
115                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
116                 (byte)0x02, (byte)0x00,
117
118                 // message_header.type : two_part (0x1016) : SetDevicePropValue
119                 (byte)0x16, (byte)0x10,
120
121                 // message_id (0~1づつ繰り上がる...けど two-part messageなので同じ)
122                 (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
123
124                 // data ...
125                 (byte)0x05, (byte)0x00,
126
127         });
128     }
129
130     byte[] start_message4()
131     {
132         return (new byte[] {
133                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
134                 (byte)0x01, (byte)0x00,
135
136                 // message_header.type : single_part (0x1015)  : GetDevicePropValue
137                 (byte)0x15, (byte)0x10,
138
139                 // message_id (0~1づつ繰り上がる)
140                 (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00,
141
142                 // data ...
143                 (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
144
145         });
146     }
147
148     byte[] start_message5_1()
149     {
150         return (new byte[] {
151                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
152                 (byte)0x01, (byte)0x00,
153
154                 // message_header.type : two_part (0x1016)  : SetDevicePropValue
155                 (byte)0x16, (byte)0x10,
156
157                 // message_id (0~1づつ繰り上がる)
158                 (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00,
159
160                 // data ...
161                 (byte)0x24, (byte)0xdf, (byte)0x00, (byte)0x00,
162
163         });
164     }
165
166     byte[] start_message5_2()
167     {
168         return (new byte[] {
169                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
170                 (byte)0x02, (byte)0x00,
171
172                 // message_header.type : two_part (0x1016)  : SetDevicePropValue
173                 (byte)0x16, (byte)0x10,
174
175                 // message_id (0~1づつ繰り上がる...けど two-part messageなので同じ)
176                 (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00,
177
178                 // data ...
179                 (byte)0x07, (byte)0x00, (byte)0x02, (byte)0x00,
180
181         });
182     }
183
184     byte[] start_message6()
185     {
186         return (new byte[] {
187                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
188                 (byte)0x01, (byte)0x00,
189
190                 // message_header.type : single_part (0x1015)  : GetDevicePropValue
191                 (byte)0x15, (byte)0x10,
192
193                 // message_id (0~1づつ繰り上がる...)
194                 (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x00,
195
196                 // data ...
197                 (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
198
199         });
200     }
201
202
203     byte[] start_message7()
204     {
205         return (new byte[] {
206                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
207                 (byte)0x01, (byte)0x00,
208
209                 // message_header.type : camera_capabilities (0x902b)
210                 (byte)0x2b, (byte)0x90,
211
212                 // message_id (0~1づつ繰り上がる...)
213                 (byte)0x07, (byte)0x00, (byte)0x00, (byte)0x00,
214
215         });
216     }
217
218
219     byte[] start_message8()
220     {
221         return (new byte[] {
222                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
223                 (byte)0x01, (byte)0x00,
224
225                 // message_header.type : single_part (0x1015) : GetDevicePropValue
226                 (byte)0x15, (byte)0x10,
227
228                 // message_id (0~1づつ繰り上がる...)
229                 (byte)0x08, (byte)0x00, (byte)0x00, (byte)0x00,
230
231                 // data ...
232                 (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
233
234         });
235     }
236
237
238
239     byte[] start_message9()
240     {
241         return (new byte[] {
242                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
243                 (byte)0x01, (byte)0x00,
244
245                 // message_header.type : camera_remote (0x101c)  : InitiateOpenCapture
246                 (byte)0x1c, (byte)0x10,
247
248                 // message_id (0~1づつ繰り上がる...)
249                 (byte)0x09, (byte)0x00, (byte)0x00, (byte)0x00,
250
251                 // data ...
252                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
253                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
254
255         });
256     }
257
258
259     byte[] status_request_message()
260     {
261         return (new byte[] {
262
263                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
264                 (byte)0x01, (byte)0x00,
265
266                 // message_header.type : single_part (0x1015) : GetDevicePropValue
267                 (byte)0x15, (byte)0x10,
268
269                 // message_id (0~1づつ繰り上がる...)
270                 (byte)0x0A, (byte)0x00, (byte)0x00, (byte)0x00,
271
272                 // data ...
273                 (byte)0x12, (byte)0xd2, (byte)0x00, (byte)0x00,
274         });
275     }
276
277
278     byte[] execute_shutter_message()
279     {
280         return (new byte[] {
281
282                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
283                 (byte)0x01, (byte)0x00,
284
285                 // message_header.type : shutter (0x100e)
286                 (byte)0x0e, (byte)0x10,
287
288                 // message_id (0~1づつ繰り上がる...
289                 (byte)0x0B, (byte)0x00, (byte)0x00, (byte)0x00,
290
291                 // data ...
292                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
293                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
294         });
295     }
296
297
298
299     byte[] execute_focus_lock(byte pointX, byte pointY)
300     {
301         return (new byte[] {
302
303                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
304                 (byte)0x01, (byte)0x00,
305
306                 // message_header.type : focus_point (0x9026)
307                 (byte)0x26, (byte)0x90,
308
309                 // message_id (0~1づつ繰り上がる...
310                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
311
312                 // data ...
313                 pointY, pointX, (byte)0x02, (byte)0x03,
314                 //pointY, pointX, (byte)0x00, (byte)0x00,
315
316         });
317     }
318
319     byte[] execute_focus_unlock()
320     {
321         return (new byte[] {
322
323                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
324                 (byte)0x01, (byte)0x00,
325
326                 // message_header.type : focus_unlock (0x9027)
327                 (byte)0x27, (byte)0x90,
328
329                 // message_id (0~1づつ繰り上がる...
330                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
331         });
332     }
333
334     byte[] update_aperture(boolean isIncrement)
335     {
336         return (new byte[] {
337
338                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
339                 (byte)0x01, (byte)0x00,
340
341                 // message_header.type : aperture (0x5007)
342                 (byte)0x07, (byte)0x50,
343
344                 // message_id (0~1づつ繰り上がる...
345                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
346
347                 // data ...
348                 (isIncrement)? (byte) 0x01 : (byte)0x00,  (byte)0x00, (byte)0x00, (byte)0x00,
349         });
350
351     }
352
353     byte[] update_shutter_speed(boolean isIncrement)
354     {
355         return (new byte[] {
356
357                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
358                 (byte)0x01, (byte)0x00,
359
360                 // message_header.type : aperture (0xd240)
361                 (byte)0x40, (byte)0xd2,
362
363                 // message_id (0~1づつ繰り上がる...
364                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
365
366                 // data ...
367                 (isIncrement)? (byte) 0x01 : (byte)0x00,  (byte)0x00, (byte)0x00, (byte)0x00,
368         });
369
370     }
371
372     byte[] update_exposure(boolean isIncrement)
373     {
374         return (new byte[] {
375
376                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
377                 (byte)0x01, (byte)0x00,
378
379                 // message_header.type : aperture (0x902e)
380                 (byte)0x2e, (byte)0x90,
381
382                 // message_id (0~1づつ繰り上がる...
383                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
384
385                 // data ...
386                 (isIncrement)? (byte) 0x01 : (byte)0x00,  (byte)0x00, (byte)0x00, (byte)0x00,
387         });
388     }
389
390     byte[] update_property_1(byte high, byte low)
391     {
392         return (new byte[] {
393                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
394                 (byte)0x01, (byte)0x00,
395
396                 // message_header.type : two_part (0x1016)  : SetDevicePropValue
397                 (byte)0x16, (byte)0x10,
398
399                 // message_id (0~1づつ繰り上がる)
400                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
401
402                 // data ...
403                low, high,
404         });
405     }
406
407     byte[] update_property_2(byte data0, byte data1, byte data2, byte data3)
408     {
409         return (new byte[] {
410                 // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
411                 (byte)0x02, (byte)0x00,
412
413                 // message_header.type : two_part (0x1016)  : SetDevicePropValue
414                 (byte)0x16, (byte)0x10,
415
416                 // message_id (0~1づつ繰り上がる...けど two-part messageなので同じ)
417                 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
418
419                 // data ...
420                 data3, data2, data1, data0,
421         });
422     }
423 }