hbk-world / ghs-gendaqapi-python

Setup, control and acquire data from the Genesis Highspeed systems via python.
Other
3 stars 0 forks source link

`ghs_set_current_settings()` fails with 'NOK' even when passing the direct return of `ghs_get_current_settings()` #18

Closed hnguyenHWI closed 2 years ago

hnguyenHWI commented 2 years ago

Hello,

I tried doing what the example code does for the getting/setting of the mainframe settings. However, I'm getting a return value of "NOK" from the call to ghs_set_current_settings().

Screenshot 2022-09-29 161427

I also noticed that the return type of the blob from ghs_get_current_settings() was str so I made a bytes object from the string and tried to send that to ghs_set_current_settings(), without success:

Screenshot 2022-09-29 161504

What I am actually attempting to do with all of this, is configure the mainframe via Python to enable the Real-Time Publishing over CAN of data. I'm attempting to save settings and restore them, so that my users do not have to open Perception and configure the Real-Time Publishing settings nor the CAN output settings every time they wish to use my Python program.

Is there possibly a way I can make use of the get/set_current_settings() functions or another way that I can accomplish this goal?

Thank you!

PTMargarido commented 2 years ago

Hello @hnguyenHWI,

The get_current_settings() and set_current_settings() APIs should do exactly what you want to achieve. In order to understand why it returns NOK, I need to ask you some questions:

Thanks!

hnguyenHWI commented 2 years ago

Hi @PTMargarido,

Thank you for your response!

I believe the Perception version is 8.30, and the mainframe is the GEN7tA. I know my customer is using various acquisition boards for voltage/current sensing, CAN input/output, and the eDrive but am not sure on all the specifics.

However, this seems to now be an intermittent error. I'm not sure what changed but both APIs seem to be working now. Occasionally I'll get the NOK return value but only rarely now. If you want to dive deeper into this I'm happy to provide any information about the issue, but I'm also happy to close this issue since it seems to be working.

PTMargarido commented 2 years ago

Hey @hnguyenHWI ,

Thanks for the feedback, NOK is returned on various cases (one of them is the settings not being deserialized correctly, which it might be the case, since it seems to be an intermittent error). However there is an occasion that we return NOK which can have multiple reasons (and thus at the client side not really knowing what was the cause). We will add some more error messages on that occasion, so that in the future there is a more specific error code.

For know, I think we can close this issue.

Thanks and have a nice week.