OPC(Olympus Air)用望遠鏡アプリ。
Revisão | 1e7bf12c8047ce51c3499c935a5cc1fb02b9fa7a (tree) |
---|---|
Hora | 2020-11-03 14:06:35 |
Autor | MRSa <mrsa@myad...> |
Commiter | MRSa |
このへんで...。
@@ -65,7 +65,7 @@ public class NikonInterfaceProvider implements IPtpIpInterfaceProvider, IDisplay | ||
65 | 65 | { |
66 | 66 | this.activity = context; |
67 | 67 | commandPublisher = new PtpIpCommandPublisher(CAMERA_IP, CONTROL_PORT, true, false); |
68 | - liveViewControl = new NikonLiveViewControl(context, this, 50, 1); | |
68 | + liveViewControl = new NikonLiveViewControl(context, this, 35, 1); | |
69 | 69 | asyncReceiver = new PtpIpAsyncResponseReceiver(CAMERA_IP, ASYNC_RESPONSE_PORT); |
70 | 70 | statusChecker = new NikonStatusChecker(activity, commandPublisher, CAMERA_IP, EVENT_PORT); |
71 | 71 | nikonConnection = new NikonConnection(context, provider, this, statusChecker); |
@@ -4,9 +4,11 @@ import android.util.Log | ||
4 | 4 | import androidx.appcompat.app.AppCompatActivity |
5 | 5 | import net.osdn.gokigen.a01d.camera.ILiveViewControl |
6 | 6 | import net.osdn.gokigen.a01d.camera.nikon.wrapper.command.messages.specific.NikonLiveViewRequestMessage |
7 | -import net.osdn.gokigen.a01d.camera.nikon.wrapper.command.messages.specific.NikonStatusRequestMessage | |
8 | 7 | import net.osdn.gokigen.a01d.camera.ptpip.IPtpIpInterfaceProvider |
9 | -import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.* | |
8 | +import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandCallback | |
9 | +import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommunication | |
10 | +import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages | |
11 | +import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.PtpIpResponseReceiver | |
10 | 12 | import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.messages.PtpIpCommandGeneric |
11 | 13 | import net.osdn.gokigen.a01d.camera.ptpip.wrapper.liveview.IPtpIpLiveViewImageCallback |
12 | 14 | import net.osdn.gokigen.a01d.liveview.liveviewlistener.IImageDataReceiver |
@@ -127,7 +129,10 @@ class NikonLiveViewControl(private val context: AppCompatActivity, interfaceProv | ||
127 | 129 | //Thread.sleep(delayMs.toLong()) |
128 | 130 | //commandIssuer.enqueueCommand(NikonStatusRequestMessage(statusReceiver, delayMs, isDumpLog)) |
129 | 131 | Thread.sleep(delayMs.toLong() * delayScale) |
130 | - commandIssuer.enqueueCommand(NikonLiveViewRequestMessage(imageReceiver, delayMs, isDumpLog)) | |
132 | + if (commandIssuer.isExistCommandMessageQueue(IPtpIpMessages.SEQ_GET_VIEWFRAME) < 2) | |
133 | + { | |
134 | + commandIssuer.enqueueCommand(NikonLiveViewRequestMessage(imageReceiver, delayMs, isDumpLog)) | |
135 | + } | |
131 | 136 | } |
132 | 137 | catch (e: Exception) |
133 | 138 | { |
@@ -198,7 +203,6 @@ class NikonLiveViewControl(private val context: AppCompatActivity, interfaceProv | ||
198 | 203 | |
199 | 204 | Log.v(TAG, String.format(" NikonLiveViewControl: ----- OK REPLY (ID : %d) ----- ", id)) |
200 | 205 | waitSleep() |
201 | - | |
202 | 206 | when (id) |
203 | 207 | { |
204 | 208 | IPtpIpMessages.SEQ_START_LIVEVIEW -> commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_DEVICE_READY, delayMs, isDumpLog, 0, 0x90c8, 0, 0x00, 0x00, 0x00, 0x00)) |
@@ -9,6 +9,10 @@ public interface IPtpIpCommandPublisher | ||
9 | 9 | |
10 | 10 | boolean flushHoldQueue(); |
11 | 11 | |
12 | + int isExistCommandMessageQueue(int id); | |
13 | + | |
14 | + int getCurrentQueueSize(); | |
15 | + | |
12 | 16 | void start(); |
13 | 17 | void stop(); |
14 | 18 | } |
@@ -208,6 +208,24 @@ class PtpIpCommandPublisher(private val ipAddress : String, private val portNumb | ||
208 | 208 | return (false) |
209 | 209 | } |
210 | 210 | |
211 | + override fun getCurrentQueueSize(): Int | |
212 | + { | |
213 | + return commandQueue.size | |
214 | + } | |
215 | + | |
216 | + override fun isExistCommandMessageQueue(id: Int): Int | |
217 | + { | |
218 | + var count = 0 | |
219 | + for (cmd in commandQueue) | |
220 | + { | |
221 | + if (cmd.id == id) | |
222 | + { | |
223 | + count++ | |
224 | + } | |
225 | + } | |
226 | + return count | |
227 | + } | |
228 | + | |
211 | 229 | override fun flushHoldQueue(): Boolean |
212 | 230 | { |
213 | 231 | Log.v(TAG, " flushHoldQueue()") |
@@ -249,6 +249,27 @@ public class PtpIpCommandPublisherLegacy implements IPtpIpCommandPublisher, IPtp | ||
249 | 249 | } |
250 | 250 | |
251 | 251 | @Override |
252 | + public int getCurrentQueueSize() | |
253 | + { | |
254 | + return (commandQueue.size()); | |
255 | + } | |
256 | + | |
257 | + | |
258 | + @Override | |
259 | + public int isExistCommandMessageQueue(int id) | |
260 | + { | |
261 | + int count = 0; | |
262 | + for (IPtpIpCommand cmd : commandQueue) | |
263 | + { | |
264 | + if (cmd.getId() == id) | |
265 | + { | |
266 | + count++; | |
267 | + } | |
268 | + } | |
269 | + return (count); | |
270 | + } | |
271 | + | |
272 | + @Override | |
252 | 273 | public boolean flushHoldQueue() |
253 | 274 | { |
254 | 275 | Log.v(TAG, " flushHoldQueue()"); |