UART expect v extract

Comments

3 comments

  • Jeremy Wood

    To clarify, was that a typo in your comment above, where you said "This is troubling in that the expected string ("RES 1") didn't come". Did you mean that "+RES 0" didn't come?

    I think this may be a limitation of the uart command. Generally the expect value is used before extraction. The idea being, watch the input coming in, go until an expected string is found, then extract a value out.

    Looking into it...

    0
    Comment actions Permalink
  • Nick Vandehey

    Yes. That was indeed a typo. Without "RES 0" in the response, I would think that a response with "RES 1" would fail this step. I think I can proceed with the understanding that 'expect' fields will go ignored if 'extract' is satisfied.

    0
    Comment actions Permalink
  • Jeremy Wood

    You shouldn't rely on this behavior, because I think this is a bug. We don't intend to have this command PASS when expect isn't satisfied.

    My advice with this command at the moment would be to write it something like:

    - ident: FW
      title: Firmware Revision 
      steps:   
      - uartcmd: uart UART0 
        send: 'info fwver\r\n' #needs parsing
      expect: 'VAL val'
        extract: 'VAL val\[(.*)]\r\n'
        extractKey: FWVER
        timeoutms: 20000
    0
    Comment actions Permalink

Please sign in to leave a comment.