def huawei_new_speed_link(args): converted_args = map(lambda hexstr: int(hexstr, 16), args.split(',')) time, tx, rx, tx_flow, rx_flow, tx_rate, rx_rate = converted_args return bps_to_human(tx * 8, rx * 8)
def function(self): up, down = self.netspeed["up"], self.netspeed["down"] n = N.UnsolicitedNotification(N.SIG_SPEED, bps_to_human(up, down)) self.manager.on_notification_received(n)
def test_bps_to_human(self): self.assertEqual(bps_to_human(1001, 1000), ('1.00 Kbps', '1.00 Kbps')) self.assertEqual(bps_to_human(1000001, 1000001), ('1.00 Mbps', '1.00 Mbps')) self.assertEqual(bps_to_human(100, 100), ('100.00 bps', '100.00 bps'))
def function(self): up, down = self.netspeed['up'], self.netspeed['down'] n = N.UnsolicitedNotification(N.SIG_SPEED, bps_to_human(up, down)) self.manager.on_notification_received(n)