@@ -8,10 +8,10 import requests | |||||
8 |
|
8 | |||
9 | class CGSConfiguration(Configuration): |
|
9 | class CGSConfiguration(Configuration): | |
10 |
|
10 | |||
11 | freq0 = models.PositiveIntegerField(verbose_name='Frequency 0',validators=[MaxValueValidator(450e6)], default = 60) |
|
11 | freq0 = models.PositiveIntegerField(verbose_name='Frequency 0 (Hz)',validators=[MaxValueValidator(450e6)], default = 60) | |
12 | freq1 = models.PositiveIntegerField(verbose_name='Frequency 1',validators=[MaxValueValidator(450e6)], default = 60) |
|
12 | freq1 = models.PositiveIntegerField(verbose_name='Frequency 1 (Hz)',validators=[MaxValueValidator(450e6)], default = 60) | |
13 | freq2 = models.PositiveIntegerField(verbose_name='Frequency 2',validators=[MaxValueValidator(450e6)], default = 60) |
|
13 | freq2 = models.PositiveIntegerField(verbose_name='Frequency 2 (Hz)',validators=[MaxValueValidator(450e6)], default = 60) | |
14 | freq3 = models.PositiveIntegerField(verbose_name='Frequency 3',validators=[MaxValueValidator(450e6)], default = 60) |
|
14 | freq3 = models.PositiveIntegerField(verbose_name='Frequency 3 (Hz)',validators=[MaxValueValidator(450e6)], default = 60) | |
15 |
|
15 | |||
16 | def verify_frequencies(self): |
|
16 | def verify_frequencies(self): | |
17 |
|
17 | |||
@@ -79,7 +79,7 class CGSConfiguration(Configuration): | |||||
79 |
|
79 | |||
80 | route = "http://" + str(ip) + ":" + str(port) + "/status/ad9548" |
|
80 | route = "http://" + str(ip) + ":" + str(port) + "/status/ad9548" | |
81 | try: |
|
81 | try: | |
82 |
r = requests.get(route,timeout=0. |
|
82 | r = requests.get(route, timeout=0.8) | |
83 | except Exception as e: |
|
83 | except Exception as e: | |
84 | self.device.status = 0 |
|
84 | self.device.status = 0 | |
85 | self.device.save() |
|
85 | self.device.save() | |
@@ -91,13 +91,11 class CGSConfiguration(Configuration): | |||||
91 | icon = response[0] |
|
91 | icon = response[0] | |
92 | status = response[-1] |
|
92 | status = response[-1] | |
93 |
|
93 | |||
94 | #print(icon, status) |
|
|||
95 | #"icon" could be: "alert" or "okay" |
|
94 | #"icon" could be: "alert" or "okay" | |
96 | if "alert" in icon: |
|
95 | if "alert" in icon: | |
97 | #if "Starting Up" in status: #No Esta conectado |
|
|||
98 | # self.device.status = 1 |
|
|||
99 | #else: |
|
|||
100 | self.device.status = 1 |
|
96 | self.device.status = 1 | |
|
97 | self.device.save() | |||
|
98 | self.message = status | |||
101 | return False |
|
99 | return False | |
102 | elif "okay" in icon: |
|
100 | elif "okay" in icon: | |
103 | self.device.status = 3 |
|
101 | self.device.status = 3 | |
@@ -107,7 +105,6 class CGSConfiguration(Configuration): | |||||
107 | self.message = status |
|
105 | self.message = status | |
108 | self.device.save() |
|
106 | self.device.save() | |
109 |
|
107 | |||
110 |
|
||||
111 | return True |
|
108 | return True | |
112 |
|
109 | |||
113 |
|
110 |
General Comments 0
You need to be logged in to leave comments.
Login now