How To Receive very long and complex ACK?

Home Forums V-Control General How To Receive very long and complex ACK?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #13059
    Jens Plappert
    Participant

    Hey there,
    i’ve got a Video Switcher (Aten 0404ha), that behaves very sick. I can only send “read” as a command and get back Multiline answer:

    FW version:V1.1.105
    Out01: In01, Out ON , CEC OFF,
    Out02: In02, Out ON , CEC OFF,
    Out03: In03, Out ON, CEC OFF,
    Out04: In04, Out ON, CEC OFF
    EDID mode:default
    Echo OFF
    Pod OFF
    Button ON
    Command OK

    just creating an “on receive” event ad parsing That complete String doesn’t Work. Delimiter 0D0A doesn’t fire correctly or get every single line for processing.

    If i try getting the whole multiline String by taking 4F4B0D0A (OK&h0D&h0A) doesn’t work either. Or just “4F4B” (OK).
    May this return just be to long?

    I Say like delimiter is newline, but one time i get 5 lines, 1 time 1 line, 1 time the whole message and so on.
    What to do here?

    #13060
    Jens Plappert
    Participant

    Here are two versions i tried:

    VERSION 1, trying to be a general “onReceive”, works sometimes

    read&h0D&h0D&h0A&h0A&h0DFW version:V1.1.105&h0A&h0DOut01: In01, Out ON , CEC OFF, &h0A&h0DOut02: In03, Out ON , CEC OFF, &h0A&h0DOut03: In04, Out ON , CEC OFF, &h0A&h0DOut04: In02, Out ON , CEC OFF, &h0A&h0DEDID mode: default&h0A&h0DEcho OFF&h0D&h0AP
    // Nach senden von “read” kommt folgendes als Antwort:
    //
    //FW version:V1.1.105
    //Out01: In01, Out ON , CEC OFF,
    //Out02: In02, Out ON , CEC OFF,
    //Out03: In03, Out ON, CEC OFF,
    //Out04: In04, Out ON, CEC OFF
    //EDID mode:default
    //Echo OFF
    //Pod OFF
    //Button ON
    //Command OK

    Dim ReceiveStr as string
    Dim TestStr as String
    Dim LineArr() as string
    ReceiveStr = ioResult
    //die Antwort vom Switcher ist buggy, mal sendet er CR LF, mal LF CR (macht keinen Sinn)
    //daher checkt der Empfang nur auf OK als ACK (kommt ganz am Ende als Command OK vor) und hier werden die CR nochmal von Hand abgeschnitten
    //Parsen dann Anhand von nthfield, Trennzeichen “:”Empfang sehr unregelmaessig und lan, aber wenn der Hexwert fuer “Command OK” mal erkannt wird, funktioniert der Rest

    ReceiveStr = ReceiveStr.ReplaceAll(chr(13),””)
    ReceiveStr = ReceiveStr.ReplaceAll(chr(10),””)

    dim FW_Ver, ReadOut1, ReadOut2, ReadOut3, Readout4 as string
    FW_Ver = mid(ReceiveStr.nthfield(“:”,2), 0,9)
    ReadOut1 = mid(ReceiveStr.nthfield(“:”,3), 5,1)
    ReadOut2 = mid(ReceiveStr.nthfield(“:”,4), 5,1)
    ReadOut3 = mid(ReceiveStr.nthfield(“:”,5), 5,1)
    ReadOut4 = mid(ReceiveStr.nthfield(“:”,6), 5,1)

    setDeviceVar(“Out_1”, ReadOut1)
    setDeviceVar(“Out_2”, ReadOut2)
    setDeviceVar(“Out_3”, ReadOut3)
    setDeviceVar(“Out_4”, ReadOut4)
    setDeviceVar(“FW_ver”, FW_Ver)

    VERSION 2, Trying to be an ACK-Command parsing single lines (never works)

    // Nach senden von “read” kommt folgendes als Antwort:
    //
    //FW version:V1.1.105
    //Out01: In01, Out ON , CEC OFF,
    //Out02: In02, Out ON , CEC OFF,
    //Out03: In03, Out ON, CEC OFF,
    //Out04: In04, Out ON, CEC OFF
    //EDID mode:default
    //Echo OFF
    //Pod OFF
    //Button ON
    //Command OK

    Dim ReceiveStr as string
    Dim TestStr as String
    ReceiveStr = ioResult
    //die Antwort vom Switcher ist buggy, mal sendet er CR LF, mal LF CR (macht keinen Sinn)
    //daher checkt der Empfang nur auf OK als ACK (kommt ganz am Ende als Command OK vor) und hier werden die CR nochmal von Hand abgeschnitten
    //Parsen dann Anhand von nthfield, Trennzeichen “:”Empfang sehr unregelmaessig und lan, aber wenn der Hexwert fuer “Command OK” mal erkannt wird, funktioniert der Rest

    ReceiveStr = ReceiveStr.ReplaceAll(chr(13),””)
    ReceiveStr = ReceiveStr.ReplaceAll(chr(10),””)

    dim Parameter, Value as String
    Parameter = ReceiveStr.nthfield(“:”,1)
    Select Case Parameter
    case “FW version”
    Value = ReceiveStr.nthfield(“:”,2)
    Value = Value.mid(1,8)
    setDeviceVar(“FW_ver”,Value)
    case “Out01”
    Value = ReceiveStr.nthfield(“:”,2)
    Value = Value.mid(5,1)
    setDeviceVar(“Out_1”,Value)
    case “Out02”
    Value = ReceiveStr.nthfield(“:”,2)
    Value = Value.mid(5,1)
    setDeviceVar(“Out_2”,Value)
    case “Out03”
    Value = ReceiveStr.nthfield(“:”,2)
    Value = Value.mid(5,1)
    setDeviceVar(“Out_3”,Value)
    case “Out04”
    Value = ReceiveStr.nthfield(“:”,2)
    Value = Value.mid(5,1)
    setDeviceVar(“Out_4”,Value)
    end select

    #13061
    Jens Plappert
    Participant

    May the Delimiter-Parsing be to slow or the Receivebuffer overrun here?

    #13062
    Jens Plappert
    Participant

    Ah, forgot to mention: buffer size global is set to 2000

    #13063
    Jens Plappert
    Participant

    Also can’t use Ack Length as it is not available on 4.1.6 raspi. The Field ain’t greyed out, but i cant type anything in it. it’s constant “0”

    #13064
    Jens Plappert
    Participant

    Solved it now this way (ACK at 0A. It steel seems not to be fired everytime the ACK appears, but as i now parse for specific pairs and not for offset-indices it works. Feels a bit like an workaround anyway):

    // Nach senden von “read” kommt folgendes als Antwort:
    //
    //FW version:V1.1.105
    //Out01: In01, Out ON , CEC OFF,
    //Out02: In02, Out ON , CEC OFF,
    //Out03: In03, Out ON, CEC OFF,
    //Out04: In04, Out ON, CEC OFF
    //EDID mode:default
    //Echo OFF
    //Pod OFF
    //Button ON
    //Command OK
    Dim TempArr() as string
    Dim ReceiveStr as string
    Dim TestStr as String

    ReceiveStr = ioResult

    TempArr = ReceiveStr.Split(“:”)

    For Each Ding as String in TempArr
    dim ValIndex as integer
    ValIndex = TempArr.IndexOf(Ding)+1

    Dim TempVal as string

    if Ding.Right(10) = “FW version” then
    Tempval = TempArr(ValIndex)
    Tempval = Tempval.left(8)
    SetDeviceVar(“FW_ver”, Tempval)
    end if

    if Ding.Right(5) = “Out01” then
    Tempval = TempArr(ValIndex)
    Tempval = Tempval.mid(5,1)
    SetDeviceVar(“Out_1”, Tempval)
    end if

    if Ding.Right(5) = “Out02” then
    Tempval = TempArr(ValIndex)
    Tempval = Tempval.mid(5,1)
    SetDeviceVar(“Out_2”, Tempval)
    end if

    if Ding.Right(5) = “Out03” then
    Tempval = TempArr(ValIndex)
    Tempval = Tempval.mid(5,1)
    SetDeviceVar(“Out_3”, Tempval)
    end if

    if Ding.Right(5) = “Out04” then
    Tempval = TempArr(ValIndex)
    Tempval = Tempval.mid(5,1)
    SetDeviceVar(“Out_4”, Tempval)
    end if
    showmessage(Ding.Right(5))
    next

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Scroll to top