EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: RE: StreamDevice with a REST API
From: Freddie Akeroyd - STFC UKRI via Tech-talk <tech-talk at aps.anl.gov>
To: Chris Gregory - STFC UKRI <christopher.gregory at stfc.ac.uk>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Fri, 10 Jun 2022 13:30:57 +0000
Hi Chris,

I think I read somewhere that HTTP/1.1 defined CR LF as the end-of-line marker? So maybe

 	  outTerminator = CF LF;
 	  replyTimeout = 5000;
 	  out "GET
 http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State HTTP/1.1";
                 out "";
 	  in "%#s";

Regards,

Freddie

> -----Original Message-----
> From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Chris Gregory
> - STFC UKRI via Tech-talk
> Sent: 10 June 2022 14:10
> To: tech-talk at aps.anl.gov
> Subject: StreamDevice with a REST API
> 
> I'm writing an IOC for a device that has a REST API. Replies are simple and
> predictable so I'm hoping that I won't need anything more complex than
> StreamDevice.
> 
> At the moment I can't get a reply from the device. In my dev setup I'm
> running the IOC under WSL2, with the device software running on the
> Windows host on port 8001. The port is open in the firewall. Would anyone
> have any pointers please? (I've subbed my real Windows host ip address with
> <my_ip_address> in the below but in the application I've got the full address
> written out.)
> 
> 
> Protocol:
> 	read_variable{
> 	  outTerminator = LF LF;
> 	  replyTimeout = 5000;
> 	  out "GET
> http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State HTTP/1.1";
> 	  in "%#s";
> 	}
> 
> Record:
> 	record (stringin, "RDV_TEST") {
>  	  field(DTYP, "stream")
>   	  field(INP, "@eksplaAPL038.proto read_variable() $(PORT)")
>  	  field(SCAN, "5 second")
> 	}
> 
> 
> PORT configuration in st.cmd:
> 	drvAsynIPPortConfigure("$(PORT)", "<my_ip_address>:8001
> HTTP",0,0,0)
> 
> 
> When I run the IOC the asynTraceMask shows that I'm sending what I expect,
> but I don't get any reply. E.g.
> 	epics> 2022/06/10 13:40:59.703 <my_ip_address>:8001 HTTP write
> 67
> 	GET http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State
> HTTP/1.1\n\n
> 
> 
> Using telnet from WSL2 with the same ip:port the following both succeed and
> get the expected reply from the device:
> 	GET http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State
> HTTP/1.1
> 	or
> 	GET /REST/HTTP_CMD/?RDVAR/State HTTP/1.1
> 
> 
> I've tried the following "out" commands in the protocol file. No reply in any
> case:
> 	out "GET
> http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State HTTP/1.1";
> 	out "GET
> http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State";
> 	out "GET /REST/HTTP_CMD/?RDVAR/State HTTP/1.1";
> 	out "GET /REST/HTTP_CMD/?RDVAR/State";
> 
> I'd be grateful for any help,
> Chris
> 
> 
> This email and any attachments are intended solely for the use of the named
> recipients. If you are not the intended recipient you must not use, disclose,
> copy or distribute this email or any of its attachments and should notify the
> sender immediately and delete this email from your system. UK Research and
> Innovation (UKRI) has taken every reasonable precaution to minimise risk of
> this email or any attachments containing viruses or malware but the recipient
> should carry out its own virus and malware checks before opening the
> attachments. UKRI does not accept any liability for any losses or damages
> which the recipient may sustain due to presence of any viruses.


This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses.


Replies:
RE: StreamDevice with a REST API Freddie Akeroyd - STFC UKRI via Tech-talk
References:
StreamDevice with a REST API Chris Gregory - STFC UKRI via Tech-talk

Navigate by Date:
Prev: Re: StreamDevice with a REST API Zimoch Dirk (PSI) via Tech-talk
Next: RE: StreamDevice with a REST API Freddie Akeroyd - STFC UKRI via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: Re: StreamDevice with a REST API Zimoch Dirk (PSI) via Tech-talk
Next: RE: StreamDevice with a REST API Freddie Akeroyd - STFC UKRI via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·