OSDN Git Service

大容量ファイルの受信でまだ問題がありそう。いったん保管。
[gokigen/PKRemote.git] / app / src / main / java / net / osdn / gokigen / pkremote / camera / vendor / ptpip / wrapper / command / messages / specific / CanonRequestInnerDevelopStart.java
1 package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific;
2
3 import androidx.annotation.NonNull;
4
5 import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandCallback;
6 import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandBase;
7
8 public class CanonRequestInnerDevelopStart  extends PtpIpCommandBase
9 {
10     private final IPtpIpCommandCallback callback;
11     private final boolean isDumpLog;
12     private final int id;
13
14     private final byte data0;
15     private final byte data1;
16     private final byte data2;
17     private final byte data3;
18
19     public CanonRequestInnerDevelopStart(@NonNull IPtpIpCommandCallback callback, boolean isDumpLog, int id, int objectId)
20     {
21         this.callback = callback;
22         this.isDumpLog = isDumpLog;
23         this.id = id;
24
25         data0 = ((byte) (0x000000ff & objectId));
26         data1 = ((byte)((0x0000ff00 & objectId) >> 8));
27         data2 = ((byte)((0x00ff0000 & objectId) >> 16));
28         data3 = ((byte)((0xff000000 & objectId) >> 24));
29     }
30
31     @Override
32     public IPtpIpCommandCallback responseCallback()
33     {
34         return (callback);
35     }
36
37     @Override
38     public int getId()
39     {
40         return (id);
41     }
42
43     @Override
44     public boolean dumpLog()
45     {
46         return (isDumpLog);
47     }
48
49     @Override
50     public byte[] commandBody()
51     {
52         return (new byte[]{
53                 // packet type
54                 (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00,
55
56                 // data phase info
57                 (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
58
59                 // operation code
60                 (byte) 0x41, (byte) 0x91,
61
62                  // sequence number
63                 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
64
65                 // object id
66                 data0, data1, data2, data3,
67
68                 // ???
69                 (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00,
70         });
71     }
72
73     @Override
74     public byte[] commandBody2()
75     {
76         return (new byte[]{
77
78                 // packet type
79                 (byte) 0x09, (byte) 0x00, (byte) 0x00, (byte) 0x00,
80
81                 // sequence number
82                 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
83
84                 // データサイズ
85                 (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00,
86                 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
87         });
88     }
89
90     @Override
91     public byte[] commandBody3()
92     {
93         return (new byte[]{
94
95                 // packet type
96                 (byte) 0x0c, (byte) 0x00, (byte) 0x00, (byte) 0x00,
97
98                 // sequence number
99                 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
100
101                 // data
102                 (byte) 0x0f, (byte) 0x00, (byte) 0x00, (byte) 0x00,
103                 (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
104         });
105     }
106
107 }