Pentax DSLR Remote Control app.
Révision | 02a8162a8e8cf2a7c9bf6c29bb7d84efda890fc1 (tree) |
---|---|
l'heure | 2021-01-02 20:58:35 |
Auteur | MRSa <mrsa@myad...> |
Commiter | MRSa |
IXY210でスモール画像を取得できるようにする。(スモール画像取得シーケンス TYPE1)
@@ -17,7 +17,18 @@ public class CanonRequestInnerDevelopStart extends PtpIpCommandBase | ||
17 | 17 | private final byte data2; |
18 | 18 | private final byte data3; |
19 | 19 | |
20 | - public CanonRequestInnerDevelopStart(@NonNull IPtpIpCommandCallback callback, int id, boolean isDumpLog, int holdId, int objectId) | |
20 | + private final byte data4; | |
21 | + private final byte data5; | |
22 | + private final byte data6; | |
23 | + private final byte data7; | |
24 | + | |
25 | + private final byte data8; | |
26 | + private final byte data9; | |
27 | + private final byte dataA; | |
28 | + private final byte dataB; | |
29 | + | |
30 | + | |
31 | + public CanonRequestInnerDevelopStart(@NonNull IPtpIpCommandCallback callback, int id, boolean isDumpLog, int holdId, int objectId, int dataX, int dataY) | |
21 | 32 | { |
22 | 33 | this.callback = callback; |
23 | 34 | this.isDumpLog = isDumpLog; |
@@ -28,6 +39,17 @@ public class CanonRequestInnerDevelopStart extends PtpIpCommandBase | ||
28 | 39 | data1 = ((byte)((0x0000ff00 & objectId) >> 8)); |
29 | 40 | data2 = ((byte)((0x00ff0000 & objectId) >> 16)); |
30 | 41 | data3 = ((byte)((0xff000000 & objectId) >> 24)); |
42 | + | |
43 | + data4 = ((byte) (0x000000ff & dataX)); | |
44 | + data5 = ((byte)((0x0000ff00 & dataX) >> 8)); | |
45 | + data6 = ((byte)((0x00ff0000 & dataX) >> 16)); | |
46 | + data7 = ((byte)((0xff000000 & dataX) >> 24)); | |
47 | + | |
48 | + data8 = ((byte) (0x000000ff & dataY)); | |
49 | + data9 = ((byte)((0x0000ff00 & dataY) >> 8)); | |
50 | + dataA = ((byte)((0x00ff0000 & dataY) >> 16)); | |
51 | + dataB = ((byte)((0xff000000 & dataY) >> 24)); | |
52 | + | |
31 | 53 | } |
32 | 54 | |
33 | 55 | @Override |
@@ -101,8 +123,8 @@ public class CanonRequestInnerDevelopStart extends PtpIpCommandBase | ||
101 | 123 | (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, |
102 | 124 | |
103 | 125 | // data |
104 | - (byte) 0x0f, (byte) 0x00, (byte) 0x00, (byte) 0x00, | |
105 | - (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, | |
126 | + data4, data5, data6, data7, | |
127 | + data8, data9, dataA, dataB, | |
106 | 128 | }); |
107 | 129 | } |
108 | 130 |
@@ -124,5 +146,4 @@ public class CanonRequestInnerDevelopStart extends PtpIpCommandBase | ||
124 | 146 | return (false); |
125 | 147 | } |
126 | 148 | |
127 | - | |
128 | 149 | } |
@@ -74,13 +74,13 @@ public class CanonPlaybackControl implements IPlaybackControl | ||
74 | 74 | this.activity = activity; |
75 | 75 | this.provider = provider; |
76 | 76 | this.fullImageReceiver = new CanonFullImageReceiver(activity, provider.getCommandPublisher()); |
77 | - if (smallImageSequence == 1) | |
77 | + if (smallImageSequence == 2) | |
78 | 78 | { |
79 | - this.smallImageReciever = new CanonReducedImageReceiver(activity, provider.getCommandPublisher()); | |
79 | + this.smallImageReciever = new CanonReducedImageReceiver(activity, provider.getCommandPublisher(), smallImageSequence); | |
80 | 80 | } |
81 | 81 | else |
82 | 82 | { |
83 | - this.smallImageReciever = new CanonSmallImageReceiver(activity, provider.getCommandPublisher()); | |
83 | + this.smallImageReciever = new CanonSmallImageReceiver(activity, provider.getCommandPublisher(), smallImageSequence); | |
84 | 84 | } |
85 | 85 | canonImageObjectReceiver = new CanonImageObjectReceiver(provider, delayMs); |
86 | 86 | } |
@@ -147,7 +147,7 @@ public class CanonPlaybackControl implements IPlaybackControl | ||
147 | 147 | |
148 | 148 | // 画像を取得する |
149 | 149 | CanonScreennailImageReceiver receiver = new CanonScreennailImageReceiver(activity, objectId, publisher, callback); |
150 | - publisher.enqueueCommand(new CanonRequestInnerDevelopStart(receiver, objectId, true, objectId, objectId)); // 0x9141 : RequestInnerDevelopStart | |
150 | + publisher.enqueueCommand(new CanonRequestInnerDevelopStart(receiver, objectId, true, objectId, objectId, 0x0f, 0x02)); // 0x9141 : RequestInnerDevelopStart | |
151 | 151 | } |
152 | 152 | } |
153 | 153 | catch (Exception e) |
@@ -4,6 +4,7 @@ import android.app.Activity | ||
4 | 4 | import android.util.Log |
5 | 5 | import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadContentCallback |
6 | 6 | import net.osdn.gokigen.pkremote.camera.interfaces.playback.IProgressEvent |
7 | +import net.osdn.gokigen.pkremote.camera.utils.SimpleLogDumper | |
7 | 8 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandCallback |
8 | 9 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandPublisher |
9 | 10 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandCanonGetPartialObject |
@@ -11,8 +12,9 @@ import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.Pt | ||
11 | 12 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific.CanonRequestInnerDevelopEnd |
12 | 13 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific.CanonRequestInnerDevelopStart |
13 | 14 | import java.io.ByteArrayOutputStream |
15 | +import java.util.* | |
14 | 16 | |
15 | -class CanonReducedImageReceiver(private val activity: Activity, private val publisher: IPtpIpCommandPublisher) : IPtpIpCommandCallback, ICanonSmallImageReceiver | |
17 | +class CanonReducedImageReceiver(private val activity: Activity, private val publisher: IPtpIpCommandPublisher, private val sequenceType : Int) : IPtpIpCommandCallback, ICanonSmallImageReceiver | |
16 | 18 | { |
17 | 19 | private val mine = this |
18 | 20 |
@@ -36,6 +38,9 @@ class CanonReducedImageReceiver(private val activity: Activity, private val publ | ||
36 | 38 | } |
37 | 39 | this.callback = callback |
38 | 40 | this.objectId = objectId |
41 | + | |
42 | + publisher.enqueueCommand(PtpIpCommandGeneric(this, objectId + 11, false, objectId, 0x911b, 4, 0x00)) // 0x911b : SetUILock | |
43 | +/* | |
39 | 44 | publisher.enqueueCommand(CanonRequestInnerDevelopStart(object : IPtpIpCommandCallback { |
40 | 45 | override fun receivedMessage(id: Int, rx_body: ByteArray?) { |
41 | 46 | Log.v(TAG, " getRequestStatusEvent : $objectId " + (rx_body?.size ?: 0)) |
@@ -44,6 +49,7 @@ class CanonReducedImageReceiver(private val activity: Activity, private val publ | ||
44 | 49 | override fun onReceiveProgress(currentBytes: Int, totalBytes: Int, rx_body: ByteArray?) { } |
45 | 50 | override fun isReceiveMulti(): Boolean { return (false) } |
46 | 51 | }, objectId, false, objectId, objectId)) // 0x9141 : RequestInnerDevelopStart |
52 | +*/ | |
47 | 53 | } |
48 | 54 | |
49 | 55 | override fun receivedMessage(id: Int, rx_body: ByteArray?) |
@@ -68,7 +74,26 @@ class CanonReducedImageReceiver(private val activity: Activity, private val publ | ||
68 | 74 | (objectId + 4) -> { |
69 | 75 | // 画像取得終了 |
70 | 76 | Log.v(TAG, " ----- SMALL IMAGE RECEIVE SEQUENCE FINISHED : $objectId") |
71 | - callback!!.onCompleted() | |
77 | + callback?.onCompleted() | |
78 | + objectId = 0 | |
79 | + callback = null | |
80 | + receivedTotalBytes = 0 | |
81 | + receivedRemainBytes = 0 | |
82 | + receivedFirstData = false | |
83 | + System.gc() | |
84 | + } | |
85 | + (objectId + 11) -> { | |
86 | + requestReducedObject() | |
87 | + } | |
88 | + (objectId + 12) -> { | |
89 | + receivedReducedObject(rx_body) | |
90 | + } | |
91 | + (objectId + 13) -> { | |
92 | + publisher.enqueueCommand(PtpIpCommandGeneric(this, objectId + 14, false, objectId, 0x911c)) // 0x911c : ResetUILock | |
93 | + } | |
94 | + (objectId + 14) -> { | |
95 | + Log.v(TAG, " ----- SMALL IMAGE RECEIVE SEQUENCE(0x911c) FINISHED : $objectId") | |
96 | + callback?.onCompleted() | |
72 | 97 | objectId = 0 |
73 | 98 | callback = null |
74 | 99 | receivedTotalBytes = 0 |
@@ -76,8 +101,8 @@ class CanonReducedImageReceiver(private val activity: Activity, private val publ | ||
76 | 101 | receivedFirstData = false |
77 | 102 | System.gc() |
78 | 103 | } |
79 | - (objectId + 5) -> { | |
80 | - requestGetPartialObject(rx_body) | |
104 | + (objectId + 6) -> { | |
105 | + Log.v(TAG, " RECEIVED 0x9141 reply.") | |
81 | 106 | } |
82 | 107 | else -> { |
83 | 108 | Log.v(TAG, " RECEIVED UNKNOWN ID : $id") |
@@ -187,11 +212,15 @@ class CanonReducedImageReceiver(private val activity: Activity, private val publ | ||
187 | 212 | |
188 | 213 | private fun requestGetPartialObject(rx_body: ByteArray?) { |
189 | 214 | Log.v(TAG, " requestGetPartialObject() : $objectId") |
215 | + if (rx_body != null) | |
216 | + { | |
217 | + SimpleLogDumper.dump_bytes(" requestGetPartialObject ", Arrays.copyOfRange(rx_body, 0, 64)) | |
218 | + } | |
190 | 219 | isReceiveMulti = true |
191 | 220 | receivedFirstData = false |
192 | 221 | |
193 | 222 | // 0x9107 : GetPartialObject (元は 0x00020000) |
194 | - val pictureLength: Int | |
223 | + var pictureLength: Int | |
195 | 224 | if (rx_body != null && rx_body.size > 52) { |
196 | 225 | val dataIndex = 48 |
197 | 226 | pictureLength = (rx_body[dataIndex].toUByte().toInt() and 0xff) + (rx_body[dataIndex + 1].toUByte().toInt() and 0xff shl 8) + (rx_body[dataIndex + 2].toUByte().toInt() and 0xff shl 16) + (rx_body[dataIndex + 3].toUByte().toInt() and 0xff shl 24) |
@@ -200,9 +229,33 @@ class CanonReducedImageReceiver(private val activity: Activity, private val publ | ||
200 | 229 | { |
201 | 230 | pictureLength = 0x020000 |
202 | 231 | } |
232 | + if ((pictureLength <= 0)&&(pictureLength > 0x020000)) | |
233 | + { | |
234 | + pictureLength = 0x020000 | |
235 | + } | |
236 | + Log.v(TAG, " requestGetPartialObject() size : $pictureLength ") | |
203 | 237 | publisher.enqueueCommand(PtpIpCommandCanonGetPartialObject(this, objectId + 1, false, objectId, 0x01, 0x00, pictureLength, pictureLength)) |
204 | 238 | } |
205 | 239 | |
240 | + private fun requestReducedObject() | |
241 | + { | |
242 | + Log.v(TAG, " requestReducedObject() : $objectId size : 0x00200000 ") | |
243 | + isReceiveMulti = true | |
244 | + receivedFirstData = false | |
245 | + publisher.enqueueCommand(PtpIpCommandGeneric(this, objectId + 12, true, objectId, 0x916f, 12, objectId, 0x00200000, 0x00)) // 0x916f : GetReducedObject | |
246 | + } | |
247 | + | |
248 | + private fun receivedReducedObject(rx_body: ByteArray?) | |
249 | + { | |
250 | + Log.v(TAG, " receivedReducedObject() : $objectId") | |
251 | + if (rx_body != null) | |
252 | + { | |
253 | + SimpleLogDumper.dump_bytes(" receivedReducedObject ", Arrays.copyOfRange(rx_body, 0, 64)) | |
254 | + } | |
255 | + isReceiveMulti = false | |
256 | + publisher.enqueueCommand(PtpIpCommandGeneric(this, objectId + 13, true, objectId, 0x9177, 8, objectId, 0x00)) // 0x9177 : NotifySaveComplete | |
257 | + } | |
258 | + | |
206 | 259 | private fun sendTransferComplete(rx_body: ByteArray?) |
207 | 260 | { |
208 | 261 | Log.v(TAG, " sendTransferComplete(), id : $objectId size: " + (rx_body?.size ?: 0)) |
@@ -0,0 +1,238 @@ | ||
1 | +package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.playback | |
2 | + | |
3 | +import android.app.Activity | |
4 | +import android.util.Log | |
5 | +import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadContentCallback | |
6 | +import net.osdn.gokigen.pkremote.camera.interfaces.playback.IProgressEvent | |
7 | +import net.osdn.gokigen.pkremote.camera.utils.SimpleLogDumper | |
8 | +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandCallback | |
9 | +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandPublisher | |
10 | +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandCanonGetPartialObject | |
11 | +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandGeneric | |
12 | +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific.CanonRequestInnerDevelopEnd | |
13 | +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.specific.CanonRequestInnerDevelopStart | |
14 | +import java.io.ByteArrayOutputStream | |
15 | +import java.util.* | |
16 | + | |
17 | +class CanonSmallImageReceiver(private val activity: Activity, private val publisher: IPtpIpCommandPublisher, private val sequenceType : Int) : IPtpIpCommandCallback, ICanonSmallImageReceiver | |
18 | +{ | |
19 | + private val mine = this | |
20 | + private val isDumpLog = false | |
21 | + | |
22 | + private var callback: IDownloadContentCallback? = null | |
23 | + private var objectId = 0 | |
24 | + private var isReceiveMulti = false | |
25 | + private var receivedFirstData = false | |
26 | + private var receivedTotalBytes = 0 | |
27 | + private var receivedRemainBytes = 0 | |
28 | + | |
29 | + override fun issueCommand(objectId: Int, callback: IDownloadContentCallback?) | |
30 | + { | |
31 | + Log.v(TAG, " issueCommand() : $objectId") | |
32 | + if (this.objectId != 0) | |
33 | + { | |
34 | + // already issued | |
35 | + Log.v(TAG, " COMMAND IS ALREADY ISSUED. : $objectId") | |
36 | + return | |
37 | + } | |
38 | + this.callback = callback | |
39 | + this.objectId = objectId | |
40 | + publisher.enqueueCommand(PtpIpCommandGeneric(this, objectId + 7, isDumpLog, objectId, 0x902f)) | |
41 | + } | |
42 | + | |
43 | + override fun receivedMessage(id: Int, rx_body: ByteArray?) | |
44 | + { | |
45 | + try | |
46 | + { | |
47 | + when (id) | |
48 | + { | |
49 | + (objectId + 7) -> { | |
50 | + if (sequenceType == 1) | |
51 | + { | |
52 | + publisher.enqueueCommand(CanonRequestInnerDevelopStart(this, objectId + 8, isDumpLog, objectId, objectId, 0x06, 0x02)) // 0x9141 : RequestInnerDevelopStart | |
53 | + } | |
54 | + else | |
55 | + { | |
56 | + publisher.enqueueCommand(CanonRequestInnerDevelopStart(this, objectId + 8, isDumpLog, objectId, objectId, 0x0f, 0x02)) // 0x9141 : RequestInnerDevelopStart | |
57 | + } | |
58 | + } | |
59 | + (objectId + 1) -> { | |
60 | + sendTransferComplete(rx_body) | |
61 | + } | |
62 | + (objectId + 2) -> { | |
63 | + Log.v(TAG, " requestInnerDevelopEnd() : $objectId") | |
64 | + publisher.enqueueCommand(CanonRequestInnerDevelopEnd(this, objectId + 3, isDumpLog, objectId)) // 0x9143 : RequestInnerDevelopEnd | |
65 | + } | |
66 | + (objectId + 3) -> { | |
67 | + // リセットコマンドを送ってみる | |
68 | + publisher.enqueueCommand(PtpIpCommandGeneric(this, objectId + 4, isDumpLog, objectId, 0x902f)) | |
69 | + } | |
70 | + (objectId + 4) -> { | |
71 | + // 画像取得終了 | |
72 | + Log.v(TAG, " ----- SMALL IMAGE RECEIVE SEQUENCE FINISHED : $objectId") | |
73 | + callback?.onCompleted() | |
74 | + objectId = 0 | |
75 | + callback = null | |
76 | + receivedTotalBytes = 0 | |
77 | + receivedRemainBytes = 0 | |
78 | + receivedFirstData = false | |
79 | + System.gc() | |
80 | + } | |
81 | + (objectId + 5) -> { | |
82 | + requestGetPartialObject(rx_body) | |
83 | + } | |
84 | + (objectId + 8) -> { | |
85 | + checkReplyInnerDevelopStart(rx_body) | |
86 | + } | |
87 | + else -> { | |
88 | + Log.v(TAG, " RECEIVED UNKNOWN ID : $id") | |
89 | + } | |
90 | + } | |
91 | + } | |
92 | + catch (e: Exception) | |
93 | + { | |
94 | + e.printStackTrace() | |
95 | + callback?.onErrorOccurred(e) | |
96 | + } | |
97 | + } | |
98 | + | |
99 | + override fun onReceiveProgress(currentBytes: Int, totalBytes: Int, rx_body: ByteArray?) | |
100 | + { | |
101 | + val body = cutHeader(rx_body) | |
102 | + val length = body?.size ?: 0 | |
103 | + Log.v(TAG, " onReceiveProgress() $currentBytes/$totalBytes ($length bytes.)") | |
104 | + callback?.onProgress(body, length, object : IProgressEvent | |
105 | + { | |
106 | + override fun getProgress(): Float { return (currentBytes.toFloat() / totalBytes.toFloat()) } | |
107 | + override fun isCancellable(): Boolean { return (false) } | |
108 | + override fun requestCancellation() { } | |
109 | + }) | |
110 | + } | |
111 | + | |
112 | + private fun cutHeader(rx_body: ByteArray?): ByteArray? | |
113 | + { | |
114 | + if (rx_body == null) | |
115 | + { | |
116 | + return (null) | |
117 | + } | |
118 | + val length = rx_body.size | |
119 | + var dataPosition = 0 | |
120 | + val byteStream = ByteArrayOutputStream() | |
121 | + if (!receivedFirstData) | |
122 | + { | |
123 | + // 初回データを読み込んだ | |
124 | + receivedFirstData = true | |
125 | + | |
126 | + // データを最初に読んだとき。ヘッダ部分を読み飛ばす | |
127 | + dataPosition = rx_body[0].toUByte().toInt() and 0xff | |
128 | + } | |
129 | + else if (receivedRemainBytes > 0) | |
130 | + { | |
131 | + //Log.v(TAG, " >>> [ remain_bytes : " + received_remain_bytes + "] ( length : " + length + ") " + data_position); | |
132 | + //SimpleLogDumper.dump_bytes("[zzz]", Arrays.copyOfRange(rx_body, data_position, (data_position + 160))); | |
133 | + | |
134 | + // データの読み込みが途中だった場合... | |
135 | + if (length < receivedRemainBytes) | |
136 | + { | |
137 | + // 全部コピーする、足りないバイト数は残す | |
138 | + receivedRemainBytes = receivedRemainBytes - length | |
139 | + receivedTotalBytes = receivedTotalBytes + rx_body.size | |
140 | + return rx_body | |
141 | + } | |
142 | + else | |
143 | + { | |
144 | + byteStream.write(rx_body, dataPosition, receivedRemainBytes) | |
145 | + dataPosition = receivedRemainBytes | |
146 | + receivedRemainBytes = 0 | |
147 | + } | |
148 | + } | |
149 | + while (dataPosition <= length - 12) | |
150 | + { | |
151 | + val bodySize: Int = (rx_body[dataPosition].toUByte().toInt() and 0xff) + (rx_body[dataPosition + 1].toUByte().toInt() and 0xff shl 8) + (rx_body[dataPosition + 2].toUByte().toInt() and 0xff shl 16) + (rx_body[dataPosition + 3].toUByte().toInt() and 0xff shl 24) | |
152 | + if (bodySize <= 12) | |
153 | + { | |
154 | + Log.v(TAG, " BODY SIZE IS SMALL : " + dataPosition + " (" + bodySize + ") [" + receivedRemainBytes + "] " + rx_body.size + " ") | |
155 | + //int startpos = (data_position > 48) ? (data_position - 48) : 0; | |
156 | + //SimpleLogDumper.dump_bytes("[xxx]", Arrays.copyOfRange(rx_body, startpos, (data_position + 48))); | |
157 | + break | |
158 | + } | |
159 | + | |
160 | + // Log.v(TAG, " RX DATA : " + data_position + " (" + body_size + ") [" + received_remain_bytes + "] (" + received_total_bytes + ")"); | |
161 | + //SimpleLogDumper.dump_bytes("[yyy] " + data_position + ": ", Arrays.copyOfRange(rx_body, data_position, (data_position + 64))); | |
162 | + if (dataPosition + bodySize > length) | |
163 | + { | |
164 | + // データがすべてバッファ内になかったときは、バッファすべてコピーして残ったサイズを記憶しておく。 | |
165 | + val copysize = length - (dataPosition + 12) | |
166 | + byteStream.write(rx_body, dataPosition + 12, copysize) | |
167 | + receivedRemainBytes = bodySize - copysize - 12 // マイナス12は、ヘッダ分 | |
168 | + receivedTotalBytes = receivedTotalBytes + copysize | |
169 | + // Log.v(TAG, " --- copy : " + (data_position + 12) + " " + copysize + " remain : " + received_remain_bytes + " body size : " + body_size); | |
170 | + break | |
171 | + } | |
172 | + try | |
173 | + { | |
174 | + byteStream.write(rx_body, dataPosition + 12, bodySize - 12) | |
175 | + dataPosition = dataPosition + bodySize | |
176 | + receivedTotalBytes = receivedTotalBytes + 12 | |
177 | + //Log.v(TAG, " --- COPY : " + (data_position + 12) + " " + (body_size - 12) + " remain : " + received_remain_bytes); | |
178 | + } | |
179 | + catch (e: Exception) | |
180 | + { | |
181 | + Log.v(TAG, " pos : $dataPosition size : $bodySize length : $length") | |
182 | + e.printStackTrace() | |
183 | + } | |
184 | + } | |
185 | + return byteStream.toByteArray() | |
186 | + } | |
187 | + | |
188 | + override fun isReceiveMulti(): Boolean | |
189 | + { | |
190 | + return (isReceiveMulti) | |
191 | + } | |
192 | + | |
193 | + private fun checkReplyInnerDevelopStart(rx_body: ByteArray?) | |
194 | + { | |
195 | + Log.v(TAG, " getRequestStatusEvent : $objectId (" + (rx_body?.size ?: 0) + ") ") | |
196 | + publisher.enqueueCommand(PtpIpCommandGeneric(mine, objectId + 5, isDumpLog, objectId, 0x9116)) // Event Receive | |
197 | + } | |
198 | + | |
199 | + private fun requestGetPartialObject(rx_body: ByteArray?) { | |
200 | + Log.v(TAG, " requestGetPartialObject() : $objectId") | |
201 | + if (rx_body != null) | |
202 | + { | |
203 | + SimpleLogDumper.dump_bytes(" requestGetPartialObject ", Arrays.copyOfRange(rx_body, 0, 64)) | |
204 | + } | |
205 | + isReceiveMulti = true | |
206 | + receivedFirstData = false | |
207 | + | |
208 | + // 0x9107 : GetPartialObject (元は 0x00020000) | |
209 | + var pictureLength: Int | |
210 | + if (rx_body != null && rx_body.size > 52) | |
211 | + { | |
212 | + val dataIndex = 48 | |
213 | + pictureLength = (rx_body[dataIndex].toUByte().toInt() and 0xff) + (rx_body[dataIndex + 1].toUByte().toInt() and 0xff shl 8) + (rx_body[dataIndex + 2].toUByte().toInt() and 0xff shl 16) + (rx_body[dataIndex + 3].toUByte().toInt() and 0xff shl 24) | |
214 | + } | |
215 | + else | |
216 | + { | |
217 | + pictureLength = 0x020000 | |
218 | + } | |
219 | + if ((pictureLength <= 0)&&(pictureLength > 0x020000)) | |
220 | + { | |
221 | + pictureLength = 0x020000 | |
222 | + } | |
223 | + Log.v(TAG, " requestGetPartialObject() size : $pictureLength ") | |
224 | + publisher.enqueueCommand(PtpIpCommandCanonGetPartialObject(this, objectId + 1, isDumpLog, objectId, 0x01, 0x00, pictureLength, pictureLength)) | |
225 | + } | |
226 | + | |
227 | + private fun sendTransferComplete(rx_body: ByteArray?) | |
228 | + { | |
229 | + Log.v(TAG, " sendTransferComplete(), id : $objectId size: " + (rx_body?.size ?: 0)) | |
230 | + publisher.enqueueCommand(PtpIpCommandGeneric(this, objectId + 2, isDumpLog, objectId, 0x9117, 4, 0x01)) // 0x9117 : TransferComplete | |
231 | + isReceiveMulti = false | |
232 | + } | |
233 | + | |
234 | + companion object | |
235 | + { | |
236 | + private val TAG = CanonSmallImageReceiver::class.java.simpleName | |
237 | + } | |
238 | +} |
@@ -18,7 +18,7 @@ import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.sp | ||
18 | 18 | import java.io.ByteArrayOutputStream; |
19 | 19 | |
20 | 20 | |
21 | -public class CanonSmallImageReceiver implements IPtpIpCommandCallback, ICanonSmallImageReceiver | |
21 | +public class CanonSmallImageReceiverPrev implements IPtpIpCommandCallback, ICanonSmallImageReceiver | |
22 | 22 | { |
23 | 23 | private static final String TAG = CanonSmallImageReceiver.class.getSimpleName(); |
24 | 24 |
@@ -33,7 +33,7 @@ public class CanonSmallImageReceiver implements IPtpIpCommandCallback, ICanonSma | ||
33 | 33 | private int received_total_bytes = 0; |
34 | 34 | private int received_remain_bytes = 0; |
35 | 35 | |
36 | - public CanonSmallImageReceiver(@NonNull Activity activity, @NonNull IPtpIpCommandPublisher publisher) | |
36 | + public CanonSmallImageReceiverPrev(@NonNull Activity activity, @NonNull IPtpIpCommandPublisher publisher) | |
37 | 37 | { |
38 | 38 | this.activity = activity; |
39 | 39 | this.publisher = publisher; |
@@ -66,7 +66,7 @@ public class CanonSmallImageReceiver implements IPtpIpCommandCallback, ICanonSma | ||
66 | 66 | public boolean isReceiveMulti() { |
67 | 67 | return (false); |
68 | 68 | } |
69 | - }, objectId, false, objectId, objectId)); // 0x9141 : RequestInnerDevelopStart | |
69 | + }, objectId, false, objectId, objectId, 0x0f, 0x02)); // 0x9141 : RequestInnerDevelopStart | |
70 | 70 | } |
71 | 71 | |
72 | 72 | @Override |
@@ -119,11 +119,13 @@ | ||
119 | 119 | <string-array name="canon_small_picture_type"> |
120 | 120 | <item>TYPE0</item> |
121 | 121 | <item>TYPE1</item> |
122 | + <item>TYPE2</item> | |
122 | 123 | </string-array> |
123 | 124 | |
124 | 125 | <string-array name="canon_small_picture_type_value"> |
125 | 126 | <item>0</item> |
126 | 127 | <item>1</item> |
128 | + <item>2</item> | |
127 | 129 | </string-array> |
128 | 130 | |
129 | 131 | </resources> |