NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: KC Chin on November 14, 2018, 01:28:52 AM

Title: Webserver and WinEvent serial port
Post by: KC Chin on November 14, 2018, 01:28:52 AM
Hi,
I know how to read the serial port without problem.

Question is how to I post it the web from webserver? I just need to update a single field in real time (maybe a delay of 2 seconds or so) where the webserver is posting the value to client side.
Title: Re: Webserver and WinEvent serial port
Post by: DonRidley on November 14, 2018, 02:36:43 AM
Call a very simple window procedure from a NetTalk procedure.  Execute your WinEvent code in the window passing the value(s) as a parameter back to your NetTalk procedure.  Put value(s) in session value(s) or wahtever you need. 

I think that may work.
Title: Re: Webserver and WinEvent serial port
Post by: KC Chin on November 14, 2018, 04:32:53 PM
Hi Don,

Yes, call a proc from NT webserver.... How and Where to code it? :(

Anyway, I am checking out the example "Timers (46)" and "WebSockets (82)". Trying to understand and figuring out how it works.

The "WebSockets (82)", Net:h:UsersOnline, how this variable increment or decrement the value.  Also, cannot find this Global host variable "UsersOnline" data type.
Title: Re: Webserver and WinEvent serial port
Post by: KC Chin on November 14, 2018, 04:59:30 PM
http://www.nettalkcentral.com/forum/index.php?topic=7327.msg29753#msg29753

The example "Calculator (34)"
This is then one example "http://127.0.0.1:88/Performance" will help me to display Serial Port data.
Now this is getting interesting...
I don't think I may getting into trouble if I place a variable, Loc:ReceivedValue from serial port.

More likely it will work and stream the Serial Port data out in real time.
Title: Re: Webserver and WinEvent serial port
Post by: Bruce on November 14, 2018, 10:10:17 PM
Hi KC,

not 100% sure what you are wanting here, but

a) I think you want a NetWebForm with a Display field on it, set as "live via web socket" and pointing at a host variable (call it anything you like - say 'kelvin')

b) In the WebServer procedure, on the timer event, you can read the comms port and put the result into the host variable with the same name. like
s_web.SetHostValue('kelvin',whatever)

If this is all set up then the new value will appear in the browser window whenever it arrives at the server.

(hint: it will come in 1 char at a time, so you probably need to wait for a CR/LF or some other "end of packet" character before pushing it into the host value.)

cheers
Bruce
Title: Re: Webserver and WinEvent serial port
Post by: KC Chin on November 15, 2018, 12:52:03 AM
Bruce,

The example "Calculator (34)-Performance"  section already give me the head start using the websockets.
I don't think it will be difficult to do.