def handle_cmd(self, request): # Strip spaces and \0 request = request.strip().strip("\0") # Split into a command and arguments request = request.split(" ") argv = request[1:] argc = len(argv) cmd = request[0] # Application specific if cmd == "exit": app.shutdown() elif cmd == "help": self.print_help() elif cmd == "clear": os.system("clear") # Server specific elif cmd == "rxtune" and argc == 1: app.server.broadcast("CMD RXTUNE %s\n" % argv[0]) elif cmd == "rxarfcn" and argc == 1: #print "arfcn gsm" #arf_ref = arfcnreference.ArfcnReference() #a = arf_ref.get_for_channel(argv[0]) #frq = int(float(a["downlink"]) * 1000) #print(str(frq)) frq = arfcn.arfcn2downlink(int(argv[0])) / 1000 band = arfcn.arfcn2band(int(argv[0])) print "Freq = " + str(frq) + " Mhz ; band " + str(band) app.server.broadcast("CMD RXTUNE %s\n" % str(frq)) #elif cmd == "rxarfcn3g" and argc == 1: # print "arfcn 3g" elif cmd == "paging": if argc == 1: subcmd = argv[0] if subcmd == "start": app.server.broadcast("CMD START\n") elif subcmd == "stop": app.server.broadcast("CMD STOP\n") elif subcmd == "cross": app.server.broadcast("CMD CROSS\n") elif subcmd == "flush": app.server.broadcast("CMD FLUSH\n") # Unknown command elif cmd != "": self.print_unknown()
def test_005_arfcn2downlink(self): self.assertEqual(460.6e6, arfcn.arfcn2downlink(259, 'GSM450')) self.assertEqual(467.4e6, arfcn.arfcn2downlink(293, 'GSM450')) self.assertEqual(489e6, arfcn.arfcn2downlink(306, 'GSM480')) self.assertEqual(495.8e6, arfcn.arfcn2downlink(340, 'GSM480')) self.assertEqual(869.2e6, arfcn.arfcn2downlink(128, 'GSM850')) self.assertEqual(893.8e6, arfcn.arfcn2downlink(251, 'GSM850')) self.assertEqual(935.2e6, arfcn.arfcn2downlink(1, 'P-GSM')) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124, 'P-GSM')) self.assertEqual(935.0e6, arfcn.arfcn2downlink(0, 'E-GSM')) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124, 'E-GSM')) self.assertEqual(925.2e6, arfcn.arfcn2downlink(975, 'E-GSM')) self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023, 'E-GSM')) self.assertEqual(935.0e6, arfcn.arfcn2downlink(0, 'R-GSM')) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124, 'R-GSM')) self.assertEqual(921.2e6, arfcn.arfcn2downlink(955, 'R-GSM')) self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023, 'R-GSM')) self.assertEqual(1805.2e6, arfcn.arfcn2downlink(512, 'DCS1800')) self.assertEqual(1879.8e6, arfcn.arfcn2downlink(885, 'DCS1800')) self.assertEqual(1930.2e6, arfcn.arfcn2downlink(512, 'PCS1900')) self.assertEqual(1989.8e6, arfcn.arfcn2downlink(810, 'PCS1900'))
def test_005_arfcn2downlink(self): self.assertEqual(460.6e6, arfcn.arfcn2downlink(259)) self.assertEqual(467.4e6, arfcn.arfcn2downlink(293)) self.assertEqual(489e6, arfcn.arfcn2downlink(306)) self.assertEqual(495.8e6, arfcn.arfcn2downlink(340)) self.assertEqual(869.2e6, arfcn.arfcn2downlink(128)) self.assertEqual(893.8e6, arfcn.arfcn2downlink(251)) self.assertEqual(935.2e6, arfcn.arfcn2downlink(1)) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124)) self.assertEqual(935.0e6, arfcn.arfcn2downlink(0)) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124)) self.assertEqual(925.2e6, arfcn.arfcn2downlink(975)) self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023)) self.assertEqual(935.0e6, arfcn.arfcn2downlink(0)) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124)) self.assertEqual(921.2e6, arfcn.arfcn2downlink(955)) self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023)) self.assertEqual(1805.2e6, arfcn.arfcn2downlink(512)) self.assertEqual(1879.8e6, arfcn.arfcn2downlink(885)) self.assertEqual(1930.2e6, arfcn.arfcn2downlink(512 + 2**15)) self.assertEqual(1989.8e6, arfcn.arfcn2downlink(810 + 2**15))