private var isWatching = false
private var isWatchingEvent = false
private var statusReceived = false
- private var notifier: ICameraStatusUpdateNotify? = null
- private var focusingStatus = 0
private var omdsCommandList : String = ""
private var latestEventResponse : String = ""
private var currentRemainShots = ""
private var currentExposureWarning = ""
private var currentFocusType = ""
- // private var currentMeteringMode = "" // currentFocusType を代わりに使用
- // private var currentTorchMode = "" // currentExposureWarning を代わりに使用
private var opcTakeModeSelectionList = ""
private var opcWhiteBalanceSelectionList = ""
{
try
{
- startRtpStatusWatch(notifier)
+ startRtpStatusWatch()
startEventStatusWatch()
}
}
}
- private fun startRtpStatusWatch(notifier: ICameraStatusUpdateNotify?)
+ private fun startRtpStatusWatch()
{
try
{
Log.v(TAG, " startStatusWatch()")
- this.notifier = notifier
val thread = Thread {
isWatching = true
while (isWatching)
{
// OPC機のイベント受信
val opcEventUrl = "$executeUrl/get_camprop.cgi?com=getlist"
- val postData = "<?xml version=\"1.0\"?><get><prop name=\"AE\"/><prop name=\"APERTURE\"/><prop name=\"BATTERY_LEVEL\"/><prop name=\"COLORTONE\"/><prop name=\"EXPREV\"/><prop name=\"ISO\"/><prop name=\"RECENTLY_ART_FILTER\"/><prop name=\"SHUTTER\"/><prop name=\"TAKEMODE\"/><prop name=\"TAKE_DRIVE\"/><prop name=\"WB\"/><prop name=\"AE_LOCK_STATE\"/></get>"
+ val postData = "<?xml version=\"1.0\"?><get><prop name=\"AE\"/><prop name=\"APERTURE\"/><prop name=\"BATTERY_LEVEL\"/><prop name=\"COLORTONE\"/><prop name=\"EXPREV\"/><prop name=\"ISO\"/><prop name=\"RECENTLY_ART_FILTER\"/><prop name=\"SHUTTER\"/><prop name=\"TAKEMODE\"/><prop name=\"TAKE_DRIVE\"/><prop name=\"WB\"/><prop name=\"AE_LOCK_STATE\"/><prop name=\"AF_LOCK_STATE\"/></get>"
latestEventResponse = http.httpPostWithHeader(opcEventUrl, postData, headerMap, null, TIMEOUT_MS) ?: ""
dumpLog(opcEventUrl, latestEventResponse)
parseOpcProperties(latestEventResponse)
currentWhiteBalance = getPropertyValue(eventResponse, "<prop name=\"WB\">")
currentPictureEffect = getPropertyValue(eventResponse, "<prop name=\"COLORTONE\">")
currentCaptureMode = getPropertyValue(eventResponse, "<prop name=\"TAKE_DRIVE\">")
+
+/*
+ //val aeLockState = getPropertyValue(eventResponse, "<prop name=\"AE_LOCK_STATE\">")
+ //val afLockState = getPropertyValue(eventResponse, "<prop name=\"AF_LOCK_STATE\">")
+ if (afLockState != currentAfLockState)
+ {
+ // AFロック状態 or AEロック状態が変化したとき
+ currentAfLockState = afLockState
+ if (currentAfLockState == "LOCK")
+ {
+ notifier?.updateFocusedStatus(true, false)
+ }
+ else
+ {
+ notifier?.updateFocusedStatus(false, false)
+ }
+ //notifier?.updateFocusedStatus(focus, isError)
+ }
+*/
+
if (takeMode != currentTakeMode)
{
currentTakeMode = takeMode
val length: Int = ((buffer?.get(position + 2) ?: 0).toInt() and 0xff) * 256 + ((buffer?.get(position + 3) ?: 0).toInt() and 0xff)
when (commandId)
{
- ID_AF_FRAME_INFO -> { checkFocused(buffer, position, length) }
+ ID_AF_FRAME_INFO -> { } // { checkFocused(buffer, position, length) }
ID_FRAME_SIZE -> { }
ID_MEDIA_INFO -> { }
ID_ROTATION_INFO -> { }
}
}
+/*
private fun checkFocused(buffer: ByteArray?, position: Int, length: Int)
{
+ // 結局 OPC機でも動いていなさそうなので、このロジックはお蔵入りとする
if ((length != 5)||(buffer == null))
{
// データがそろっていないので何もしない
return
}
- //val status: Int = buffer[position + 7].toInt() and 0xff
val status: Int = (buffer[position + 11].toUInt()).toInt() and 0xff
if (status != focusingStatus)
{
// ドライブ停止時には、マーカの色は消さない
if (status > 0)
{
- val focus = status == 1
- val isError = status == 2
- notifier?.updateFocusedStatus(focus, isError)
+ val focus = status == 1 // 合焦成功
+ val isError = status == 2 // 合焦失敗
}
focusingStatus = status
}
}
+*/
private fun checkShutterSpeed(buffer: ByteArray?, position: Int, length: Int)
{
private const val isDumpLog = false
}
-
}