Jump to content

Trouble getting a response from Digilent Agent via http post commands


Recommended Posts

Hi, 

I am trying to replicate the actions performed  by clicking  device bar(COM4/3) from Waveforms live via  a script, i.e connect the device to digilent agent. I use, python to post the json objects from the Digilent instrument protocol and Digilent agent protocol. Though I have no issues getting normal responses (error code: 0) while using Digilent Instrument protocols but I do face error while using Digilent Agent protocols. Example, while trying to 'setActiveDevice'  using Digilent Agent protocols I get the response: {'agent': [{'statusCode': 2147485286, 'statusText': 'No active device'}]} from the url: 'http://localhost:42135' 

Let me know if I made a mistake in URL or the command.

 

Regards

Adithya

Link to comment
Share on other sites

Hey Adithya,

Any commands sent to the agent's root endpoint http://localhost:42135 will be passed through to the active device (if there is an active device).  Since there is no active device in your case you get the error you noted.

You can send commands to configure the agent to the 'config' endpoint http://localhost:42135/config  The Agent code that handles these commands is here for your reference.

Let us know if that works for you or if you have any more questions.

Thanks!

-Kristoff

Link to comment
Share on other sites

Hi Kristoff,

Thanks for the response, the change in URL to http://localhost:42135/config works like a charm. I have two queries.

Query 1: I did notice that when I post a json object for "Get Active Device " (from Digilent Agent Protocol ) I get this response {'agent': [{'command': 'getActiveDevice', 'status': 'Unknown Command', 'statusCode': 0}]}.  Upon further inspection of the commands link you shared, I found no function defined under the name "getActiveDevice". I am assuming that we have to use the device protocols instead of agent protocols to get the active device info. Can you confirm the same.

Query 2: I am logging my data on the ram instead of SD. I want to delete the dlog file after reading the data. The response for delete command is 

{'file': [{'command': 'delete', 'statusCode': 2415919107, 'wait': 0}]} 

I dont think the file is deleted and the error code reinforces my hypothesis. 

Regards,

Adithya

Link to comment
Share on other sites

Hey,

The getActiveDevice has not been implemented.  I added a note to the documentation to call that out.  During initial development we started by defining the specification and then found some commands were not required for OpenScope/OpenLogger to function with WaveForms Live.

Logging to RAM is a bit different than logging to a file on a non-volatile storage device (SD in the case of OpenScope / OpenLogger).  When logging to RAM it doesn't actually create 'files' in RAM, it just logs to a buffer and the buffer will be overwritten when you stop logging and start a new log.

Let us know if you have any more questions about any of this.

Tha

-Kristoff

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...