##// END OF EJS Templates
clean abs code
jespinoza -
r315:b3c54f0853ae
parent child
Show More
@@ -396,7 +396,8 class ABSConfiguration(Configuration):
396 396 status[int(address[0][10:])-1] = '3'
397 397 elif data == '0':
398 398 status[int(address[0][10:])-1] = '1'
399 except:
399 except Exception as e:
400 print 'Error {}'.format(e)
400 401 n += 1
401 402 sock.close()
402 403 else:
@@ -492,9 +493,10 class ABSConfiguration(Configuration):
492 493 multicast_group = ('224.3.29.71', 10000)
493 494 # Create the datagram socket
494 495 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
495 sock.settimeout(0.5)
496 sock.settimeout(1)
496 497 # sock.bind((local_ip, 10000))
497 498 local_ip = os.environ.get('LOCAL_IP', '127.0.0.1')
499 local_ip = '192.168.1.128'
498 500 sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(local_ip))
499 501 sent = sock.sendto(message, multicast_group)
500 502 print('Sending ' + message)
@@ -513,6 +515,7 class ABSConfiguration(Configuration):
513 515 for i in range(32):
514 516 #if True:
515 517 try:
518 address = None
516 519 data, address = sock.recvfrom(1024)
517 520 print address, data
518 521 if data == '1':
@@ -552,10 +555,8 class ABSConfiguration(Configuration):
552 555 confdds = ''
553 556 confjars = ''
554 557 confrc = ''
555 print 'Starting...', self.experiment
556 558 #TO STOP DEVICES: DDS-JARS-RC
557 559 for i in range(0,len(confs)):
558 print i
559 560 if i==0:
560 561 for conf in confs:
561 562 if conf.device.device_type.name == 'dds':
@@ -570,12 +571,10 class ABSConfiguration(Configuration):
570 571 break
571 572 if i==2:
572 573 for conf in confs:
573 print conf
574 574 if conf.device.device_type.name == 'rc':
575 575 confrc = conf
576 576 confrc.stop_device()
577 577 break
578 print 'Stop devices'
579 578 if beam_pos > 0:
580 579 beam_pos = beam_pos - 1
581 580 else:
@@ -585,9 +584,7 class ABSConfiguration(Configuration):
585 584 #El servidor tcp en el embebido comienza a contar desde 0
586 585 status = ['0'] * 64
587 586 message = 'CHGB{}'.format(beam_pos)
588 print 'Before send'
589 587 sock = self.send_multicast(message)
590 print 'Waiting'
591 588 for i in range(32):
592 589 try:
593 590 data, address = sock.recvfrom(1024)
@@ -596,7 +593,8 class ABSConfiguration(Configuration):
596 593 status[int(address[0][10:])-1] = '3'
597 594 elif data == '0':
598 595 status[int(address[0][10:])-1] = '1'
599 except:
596 except Exception as e:
597 print 'Error {}'.format(e)
600 598 pass
601 599
602 600 sock.close()
General Comments 0
You need to be logged in to leave comments. Login now