Comments (7)
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.
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.
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.
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.
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.
I have also updated documentation accordingly. http://j123b567.github.io/scpi-parser/api/scpi_commandnumbers/
from scpi-parser.
Thank you very much for these clarifications :)
from scpi-parser.
Related Issues (20)
- __STDC_VERSION__ macro not always defined HOT 4
- C++ compilation error due to NULL being a long int HOT 1
- ip set HOT 1
- check if osThreadCreate() successful HOT 8
- Possible to have multiple, independent scpi session? HOT 4
- Example of Optional keywords/Related API HOT 1
- introducing a help command HOT 5
- problem talking with sigrok HOT 5
- USE_FULL ERROR LIST report "Unknow Error" for all XE errors HOT 2
- Termination for SCPI commands HOT 3
- arm cross-compilation requires additional flags HOT 2
- Compile error when compiling with C++17 HOT 1
- vxi11.h missing ??
- Port to Arduino
- scpi-parser support on windows? HOT 1
- Documentation out of date?
- How the MAV bit is setting in Status register. HOT 1
- Handle errors from the read/write method HOT 11
- [Feature request] Add support to handle numerical values in choice list
- TEST_Chanlst upper limit fails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scpi-parser.