GithubHelp home page GithubHelp logo

Comments (7)

j123b567 avatar j123b567 commented on May 31, 2024

Hi Manuel,
partial fix for your problem is this commit f2dbd1c. Without this, you should define 9 patterns to realise your task as described in #13 (comment).

I have currently no time to write extracting numbers from command so it is up to you to do so.

You can read variable context->paramlist.cmd_raw.data and context->paramlist.cmd_raw.length. Data after length are not for you. You can use variable context->paramlist.cmd_raw.position to track your position while parsing cmd_raw. Example is in "examples" in function TEST_Numbers. Pattern actualy used is in variable context->paramlist.cmd->pattern so you can use it for extraction.

If you can write some functions to extract numbers from data I will be happy to merge it to main line.

Best regards,
Jan

from scpi-parser.

manuelk2007 avatar manuelk2007 commented on May 31, 2024

Hi Jan,
thank you very much. I will try it in the future.
At the moment, I have no time to try this.

But thank you for your effort and very fast response.

With kind regards

Manuel

from scpi-parser.

j123b567 avatar j123b567 commented on May 31, 2024

Now it is possible to have pattern OUT#:FREQuency
and commands OUT1:FREQ, OUT2:FREQ and OUT:FREQ

Unsupported range is up to user

In handler function, just call SCPI_CommandNumbers and it will fill
appropriate array

from scpi-parser.

qwe2tz avatar qwe2tz commented on May 31, 2024

Hello,

would it be possible to get a test example or some kind of documentation regarding this issue? I am trying to implement OUT#:FREQuency but I don't know how to parse out the numbers (e.g.: OUT1:FREQ and OUT2:FREQ).

Thanks in advance!

from scpi-parser.

j123b567 avatar j123b567 commented on May 31, 2024

There is an example in scpi-def.c

pattern:

{.pattern = "TEST#:NUMbers#", .callback = TEST_Numbers,},

callback

static scpi_result_t TEST_Numbers(scpi_t * context) {
    int32_t numbers[2];

    SCPI_CommandNumbers(context, numbers, 2);

    fprintf(stderr, "TEST numbers %d %d\r\n", numbers[0], numbers[1]);

    return SCPI_RES_OK;
}

Because there are two # in pattern, expected size of numbers array is 2 and third parameter is also 2.
If you call for example

TEST2:NUM3
> TEST numbers 2 3

TEST:NUM3
> TEST numbers 1 3

TEST:NUM
> TEST numbers 1 1

from scpi-parser.

j123b567 avatar j123b567 commented on May 31, 2024

I have also updated documentation accordingly. http://j123b567.github.io/scpi-parser/api/scpi_commandnumbers/

from scpi-parser.

qwe2tz avatar qwe2tz commented on May 31, 2024

Thank you very much for these clarifications :)

from scpi-parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.