40 | | default_min_freq = 462.4825e6 #80 Khz to the left of channel 1 (462.5625e6) in frs band |
41 | | default_max_freq = 462.6425e6 #80 Khz to the right of channel 1 (462.5625e6) in frs band |
42 | | self.sp_sense_path = spec_sense_path.spec_sense_top_block(default_min_freq,default_min_freq) |
43 | | self.connect(self.sp_sense_path.u, self.sp_sense_path.s2v, self.sp_sense_path.fft, self.sp_sense_path.c2mag, self.sp_sense_path.stats) |
44 | | #self.connect(self.txpath); |
45 | | #self.connect(self.rxpath); |
| 40 | #default_min_freq = 462.4825e6 #80 Khz to the left of channel 1 (462.5625e6) in frs band |
| 41 | #default_max_freq = 462.6425e6 #80 Khz to the right of channel 1 (462.5625e6) in frs band |
| 42 | #self.sp_sense_path = spec_sense_path.spec_sense_top_block(default_min_freq,default_min_freq) |
| 43 | #self.connect(self.sp_sense_path.u, self.sp_sense_path.s2v, self.sp_sense_path.fft, self.sp_sense_path.c2mag, self.sp_sense_path.stats) |
| 44 | |
| 45 | self.connect(self.txpath); |
| 46 | self.connect(self.rxpath); |
239 | | |
| 249 | if mode == "sync": |
| 250 | #nbytes = int(1e6 * .0003) |
| 251 | #nbytes = int(1e6 * .0003) |
| 252 | nbytes = 6 |
| 253 | pkt_size = 6 |
| 254 | print "printing packet size",pkt_size,"pkt size\n" |
| 255 | while sync_status != True: |
| 256 | #ch = random.randint(1, 7) |
| 257 | #ch = int(random.choice('17')) |
| 258 | #ch = random.randint(6,12) |
| 259 | ch = 1 |
| 260 | hop_freq = float(1e6 * (462.5625+(ch-1)*0.025))#setting the centre freq frequency for sending packets |
| 261 | print "hop freq is ",hop_freq |
| 262 | |
| 263 | #hop_freq = float(1e6 * (462.5625+(5-1)*0.05))#setting the centre freq frequency for sending packets |
| 264 | tb.txpath.set_freq(hop_freq) |
| 265 | tb.rxpath.set_freq(hop_freq) |
| 266 | #print "inside while pppp printing sync channel",sync_status," done" |
| 267 | #if sync_status == "True": |
| 268 | #print "synchronization done..data channel is found" |
| 269 | #break |
| 270 | #else: |
| 271 | #print "inside else1" |
| 272 | n = 0 |
| 273 | pktno = 0 |
| 274 | print >> myfile, "out" |
| 275 | while n < nbytes: |
| 276 | print >> myfile, "inside while" |
| 277 | if options_tx.from_file is None: |
| 278 | #data = (pkt_size - 2) * chr(pktno & 0xff) #0xff is 255 |
| 279 | data = 's'+'s'+str(ch)+str(ch) #adding redundant bits for sync and channel |
| 280 | #print >> myfile, data |
| 281 | #print "printing data",data,"****\n" |
| 282 | else: |
| 283 | data = source_file.read(pkt_size - 2) |
| 284 | if data == '': |
| 285 | break; |
| 286 | |
| 287 | payload = struct.pack('!H', pktno & 0xffff) + data |
| 288 | #print "printing payload",payload,"**\n" |
| 289 | |
| 290 | send_pkt(tb,payload) |
| 291 | #print "printing payload",payload,"**\n" |
| 292 | n += len(payload) |
| 293 | sys.stderr.write('.') |
| 294 | if options_tx.discontinuous and pktno % 5 == 4: |
| 295 | time.sleep(1) |
| 296 | pktno += 1 |
| 297 | #print "before sleeping for 10 seconds and value of resend count is",resend_count |
| 298 | |
| 299 | tb.rxpath.min_freq = hop_freq - 80e3 |
| 300 | tb.rxpath.max_freq = hop_freq + 80e3 |
| 301 | tb.rxpath.get_avg_power(10) #10 is the number of fft frames that we are looking at to determine the average power |
| 302 | |
| 303 | time.sleep(0.05) |
| 304 | #time.sleep(2) |
| 305 | #resend_count += 1 |
| 306 | print "sync channel found! and it is channel ",ch,"\n" |
| 307 | send_pkt(tb,eof=True) |
| 308 | #myfile.close() |
| 309 | tb.wait() |