##// END OF EJS Templates
ver_3Julio :: Fix IP bug in ABS
jespinoza -
r407:c93b3c968e19
parent child
Show More
@@ -257,6 +257,7 def start(request, id_conf, id_beam):
257 for i, beam in enumerate(beams_list):
257 for i, beam in enumerate(beams_list):
258 if i==int(id_beam):
258 if i==int(id_beam):
259 conf.active_beam = beam.pk
259 conf.active_beam = beam.pk
260 conf.save()
260 break
261 break
261
262
262 return HttpResponse(json.dumps({'result':1}), content_type='application/json')
263 return HttpResponse(json.dumps({'result':1}), content_type='application/json')
@@ -22,7 +22,7 answer = enable_rf(ip, port)
22 import json
22 import json
23 from devices.dds import data
23 from devices.dds import data
24
24
25 from devices.jro_device import eth_device, IdClass
25 from devices.jro_device import eth_device, eth_devices, IdClass
26
26
27 ID_CLASS = IdClass["dds"]
27 ID_CLASS = IdClass["dds"]
28
28
@@ -54,11 +54,16 def reset():
54
54
55 return cmd, payload
55 return cmd, payload
56
56
57 @eth_device(ID_CLASS)
57 @eth_devices(ID_CLASS)
58 def change_ip(new_ip, mask="255.255.255.0", gateway="0.0.0.0"):
58 def change_ip(new_ip, mask="255.255.255.0", gateway="0.0.0.0"):
59
59
60 cmd = CMD_CHANGEIP
60 cmd = CMD_CHANGEIP
61 payload = new_ip + '/' + mask + '/' + gateway
61 payload = b''
62 payload += new_ip.encode()
63 payload += b'/'
64 payload += mask.encode()
65 payload += b'/'
66 payload += gateway.encode()
62
67
63 return cmd, payload
68 return cmd, payload
64
69
@@ -412,3 +412,18 def eth_device(id_class):
412
412
413 return func_wrapper
413 return func_wrapper
414 return inner_func
414 return inner_func
415
416 def eth_devices(id_class):
417 def inner_func(func):
418 def func_wrapper(ip, port, **kwargs):
419
420 cmd, payload = func(**kwargs)
421
422 ipObj = IPData(ip, port, id_class=id_class)
423 rx = ipObj.sendData(cmd, payload)
424
425 return rx
426
427 return func_wrapper
428 return inner_func
429
General Comments 0
You need to be logged in to leave comments. Login now