function a = ltpdv_server_get_data(mainfig)

% Get times
times = ltpdv_server_get_times(mainfig);

% Get server details
[dtype, server, port, rds, cal, stat] = ltpdv_server_get_server(mainfig);
spl = plist('Type', dtype, 'SERVER', server, 'port', port);
% Get selected channels 
chans = ltpdv_server_get_channels(mainfig);

% Loop over times and channels
a = [];
for k=1:length(times)
   
   ts = times(k);
   start = char(ts.startT);
   nsecs = ts.endT-ts.startT+1;
   % Loop over channels
   for j=1:length(chans)      
      chan = chans{j};
      disp(sprintf('=== Getting %s | %s [%ds]', chan, start, nsecs));      
      na = ao(spl, plist('channels', chan, 'starttime', start, 'nsecs', nsecs));
      a = [a na];
   end % End chans loop      
end % End time loop

