function [ReceivedPackets] = ExampleReceive();
%ExampleReceive - a simple example using the AVDSNetwork receive functions. 
%                 Receives packets for one second.
%
%  USAGE - This function reads AVDS vehicle packets from the local network. 
%
%    - Run AVDS.
%    - In AVDS, select "Network" and "Simulation" modes. 
%    - Start the AVDS simulation.
%    - Run ExampleReceive().
%    - The output of this function will be the packets recieved.

%   Steve Rasmussen, April 2001
%   Copyright (c) 2001 by RasSimTech Ltd
%   $Revision: 1.0.0 $  $Date: 2001/04/15 00:00:00 $



format long e;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% open connection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AVDSNetwork('OpenConnection');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% receive vehicle packets
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TimeIncrement = 0.1;

ReceivedPackets = [];
for (CountTime = [0.0:TimeIncrement:1.0]),
   ReceivedPackets = [ReceivedPackets, AVDSNetwork('ReceiveData')];
   pause(0.1);
end;	%for (CountTime = dTime1),

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% close the connection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AVDSNetwork('CloseConnections');

return;	%ExampleReceive
