From: Alexander Korolev <antonovkablog@gmail.com>
Subject: Re: Stream_Element_Array
Date: Thu, 15 Sep 2011 11:58:21 -0700 (PDT)
Date: 2011-09-15T11:58:21-07:00 [thread overview]
Message-ID: <fd1c420f-f5c0-4a1f-ba8d-15eb6a2c7696@en1g2000vbb.googlegroups.com> (raw)
In-Reply-To: 1esmml9qftomp.vihelaijmcar$.dlg@40tude.net
On Sep 15, 12:20 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Wed, 14 Sep 2011 14:29:41 -0700 (PDT), Alexander Korolev wrote:
> > "In your case the other end is not the memory but the wire"
> > I am not sure I undestand you complitly. What's wrong, at least for
> > now, to build \ construct in memory the Buffer (Stream_Element_Array)
> > with full command (according the format I posted) inside and after
> > that send it over any stream (including GNAT.Serial, Socket etc)
> > derived from Root_Stream_Type. Basicly, I don't need even a Type -
> > I am using it just get Unsigned_16 serialized into Stream Elements.
>
> Yes, but in most cases it does not work so straightforwardly. You usually
> need headers, checksums etc. The point is that you have more layers of the
> protocol than just raw values over stream of octets. This is why you use
> stream rather as a transport for packets/messages and often more upper
> levels too (state machine etc). The idea is to always encapsulate each
> level into a data type. It saves much time later.
>
> > That's it. It's kind of hadcrafting. I also can override My_Type'Write
> > attribute and send to Serial port ... Your approach is to create a new
> > stream actully, which will take into account the PROTOCOL specifics.
> > Absolutly agree with that. But what is wrong with manual approach I am
> > implementing.
>
> It is not wrong, it is just might not work because protocols are more
> complex (layered) than this simple model.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de
1. Can not disagree again - layers, state machines is "must" part.
2. So far got some interim results with serialization of the Type
in Volatile Stream. The Last set to 3? It looks I am getting
there but no confidence so far.
type Message_Length is
record
Lenght:Interfaces.Unsigned_16 :=
Interfaces.Unsigned_16(256);
end record;
-------------
procedure length_test is
V1 : aliased Volatile_Streams.Memory_Resident_Stream (Size =>
1024);
Temp_Stream_Element :Stream_Element;
Message_Length_Instance :Message_Length;
Message_Lenght_Elements :Stream_Element_Array(1..4);
begin
Message_Length'Write(V1'Access,Message_Length_Instance);
-- Write into and serialize into in - memory stream
Message_Length_Instance
read (V1, Message_Lenght_Elements, Last);
-- Read out in-memry stream. Assigns Message_Lenght and Last
for J in Message_Lenght_Elements'First .. Last loop
Temp_Stream_Element := Message_Lenght_Elements(J);
Put_Line( Temp_Stream_Element'Img);
end loop;
Put_Line( "Last");
Put_line (Last'Img);
-- print out the Last
end;
with Lenght:Interfaces.Unsigned_16 := Interfaces.Unsigned_16(255);
-- output
../development/projects/length_test
255
0
0
Last
3
[2011-09-15 11:26:32] process terminated successfully (elapsed time:
00.13s)
with Lenght:Interfaces.Unsigned_16 := Interfaces.Unsigned_16(256);
--output
../development/projects/length_test
0
1
0
Last
3
[2011-09-15 11:43:12] process terminated successfully (elapsed time:
00.13s)
next prev parent reply other threads:[~2011-09-15 18:59 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-14 3:13 Stream_Element_Array Alexander Korolev
2011-09-14 5:29 ` Stream_Element_Array Per Sandberg
2011-09-14 8:34 ` Stream_Element_Array Alexander Korolev
2011-09-14 8:31 ` Stream_Element_Array Simon Wright
2011-09-14 9:09 ` Stream_Element_Array Alexander Korolev
2011-09-14 9:40 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 9:41 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 10:18 ` Stream_Element_Array Simon Wright
2011-09-14 12:42 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 16:20 ` Stream_Element_Array Simon Wright
2011-09-14 19:53 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 10:53 ` Stream_Element_Array Simon Wright
2011-09-14 12:48 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 14:48 ` Stream_Element_Array Alexander Korolev
2011-09-14 15:08 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 17:16 ` Stream_Element_Array Alexander Korolev
2011-09-14 20:13 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 21:29 ` Stream_Element_Array Alexander Korolev
2011-09-15 8:20 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-15 18:58 ` Alexander Korolev [this message]
2011-09-15 20:48 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 0:20 ` Stream_Element_Array Alexander Korolev
2011-09-15 19:15 ` Stream_Element_Array Alexander Korolev
2011-09-15 20:11 ` Stream_Element_Array Simon Wright
2011-09-15 20:34 ` Stream_Element_Array Alexander Korolev
2011-09-15 21:42 ` Stream_Element_Array Simon Wright
2011-09-15 21:50 ` Stream_Element_Array Simon Wright
2011-09-16 0:01 ` Stream_Element_Array Alexander Korolev
2011-09-16 0:18 ` Stream_Element_Array Adam Beneschan
2011-09-16 7:22 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 10:21 ` Stream_Element_Array Simon Wright
2011-09-16 12:13 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 17:20 ` Stream_Element_Array Simon Wright
2011-09-16 19:32 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 22:18 ` Stream_Element_Array Simon Wright
2011-09-17 8:18 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-19 23:22 ` Stream_Element_Array Randy Brukardt
2011-09-15 21:28 ` Stream_Element_Array Alexander Korolev
2011-09-15 2:33 ` Stream_Element_Array Alexander Korolev
2011-09-19 23:11 ` Stream_Element_Array Randy Brukardt
2011-09-14 12:19 ` Stream_Element_Array Gautier write-only
2011-09-16 11:17 ` Stream_Element_Array anon
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox