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

2017-06-26 Thread Bo Berglund
On Sun, 18 Jun 2017 09:04:49 +0200, Bo Berglund
 wrote:

>So I installed
>serial2net on the RPi, making it publish the serial port as a TCP port
>(#2091). This part works OK, so whatever is sent on the TCP socket
>connection gets transferred to the RS232 serial line and vice versa.

My statement above seems to be correct, ser2net does work properly on
my RPi machine as witnessed by the fact that I can use a TCP-enabled
client software (written using Lazarus) against the controller and
operate it as intended.
The data passes through ser2net exactly as expected.

But when I hook up the serial-only client (a Delphi XE5 program) via a
relaying program I made myself (again in Lazarus) using the FPC serial
unit and Indy TcpClient objects it fails on initial connect and does
not pass into the main control.
The very strange thing is that the ser2net logs show the incoming data
from the network as being passed on to the serial port and there is
some response but then it just stops.
The protocol transfer should look as follows:

Client S/W  Controller   Action
-
0x10   =>Switch to remote control
   <=   0x06 (ACK)   Command accepted)
0xD1   =>Switch to data transfer mode
   <=   0x06 (ACK)   Command accepted
  =>Any data transfer command
--

I.e:
10 06 D1 06 
But it turns out to be:
10 06 D1 D1 D1

Where D1 is inbound from the client and is repeated because there is
no ACK response.

So in this case the ser2net seems to receive the command (and
therefore transmitting it via the serial port), but it does not
recognize any response...

Is there any similar experience here with ser2net?

NEXT:
It looks like I will have to rewrite my relaying program now used in
Windows for the conversion to TCP from RS232 to also work as the
replacement for ser2net on RPi3. This way I can monitor the data
better and check time intervals etc.

My problem here is the fact that the RPi is headless so the GUI
program I have written with Lazarus will not work. Instead I have to
make a console version that can run on RPi for the test and here I
have the concern that I am using Application.Processmessages, which I
believe cannot be used in a console program.
How can I replace it?


-- 
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] Mutual Reference Interfaces and Memory Leaks

2017-06-26 Thread Marcos Douglas B. Santos
On Mon, Jun 26, 2017 at 12:39 PM, African Wild Dog 
wrote:

> Hello,
>
> What is the recommended way to avoid memory leaks in mutual interface
> references?
>
> From delphi 10.1 Berlin it is possible to use [unsafe] e [weak] attributes.
> http://blog.marcocantu.com/blog/2016-april-weak-unsafe-
> interface-references.html.
>
> Is there a workaround in Free Pascal 3?
>

Hi,

I wrote an article about it https://goo.gl/Lij4hu
But you need to translate from Portuguese to English.

Best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Mutual Reference Interfaces and Memory Leaks

2017-06-26 Thread African Wild Dog
Hello,

What is the recommended way to avoid memory leaks in mutual interface
references?

>From delphi 10.1 Berlin it is possible to use [unsafe] e [weak] attributes.
http://blog.marcocantu.com/blog/2016-april-weak-unsafe-interface-references.html
.

Is there a workaround in Free Pascal 3?

Regards

 CODE 

type
  IMyInterfaceA = interface
 procedure Foo;
  end;

  IMyInterfaceB = interface
procedure Bar;
  end;

  TMyInterfaceA = class(TInterfacedObject, IMyInterfaceA)
  private
 var FMyInterfaceB: IMyInterfaceB;
  
  end;


  TMyInterfaceB = class(TInterfacedObject, IMyInterfaceB)
  private
 var FMyInterfaceA: IMyInterfaceA;
  
  end;

   .

=
___
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-26 Thread Stefan V. Pantazi


On 06/26/2017 10:21 AM, James Richters wrote:

Is there a way to re-scale a drawing with agg_2D?


I think so, scaling is one of the transformations that agg supports 
well. The way I would go about this would be to study how agg manages 
the parsing, storage and display of svg drawings, which are basically 
collections of drawing commands, just like yours. Compile, run and 
analyze the code of svg examples, in particular svg_test demo (the one 
with the lion head).


I found a scale feature in aggpas but it only seems to scale items drawn 
after the command is issued.


Scaling is done through matrix multiplication but you need to have all 
your drawing commands stored in a similar way agg does it for svg, so 
that they can be redrawn. This is a more flexible approach than 
reiterating over hardcoded drawing commands. The cost is the increased 
complexity.


I'm wondering if there is a way to send aggpas all my lines and arcs, 
then give it a scale and offset, display it that way, then a different 
scale and offset, then redisplay it that way,


I think doing this in a way similar to svg routines is one way to go and 
may have its limitations. While significantly more complicated, you also 
get as a byproduct the capability of saving your screen (think 
screenshots, etc.) in standard svg format that can be persisted beyond 
your application lifecycle.

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

Re: [fpc-pascal] Raspberry Pi Zero Wireless Self-hosted

2017-06-26 Thread Paul Breneman

On 06/16/2017 08:22 AM, Paul Breneman wrote:

How simple can we get? http://wiki.freepascal.org/self-hosted


I just updated http://www.controlpascal.com/self-hosted.htm#RPiZwKit 
after quickly getting a console Debian installed on RPi Zero Wireless.

___
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-26 Thread James Richters
Is there a way to re-scale a drawing with agg_2D?  Basically I'm wanting to 
zoom in/out of a drawing made with lines and arcs and I'm wondering the most 
efficient way to do it.  I found a scale feature in aggpas but it only seems to 
scale items drawn after the command is issued.  I'm wondering if there is a way 
to send aggpas all my lines and arcs, then give it a scale and offset, display 
it that way, then a different scale and offset, then redisplay it that way, or 
do I just need to do this myself and just clear aggpas and re-send the lines 
and arcs at the new scale and offset to aggpas from scratch.

James

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