commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10990 - gnuradio/branches/developers/eb/vrt/vrt/apps


From: eb
Subject: [Commit-gnuradio] r10990 - gnuradio/branches/developers/eb/vrt/vrt/apps
Date: Thu, 7 May 2009 11:06:41 -0600 (MDT)

Author: eb
Date: 2009-05-07 11:06:41 -0600 (Thu, 07 May 2009)
New Revision: 10990

Modified:
   gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc
Log:
checkpoint

Modified: gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc   
2009-05-07 16:43:30 UTC (rev 10989)
+++ gnuradio/branches/developers/eb/vrt/vrt/apps/simple_rx_samples.cc   
2009-05-07 17:06:41 UTC (rev 10990)
@@ -135,25 +135,61 @@
 }
 
 
+static bool
+send_rx_command(int ctrl_fd, bool start,
+               struct in_addr addr, int data_port, int samples_per_pkt, int 
siggen_param)
+{
+  uint32_t cmd[7];
+  cmd[0] = htonl(0);              // verb: set
+  cmd[1] = htonl(0);              // id: rx_streaming
+  cmd[2] = htonl(start ? 1: 0);           // start or stop?
+  cmd[3] = addr.s_addr;                   // ip address to send data to 
(already network endian)
+  cmd[4] = htonl(data_port);      // port to send data to
+  cmd[5] = htonl(samples_per_pkt);
+  cmd[6] = htonl(siggen_param);
+
+  int r = send(ctrl_fd, cmd, sizeof(cmd), 0);
+  if (r < 0){
+    perror("send");
+    return false;
+  }
+  if (r != sizeof(cmd)){
+    fprintf(stderr, "send: short return value.  expected %zd, got %d\n", 
sizeof(cmd), r);
+    return false;
+  }
+
+  return true;
+}
+
 int
 main(int argc, char **argv)
 {
   const char *quad_radio_ip = "192.168.123.123";
   int quad_radio_ctrl_port = 790;
+  size_t rx_bufsize = 0;           // use default (62.5MB)
+  int  samples_per_pkt = 0;        // use default
+  int  siggen_param = 0;
 
-  int           ctrl_fd;           // socket for control
+  int           ctrl_fd = 0;       // socket for control
   struct in_addr ctrl_port_inaddr;  // our ip addr
   int           data_fd;           // socket for data
-  int           data_port;         // our data port number
+  int           data_port = 0;     // our data port number
 
   if (!open_sockets(quad_radio_ip, quad_radio_ctrl_port,
                    &ctrl_fd, &ctrl_port_inaddr, &data_fd, &data_port))
     return 1;
 
 
-  // send_start_command(ctrl_fd, data_port,
-                    
+  vrt::rx_udp::sptr vrt_receiver = vrt::rx_udp::make(data_port, rx_bufsize);
   
 
+  if (!send_rx_command(ctrl_fd, true, ctrl_port_inaddr, data_port, 
samples_per_pkt, siggen_param)){
+    fprintf(stderr, "failed to send_rx_command\n");
+    return 1;
+  }
+
+  // start receiving packets
+  
+
   return 0;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]