Re: [fpc-pascal] Ethernet Relays
I got this working, thanks for the advice Ched, Here's my test program: uses fphttpclient; Begin TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/01'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/03'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/05'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/07'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/43'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/09'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/11'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/13'); TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/15'); End. I have to give it a command to go the next page for some reason or relays 5-8 won't work... so now I'm wondering if there is a way I can retrieve the data that is normally displayed in my browser to I can see what page number I'm on, I could also then check the status of the relays as well by analyzing what I read. James -Original Message- From: fpc-pascal On Behalf Of James Richters Sent: Sunday, May 24, 2020 3:41 PM To: 'FPC-Pascal users discussions' Cc: 'Ched' Subject: Re: [fpc-pascal] Ethernet Relays Thanks!! I'm happy with http, I should have mentioned I'm on Windows 10, any issues with that unit under windows? James -Original Message- From: fpc-pascal On Behalf Of Ched via fpc-pascal Sent: Sunday, May 24, 2020 3:02 PM To: fpc-pascal@lists.freepascal.org Cc: Ched Subject: Re: [fpc-pascal] Ethernet Relays Hello James, You'll find a source of happiness with unit fphttpclient . Particularily with the simplget function: TFPHTTPCLIENT.SIMPLEGET('http://192.168.1.4/3/00') It is said that it works with https also, but under the Mageia7 distro, you probably encounter problems I haven't yet solved. But for http, that should be right. Cheers, Ched Le 24.05.20 à 18:46, James Richters a écrit : > Does anyone have any advice on how to get started sending commands from FPC > to use these ethernet relays: > > https://www.amazon.com/gp/product/B076CNJNFH > > > Default IP :192.168.1.4 prot:3http://192.168.1.4/3 > > HTTP Comment: > http://192.168.1.4/3/00 : Relay-01 OFF > http://192.168.1.4/3/01 : Relay-01 ON > http://192.168.1.4/3/02 : Relay-02 OFF > http://192.168.1.4/3/03 : Relay-02 ON > http://192.168.1.4/3/04 : Relay-03 OFF > http://192.168.1.4/3/05 : Relay-03 ON ... > http://192.168.1.4/3/14 : Relay-8 OFF > http://192.168.1.4/3/15 : Relay-8 ON > http://192.168.1.4/3/41 : Enter > http://192.168.1.4/3/40 : Exit > http://192.168.1.4/3/42 : Next Page > http://192.168.1.4/3/43 : Next Page > > I don't really know what I even need to do to send commands like that over > the network. Of course I can get it to work just typing the commands from a > browser but that's not what I want, I want my FPC console program to send the > appropriate commands whenever I want one of the relays to come on or go off. > > Any suggestions on how this might be accomplished? > > James > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Ethernet Relays
Thanks!! I'm happy with http, I should have mentioned I'm on Windows 10, any issues with that unit under windows? James -Original Message- From: fpc-pascal On Behalf Of Ched via fpc-pascal Sent: Sunday, May 24, 2020 3:02 PM To: fpc-pascal@lists.freepascal.org Cc: Ched Subject: Re: [fpc-pascal] Ethernet Relays Hello James, You'll find a source of happiness with unit fphttpclient . Particularily with the simplget function: TFPHTTPCLIENT.SIMPLEGET('http://192.168.1.4/3/00') It is said that it works with https also, but under the Mageia7 distro, you probably encounter problems I haven't yet solved. But for http, that should be right. Cheers, Ched Le 24.05.20 à 18:46, James Richters a écrit : > Does anyone have any advice on how to get started sending commands from FPC > to use these ethernet relays: > > https://www.amazon.com/gp/product/B076CNJNFH > > > Default IP :192.168.1.4 prot:3http://192.168.1.4/3 > > HTTP Comment: > http://192.168.1.4/3/00 : Relay-01 OFF > http://192.168.1.4/3/01 : Relay-01 ON > http://192.168.1.4/3/02 : Relay-02 OFF > http://192.168.1.4/3/03 : Relay-02 ON > http://192.168.1.4/3/04 : Relay-03 OFF > http://192.168.1.4/3/05 : Relay-03 ON ... > http://192.168.1.4/3/14 : Relay-8 OFF > http://192.168.1.4/3/15 : Relay-8 ON > http://192.168.1.4/3/41 : Enter > http://192.168.1.4/3/40 : Exit > http://192.168.1.4/3/42 : Next Page > http://192.168.1.4/3/43 : Next Page > > I don't really know what I even need to do to send commands like that over > the network. Of course I can get it to work just typing the commands from a > browser but that's not what I want, I want my FPC console program to send the > appropriate commands whenever I want one of the relays to come on or go off. > > Any suggestions on how this might be accomplished? > > James > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Ethernet Relays
Hello James, You'll find a source of happiness with unit fphttpclient . Particularily with the simplget function: TFPHTTPCLIENT.SIMPLEGET('http://192.168.1.4/3/00') It is said that it works with https also, but under the Mageia7 distro, you probably encounter problems I haven't yet solved. But for http, that should be right. Cheers, Ched Le 24.05.20 à 18:46, James Richters a écrit : Does anyone have any advice on how to get started sending commands from FPC to use these ethernet relays: https://www.amazon.com/gp/product/B076CNJNFH Default IP :192.168.1.4 prot:3http://192.168.1.4/3 HTTP Comment: http://192.168.1.4/3/00 : Relay-01 OFF http://192.168.1.4/3/01 : Relay-01 ON http://192.168.1.4/3/02 : Relay-02 OFF http://192.168.1.4/3/03 : Relay-02 ON http://192.168.1.4/3/04 : Relay-03 OFF http://192.168.1.4/3/05 : Relay-03 ON ... http://192.168.1.4/3/14 : Relay-8 OFF http://192.168.1.4/3/15 : Relay-8 ON http://192.168.1.4/3/41 : Enter http://192.168.1.4/3/40 : Exit http://192.168.1.4/3/42 : Next Page http://192.168.1.4/3/43 : Next Page I don't really know what I even need to do to send commands like that over the network. Of course I can get it to work just typing the commands from a browser but that's not what I want, I want my FPC console program to send the appropriate commands whenever I want one of the relays to come on or go off. Any suggestions on how this might be accomplished? James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Ethernet Relays
Does anyone have any advice on how to get started sending commands from FPC to use these ethernet relays: https://www.amazon.com/gp/product/B076CNJNFH Default IP :192.168.1.4 prot:3http://192.168.1.4/3 HTTP Comment: http://192.168.1.4/3/00 : Relay-01 OFF http://192.168.1.4/3/01 : Relay-01 ON http://192.168.1.4/3/02 : Relay-02 OFF http://192.168.1.4/3/03 : Relay-02 ON http://192.168.1.4/3/04 : Relay-03 OFF http://192.168.1.4/3/05 : Relay-03 ON ... http://192.168.1.4/3/14 : Relay-8 OFF http://192.168.1.4/3/15 : Relay-8 ON http://192.168.1.4/3/41 : Enter http://192.168.1.4/3/40 : Exit http://192.168.1.4/3/42 : Next Page http://192.168.1.4/3/43 : Next Page I don't really know what I even need to do to send commands like that over the network. Of course I can get it to work just typing the commands from a browser but that's not what I want, I want my FPC console program to send the appropriate commands whenever I want one of the relays to come on or go off. Any suggestions on how this might be accomplished? James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Copying a Pchar to an array of bytes
On Tue, 19 May 2020 19:22:55 +0200, Luca Olivetti wrote: >Move(Hello^,buffer,len) or: Move(Hello[0],buffer,len); -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Delphi TService
On Wed, 20 May 2020 11:15:59 +0200 (CEST), Michael Van Canneyt wrote: > > >On Wed, 20 May 2020, Marco van de Voort wrote: > >> >> Does somebody have a compatible TService somewhere for dual compilation >> Delphi/Lazarus purposes? There is daemonapp, but that seems to be >> incompatible, but maybe it can be wrapped? > >It can be easily wrapped. >The only difference is that the registration is separate >from the actual service implementation. >The usual events are there just as in TService. > I think it woud be very useful if someone familiar with the inner workings of FPC/Lazarus could create the wrapper needed to port a Delphi service application using TService to fpc/lazarus, probably using TDaemon as parent or similar. I tried it last week but wound up with Lazarus unable to start since it tries to reload the faulty project including the half/baked attempt at defining TService as a child of TDaemon And it ends with Lazarus unloading from memory (aka crashing)... -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Zoned date/time conversions
On 24/05/2020 12:56 pm, Michael Van Canneyt wrote: > However, there is some third-party class which has complete date/time > handling: > https://wiki.freepascal.org/PascalTZ Thanks Michael, that looks like what I need. Good to see it has support for the time zone database too. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Zoned date/time conversions
On Sun, 24 May 2020, Graeme Geldenhuys wrote: Hi, I need to do timezone enabled date/time conversions... Use case 1) We want the application server to always use UCT and the application server might not be in the sime timezone as the client app. So we need to convert local time to UCT, do some time based processing on the server, then return data and convert all times back to the local time. Use case 2) Client's home address is in Spain. The application server is hosted in London. The client is on holiday in Australia. They book a grocery delivery while on holiday, and it must be delivered at 4pm the day they return from their holiday. So 4pm will be local Spainish time. Data will be transported to/from the application server using JSON and REST API. So date/time info needs to be converted to/from string format. What classes or methods are available in FPC to convert local date/time to UCT based time with offset and zone information? In the RTL, there is none. There are some methods to find out local time zone, but that's about it. However, there is some third-party class which has complete date/time handling: https://wiki.freepascal.org/PascalTZ sources on : https://github.com/dezlov/PascalTZ Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Zoned date/time conversions
Hi, I need to do timezone enabled date/time conversions... Use case 1) We want the application server to always use UCT and the application server might not be in the sime timezone as the client app. So we need to convert local time to UCT, do some time based processing on the server, then return data and convert all times back to the local time. Use case 2) Client's home address is in Spain. The application server is hosted in London. The client is on holiday in Australia. They book a grocery delivery while on holiday, and it must be delivered at 4pm the day they return from their holiday. So 4pm will be local Spainish time. Data will be transported to/from the application server using JSON and REST API. So date/time info needs to be converted to/from string format. What classes or methods are available in FPC to convert local date/time to UCT based time with offset and zone information? Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to implement a simple tcp/ip connection?
On Tue, 19 May 2020 18:25:54 +0200, Giuliano Colla wrote: >Now I'm planning to look in more detail the old Delphi implementation, >in order to see how they were tacking advantage of Libc. If you're >interested I'll let you know my results. > Yes, please! -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal