Re: [fpc-pascal] Running Freepascal programs on other computers

2017-06-29 Thread Sven Barth via fpc-pascal
Am 29.06.2017 23:27 schrieb "Bo Berglund" :
>
> On Thu, 29 Jun 2017 11:08:40 +0200, Sven Barth via fpc-pascal
>  wrote:
>
> >- open "Internet Options"
>
> The wording on these option pages seem to indicate that they are for
> websites. That is all they talk about.

They are not only about websites, but also files in the local intranet
(e.g. network shares in your network or even local network shares)

> What about local files on the computer which are not part of any
> website?

*shrugs* Those settings are somewhere else. Most likely local security
policy...

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Serial to TCP gateway in FPC?

2017-06-29 Thread Paulo Costa

On 29-Jun-17 15:43, Koenraad Lelong wrote:

Op 29-06-17 om 10:25 schreef Bo Berglund:

On Sun, 18 Jun 2017 20:36:11 +0200, Koenraad Lelong
 wrote:


Do you know the SDPO-package ? That has a serial component (SDPOSerial).
This has a OnRxData event.


Do you mean SDPO or 5DPO (letter S or number 5 at the start)?
I googled for SDPO but the hits were for 5DPO...



It's the same project. Sometimes it's called 5dpo sometimes sdpo.
In the component-list there is a tab 5dpo, but the component itself is 
called TSdpoSerial. If you want to install it, you have to install 
SdpoSerialLaz.


That is correct.

The longer story is that most of those components came from our work on 
a team called 5dpo. Our team was active from 1998 to 2007 in the Robocup 
competitions (Small Size League ans Middle Size League)
The trouble is that you can not have an identifier starting with a 
number, so for component names we replaced the 5 with a S.


Paulo Costa
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Running Freepascal programs on other computers

2017-06-29 Thread Bo Berglund
On Thu, 29 Jun 2017 11:08:40 +0200, Sven Barth via fpc-pascal
 wrote:

>- open "Internet Options"

The wording on these option pages seem to indicate that they are for
websites. That is all they talk about.

What about local files on the computer which are not part of any
website?


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-29 Thread James Richters
I defined a static array to convert the mode 13h VGA palette to separate red, 
green and blue to send to aggpas as well as the packed RGB565 format needed to 
send to ptcgraph 16bit colors.

James


Type 
   VGARGBRec= Record
  R,G,B:Byte;
  RGB:Word;
   end;

Const
   VGA256: Array[0..255] of VGARGBRec = (
  (R:$00; G:$00; B:$00; RGB:$),
  (R:$00; G:$00; B:$AA; RGB:$0015),
  (R:$00; G:$AA; B:$00; RGB:$0540),
  (R:$00; G:$AA; B:$AA; RGB:$0555),
  (R:$AA; G:$00; B:$00; RGB:$A800),
  (R:$AA; G:$00; B:$AA; RGB:$A815),
  (R:$AA; G:$55; B:$00; RGB:$AAA0),
  (R:$AA; G:$AA; B:$AA; RGB:$AD55),
  (R:$55; G:$55; B:$55; RGB:$52AA),
  (R:$55; G:$55; B:$FF; RGB:$52BF),
  (R:$55; G:$FF; B:$55; RGB:$57EA),
  (R:$55; G:$FF; B:$FF; RGB:$57FF),
  (R:$FF; G:$55; B:$55; RGB:$FAAA),
  (R:$FF; G:$55; B:$FF; RGB:$FABF),
  (R:$FF; G:$FF; B:$55; RGB:$FFEA),
  (R:$FF; G:$FF; B:$FF; RGB:$),
  (R:$00; G:$00; B:$00; RGB:$),
  (R:$14; G:$14; B:$14; RGB:$10A2),
  (R:$20; G:$20; B:$20; RGB:$2104),
  (R:$2C; G:$2C; B:$2C; RGB:$2965),
  (R:$38; G:$38; B:$38; RGB:$39C7),
  (R:$44; G:$44; B:$44; RGB:$4228),
  (R:$50; G:$50; B:$50; RGB:$528A),
  (R:$61; G:$61; B:$61; RGB:$630C),
  (R:$71; G:$71; B:$71; RGB:$738E),
  (R:$81; G:$81; B:$81; RGB:$8410),
  (R:$91; G:$91; B:$91; RGB:$9492),
  (R:$A1; G:$A1; B:$A1; RGB:$A514),
  (R:$B6; G:$B6; B:$B6; RGB:$B5B6),
  (R:$CA; G:$CA; B:$CA; RGB:$CE59),
  (R:$E2; G:$E2; B:$E2; RGB:$E71C),
  (R:$FF; G:$FF; B:$FF; RGB:$),
  (R:$00; G:$00; B:$FF; RGB:$001F),
  (R:$40; G:$00; B:$FF; RGB:$401F),
  (R:$7D; G:$00; B:$FF; RGB:$781F),
  (R:$BE; G:$00; B:$FF; RGB:$B81F),
  (R:$FF; G:$00; B:$FF; RGB:$F81F),
  (R:$FF; G:$00; B:$BE; RGB:$F817),
  (R:$FF; G:$00; B:$7D; RGB:$F80F),
  (R:$FF; G:$00; B:$40; RGB:$F808),
  (R:$FF; G:$00; B:$00; RGB:$F800),
  (R:$FF; G:$40; B:$00; RGB:$FA00),
  (R:$FF; G:$7D; B:$00; RGB:$FBE0),
  (R:$FF; G:$BE; B:$00; RGB:$FDE0),
  (R:$FF; G:$FF; B:$00; RGB:$FFE0),
  (R:$BE; G:$FF; B:$00; RGB:$BFE0),
  (R:$7D; G:$FF; B:$00; RGB:$7FE0),
  (R:$40; G:$FF; B:$00; RGB:$47E0),
  (R:$00; G:$FF; B:$00; RGB:$07E0),
  (R:$00; G:$FF; B:$40; RGB:$07E8),
  (R:$00; G:$FF; B:$7D; RGB:$07EF),
  (R:$00; G:$FF; B:$BE; RGB:$07F7),
  (R:$00; G:$FF; B:$FF; RGB:$07FF),
  (R:$00; G:$BE; B:$FF; RGB:$05FF),
  (R:$00; G:$7D; B:$FF; RGB:$03FF),
  (R:$00; G:$40; B:$FF; RGB:$021F),
  (R:$7D; G:$7D; B:$FF; RGB:$7BFF),
  (R:$9D; G:$7D; B:$FF; RGB:$9BFF),
  (R:$BE; G:$7D; B:$FF; RGB:$BBFF),
  (R:$DE; G:$7D; B:$FF; RGB:$DBFF),
  (R:$FF; G:$7D; B:$FF; RGB:$FBFF),
  (R:$FF; G:$7D; B:$DE; RGB:$FBFB),
  (R:$FF; G:$7D; B:$BE; RGB:$FBF7),
  (R:$FF; G:$7D; B:$9D; RGB:$FBF3),
  (R:$FF; G:$7D; B:$7D; RGB:$FBEF),
  (R:$FF; G:$9D; B:$7D; RGB:$FCEF),
  (R:$FF; G:$BE; B:$7D; RGB:$FDEF),
  (R:$FF; G:$DE; B:$7D; RGB:$FEEF),
  (R:$FF; G:$FF; B:$7D; RGB:$FFEF),
  (R:$DE; G:$FF; B:$7D; RGB:$DFEF),
  (R:$BE; G:$FF; B:$7D; RGB:$BFEF),
  (R:$9D; G:$FF; B:$7D; RGB:$9FEF),
  (R:$7D; G:$FF; B:$7D; RGB:$7FEF),
  (R:$7D; G:$FF; B:$9D; RGB:$7FF3),
  (R:$7D; G:$FF; B:$BE; RGB:$7FF7),
  (R:$7D; G:$FF; B:$DE; RGB:$7FFB),
  (R:$7D; G:$FF; B:$FF; RGB:$7FFF),
  (R:$7D; G:$DE; B:$FF; RGB:$7EFF),
  (R:$7D; G:$BE; B:$FF; RGB:$7DFF),
  (R:$7D; G:$9D; B:$FF; RGB:$7CFF),
  (R:$B6; G:$B6; B:$FF; RGB:$B5BF),
  (R:$C6; G:$B6; B:$FF; RGB:$C5BF),
  (R:$DA; G:$B6; B:$FF; RGB:$DDBF),
  (R:$EA; G:$B6; B:$FF; RGB:$EDBF),
  (R:$FF; G:$B6; B:$FF; RGB:$FDBF),
  (R:$FF; G:$B6; B:$EA; RGB:$FDBD),
  (R:$FF; G:$B6; B:$DA; RGB:$FDBB),
  (R:$FF; G:$B6; B:$C6; RGB:$FDB8),
  (R:$FF; G:$B6; B:$B6; RGB:$FDB6),
  (R:$FF; G:$C6; B:$B6; RGB:$FE36),
  (R:$FF; G:$DA; B:$B6; RGB:$FED6),
  (R:$FF; G:$EA; B:$B6; RGB:$FF56),
  (R:$FF; G:$FF; B:$B6; RGB:$FFF6),
  (R:$EA; G:$FF; B:$B6; RGB:$EFF6),
  (R:$DA; G:$FF; B:$B6; RGB:$DFF6),
  (R:$C6; G:$FF; B:$B6; RGB:$C7F6),
  (R:$B6; G:$FF; B:$B6; RGB:$B7F6),
  (R:$B6; G:$FF; B:$C6; RGB:$B7F8),
  (R:$B6; G:$FF; B:$DA; RGB:$B7FB),
  (R:$B6; G:$FF; B:$EA; RGB:$B7FD),
  (R:$B6; G:$FF; B:$FF; RGB:$B7FF),
  (R:$B6; G:$EA; B:$FF; RGB:$B75F),
  (R:$B6; G:$DA; B:$FF; RGB:$B6DF),
  (R:$B6; G:$C6; B:$FF; RGB:$B63F),
  (R:$00; G:$00; B:$71; RGB:$000E),
  (R:$1C; G:$00; B:$71; RGB:$180E),
  (R:$38; G:$00; B:$71; RGB:$380E),
  (R:$55; G:$00; B:$71; RGB:$500E),
  (R:$71; G:$00; B:$71; RGB:$700E),
  (R:$71; G:$00; B:$55; RGB:$700A),
  (R:$71; G:$00; B:$38; RGB:$7007),
  (R:$71; G:$00; B:$1C; RGB:$7003),
  (R:$71; G:$00; B:$00; RGB:$7000),
  (R:$71; G:$1C; B:$00; RGB:$70E0),
  (R:$71; G:$38; B:$00; RGB:$71C0),
  (R:$71; G:$55; B:$00; RGB:$72A0),
  (R:$71; G:$71; B:$00; RGB:$7380),
  

Re: [fpc-pascal] Serial to TCP gateway in FPC?

2017-06-29 Thread Koenraad Lelong

Op 29-06-17 om 10:25 schreef Bo Berglund:

On Sun, 18 Jun 2017 20:36:11 +0200, Koenraad Lelong
 wrote:


Do you know the SDPO-package ? That has a serial component (SDPOSerial).
This has a OnRxData event.


Do you mean SDPO or 5DPO (letter S or number 5 at the start)?
I googled for SDPO but the hits were for 5DPO...



It's the same project. Sometimes it's called 5dpo sometimes sdpo.
In the component-list there is a tab 5dpo, but the component itself is 
called TSdpoSerial. If you want to install it, you have to install 
SdpoSerialLaz.


HTH,
Koenraad

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Serial to TCP gateway in FPC?

2017-06-29 Thread José Mejuto

El 29/06/2017 a las 10:39, Bo Berglund escribió:


3) I also noted in the comments in TurSeriale.pas:
   "The Windows port driver does receive callbacks in chunks that
are typically 8 bytes long.
With ReceiveMode = rmRAW, TSeriale will simply pass this chunks
on to the application without any processing."
Does this mean that if a single character is received it is not passed
along? My protocol is exchanging single bytes for state changes and


Hello,

I'm quite sure no, it means that the driver will try to queue 8 bytes 
before sending back data, but the tricky word is "try", probably after a 
context switch or similar the available data will be reported by the 
driver whichever the amount of bytes are.


Kernel to userland data pass is very expensive so drivers usually try to 
queue a data amount limit or a data time limit whichever it happens first.


Also forget the usual 15 bytes buffering in serial comms, it is expected 
that the kernel driver can buffer much more data before overflow, 
probably around 8 Kbs.


--

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-29 Thread James Richters
>Your palette looks like standard Int Mode 13h VGA palette (yes, I'm older). 
>This are the RGB values (I'm quite sure):

Thank you, I appreciate the help identifying the format I have and the 
conversion to RGB.  I was able to also find methods to convert RGB to RGB565 
and back by looking in  the aggpas pf_rgb565.inc file.

{ make_pix_565 }
function make_pix_565(r ,g ,b : unsigned ) : int16u;
begin
 result:=
  ((r and $F8 ) shl 8 ) or
  ((g and $FC ) shl 3 ) or
   (b shr 3 );

end;

{ make_color_565 }
procedure make_color_565(var color : aggclr; p : int16u_ptr );
begin
 color.ConstrInt(
  (p^ shr 8 ) and $F8 ,
  (p^ shr 3 ) and $FC ,
  (p^ shl 3 ) and $F8 );

end;   

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Running Freepascal programs on other computers

2017-06-29 Thread Sven Barth via fpc-pascal
Am 28.06.2017 20:32 schrieb "James Richters" :
>
> >Are you by chance running it from a shared smb folder or something like
that?
>
> Yes I am running them on a network share… If I copy the file to my laptop
hard drive then I don’t get the warning anymore.  However I still get the
secutiy warning if the program is downloaded, even if I download it to the
original development pc.

To run programs without annoying prompt from a network share you need to
change the security settings on the computer you want to run the
application on (it's the same in Windows 7 by the way):
- open "Internet Options"
- go to tab "Security"
- select category "Local Intranet"
- click button "Sites"
- uncheck "automatically determine Intranet"
- check the other three checkboxes (or at least the one about network paths)
- confirm all dialogs

The dialog that occurs when you download a program is also controlled
somewhere, but it's cause is an alternate datastream that gets attached to
the downloaded file. I don't know right now whether signing the execuable
makes a difference here aside from the dialog looking less warning like...

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Serial to TCP gateway in FPC?

2017-06-29 Thread Bo Berglund
On Wed, 28 Jun 2017 10:55:47 -0700 (MST), turro75
 wrote:

>I don't know if useful, here You can find a terminal + serial to eth or
>reversed based on lnet, custom serial component and richmemo
>
>https://github.com/Turro75/TCPLogger_V2.git
>  
>

Thanks,
but I have two problems:
1) I have failed to install LNet into my Lazarus 1.6 on Windows.
See thread titled "Installing LNet in Lazarus 1.6 fails" in the
Lazarus list.
So I turned to Indy instead, but I think LNet would serve me better.

2) I need the relay gateway to be running also on Raspberry Pi3, i.e.
the system must be cross-platform and it seems like the example is for
Windows (COM ports with strange syntax etc).

3) I also noted in the comments in TurSeriale.pas:
  "The Windows port driver does receive callbacks in chunks that
   are typically 8 bytes long.
   With ReceiveMode = rmRAW, TSeriale will simply pass this chunks
   on to the application without any processing."
Does this mean that if a single character is received it is not passed
along? My protocol is exchanging single bytes for state changes and
these have rather tight timeouts as well, so a long delay in
forwarding the bytes will break the protocol.

State of my effort as of now:
=
Server side:
I am using ser2net on a RPi3 on the remote location to translate the
serial port connection into a socket connection. This seems to work
but there are issues.

Client side:
Here I have written a relaying application myself with Lazarus 1.6 and
FPC 3.0.0. I used the FPC built-in serial unit as adviced in the
hardware wiki for the serial port. For the TCP client I finally went
with Indy's TIdTcpClient and it seemed to work a bit.

Issues:
For some unknown reason (so far) the remote side loses connection to
the target system (no response after initially being able to talk to
it). In fact this is reproducible 100%, the first handshake works and
the system can be set to the new state, but on the next state change
the 1-byte command is not responded to so the connection fails.

In order to trace this I need to have better control at the remote
side so I wanted to expand the Windows side client to be able to run
in server mode so I can install it on the RPi3 instead of using
ser2net. Then I think I could examine all data traffic with timing to
figure out the problem.


So my current aim is to convert the current program into an
application that can run either as a server or a client on the network
and do this:

SERVER

- Listen for connection on a specific TCP port (only one allowed)
- When client connects open the predefined serial port
- Enter relay mode where all bytes coming in on the socket connection
are sent to the serial port and all bytes coming in on the serial port
are sent to teh socket.
- Keep doing this until the TCP client disconnects, when the serial
port is also closed and the system waits for another connect.
- To not lock up forever, there should be a (long) timeout in the
relay mode such that in the absence of incoming data the timeout is
decremented until triggered. Then the ports are closed and the system
goes to wait mode.

CLIENT MODE
---
- Wait for some connect command (not sure how to do this)
- Connect to local serial port
- Connect to remote TCP port
- Enter relay mode as above if both connections succeed
- Exit relay mode on some disconnect command
- Disconnect both TCP and serial ports

I would like to also add some data logging to this system so I can see
what is happening on the lines.

Using the FPC built-in serial unit I can handle the serial connection,
but I have trouble with the TCP part since the Indy components are a
bit too involved and hard to understand.

So in order for the program to run as a server I need a TCP server
component I can integrate into this without too much fussing about.
There is only one single client allowed and data should not be
processed at all, just transferred...

(And I failed to install LNet in Lazarus...)


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Serial to TCP gateway in FPC?

2017-06-29 Thread Bo Berglund
On Sun, 18 Jun 2017 20:36:11 +0200, Koenraad Lelong
 wrote:

>Do you know the SDPO-package ? That has a serial component (SDPOSerial). 
>This has a OnRxData event.

Do you mean SDPO or 5DPO (letter S or number 5 at the start)?
I googled for SDPO but the hits were for 5DPO...


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal