Beispiel #1
0
 def parse_value(self, m, g):
     v = m.group(g)
     if v in ["N/A", "N/S"]:
         v = None
     elif g in ["rxpw", "txpw"]:
         v = round(mw2dbm(v), 2)
     return v
Beispiel #2
0
 def normalize_output(self, out):
     if out and len(out.split()) == 3:
         val, mea, he = out.split()
     else:
         self.logger.warning("Unknown output format value: %s, skipping" % out)
         return None
     if mea == "uW":
         if float(val) == 0.0:
             return None
         val = round(mw2dbm(float(val) / 1000.0), 3)
     elif mea == "uA":
         val = float(val) / 1000.0
     elif mea == "V":
         val = float(val) / 1000.0
     return val
Beispiel #3
0
 def calculate(self, value, measure):
     if measure == "dbm":
         r = [("dBm", value), ("mW", dbm2mw(value))]
     else: # mW
         r = [("dBm", mw2dbm(value)), ("mW", value)]
     return r