j123b567 / scpi-parser

Open Source SCPI device library
BSD 2-Clause "Simplified" License
447 stars 191 forks source link

Termination for SCPI commands #138

Closed abhimanyukk-druck-utthunga closed 10 months ago

abhimanyukk-druck-utthunga commented 1 year ago

When I executed VXI11 example, and connected over some VXI11 client codes, we get to know that the commands only work with the termination \n\r. So, is there any simple way to avoid this, and work without this termination characters? Without termination, on the server code, it is showing the below error.

double free or corruption (out)
Aborted
dlock8 commented 1 year ago

I suggest to check the parameter: SCPI_LINE_ENDING and file scpi_user_config.h.

for compile the file scpi_user_config.h, you need to add:

add_definitions(-DSCPI_USER_CONFIG=1)

on CMakelists.txt

Warning: I'm just a user of the scpi parser software and not a devellopper

MisterHW commented 1 year ago

+1 for scpi_user_config.h, which is included in config.h to supersede:

https://github.com/j123b567/scpi-parser/blob/224f7cee7c2c5592081e1dec640862f029323782/libscpi/inc/scpi/config.h#L57

hattesen commented 10 months ago

You might consider using a flexible/dynamic definition of SCPI_LINE_ENDING similar to how Keysight is handling it in their Keysight B2980B Series Femto/Picoammeter Electrometer/High Resistance Meter:

When parsing commands:

Message Terminator A terminator informs SCPI that it has reached the end of a message. The following message terminators are permitted.

  • newline <NL>, expressed in ASCII as decimal 10 or hex 0A
  • end or identify <END> (EOI with ATN false)
  • both of the above <NL><END>
  • also <CR><NL>

... although I would recommend ignoring <END> entirely, leaving <NL> and <CR><NL> to be interpreted.

When returning results:

Data Output Format A terminator <newline> (0x0a, 1 byte) is attached to the end of each data.


I may get around to implementing it and providing a pull request within the next couple of months.