Page 1 of 2

Communication via http

Posted: Thu Jan 04, 2018 1:09 pm
by mol
Hi guys!
I've realised my first Arduino project. It will switch on/off lamp indicators depend on barcode scanner read in the warehouse.
Barcode scanner sends barcode to computer, computer sends info to my arduino which lamp should be switched on.

I've created http server which wait for info from computer via http.
I can control lamps via internet browser, calling arduino server: http://192.168.20.190/BRAMKA=3
I want to create simple application, which can call such a page.
Second problem is to act as http server to read info from wifi barcode reader.
Can anybody provide simplest http server application?

regards, Marek

Re: Communication via http

Posted: Fri Jan 05, 2018 12:48 pm
by serge_girard
Marek,

Can you please explain more about what you want?
I have a NETIO server but I don't think you mean that.
Serge

Re: Communication via http

Posted: Fri Jan 05, 2018 4:23 pm
by mol
I need to build app, which will wait for transmision at eg. 80 port.

Re: Communication via http

Posted: Fri Jan 05, 2018 5:28 pm
by srvet_claudio

Re: Communication via http

Posted: Fri Jan 05, 2018 7:51 pm
by mol
I remember your work. But, I need minimum solution

Re: Communication via http

Posted: Sat Jan 06, 2018 8:52 am
by mol
I've simplified my procedure to control lamps:

Code: Select all


PROCEDURE SendRequestViaWWW
	param cURL
	
	local lSilent := .f.
	LOCAL oCon, i
	local ret := .f.
	local cOdp:=""
	
	for i:=1 to 3
		// number of tries
		oCon := TipClientHttp():New( cUrl )
		IF oCon:Open()
			cOdp := oCon:ReadAll()
			msgdebug("Connected?", cOdp)
			oCon:close()
			ret := .t.
			exit
		endif
	next i
	
	if !ret
		MsgBox("Error in connection " + oCon:lastErrorMessage())
	endif
RETURN ret
I can switch on/off 32 sending www request:

Code: Select all

SendRequestViaWWW("http://192.168.20.190/BRAMKA=16")

Now, I need to create server, which will wait for request from codebar scanner

Re: Communication via http

Posted: Sat Jan 06, 2018 10:17 am
by edk
Marek, maybe this will be helpful: micro web server on hb (uhttpd)
https://github.com/harbour/core/tree/ma ... as/httpsrv
and
https://github.com/vszakats/harbour-cor ... ib/hbhttpd

Re: Communication via http

Posted: Sat Jan 06, 2018 11:35 am
by mol
Thank you!

Re: Communication via http

Posted: Sat Jan 06, 2018 2:42 pm
by mol
I've created my solution. It's very small and it's doing what I want.
A month ago, I even didnt dream I'll be able to control some devices from harbour app via wifi.
I'll present my app later.

Re: Communication via http

Posted: Sat Jan 06, 2018 3:21 pm
by edk
So I'm waiting impatiently 8-)