Exemplo n.º 1
0
                    help="Start Client with testdata-set",
                    action="store_true")
args = parser.parse_args()

bwConfig = ConfigYAML()
if not bwConfig.loadConfigFile(paths.CONFIG_PATH + args.config):
    logging.error("cannot load config file")
    exit(1)

# ========== CLIENT CODE ==========
bwClient = None
inputSource = None
inputQueue = queue.Queue()

try:
    ip = bwConfig.get("server", "ip", default="127.0.0.1")
    port = bwConfig.get("server", "port", default="8080")

    if bwConfig.get("client", "useBroadcast", default=False):
        broadcastClient = BroadcastClient()
        if broadcastClient.getConnInfo():
            ip = broadcastClient.serverIP
            port = broadcastClient.serverPort

    if not args.test:
        logging.debug("loading input source: %s",
                      bwConfig.get("client", "inputSource"))
        if bwConfig.get("client", "inputSource") == "sdr":
            inputSource = SdrInput(inputQueue,
                                   bwConfig.get("inputSource", "sdr"),
                                   bwConfig.get("decoder"))
Exemplo n.º 2
0
    logging.fatal("cannot load config file")
    exit(1)

# ############################# begin server system
bwRoutMan = None
bwServer = None
bcServer = None

try:
    bwRoutMan = RouterManager()
    if not bwRoutMan.buildRouters(bwConfig):
        logging.fatal("Error while building routers")
        exit(1)

    bcServer = BroadcastServer()
    if bwConfig.get("server", "useBroadcast", default=False):
        bcServer.start()

    incomingQueue = queue.Queue()
    bwServer = TCPServer(incomingQueue)
    if bwServer.start(port=bwConfig.get('server', 'port', default=8080)):

        while 1:
            if incomingQueue.empty():  # pause only when no data
                time.sleep(0.1)  # reduce cpu load (wait 100ms)
                # in worst case a packet have to wait 100ms until it will be processed

            else:
                data = incomingQueue.get()

                logging.info("get data from %s (waited in queue %0.3f sec.)",
Exemplo n.º 3
0
    logging.fatal("cannot load config file")
    exit(1)

# ############################# begin server system
bwRoutMan = None
bwServer = None
bcServer = None

try:
    bwRoutMan = RouterManager()
    if not bwRoutMan.buildRouters(bwConfig):
        logging.fatal("Error while building routers")
        exit(1)

    bcServer = BroadcastServer()
    if bwConfig.get("server", "useBroadcast", default=False):
        bcServer.start()

    incomingQueue = queue.Queue()
    bwServer = TCPServer(incomingQueue)
    if bwServer.start():

        while 1:
            if incomingQueue.empty():  # pause only when no data
                time.sleep(0.1)  # reduce cpu load (wait 100ms)
                # in worst case a packet have to wait 100ms until it will be processed

            else:
                data = incomingQueue.get()

                logging.info("get data from %s (waited in queue %0.3f sec.)",
Exemplo n.º 4
0
def makeDescriptor():
    """!Build a descriptor object with loaded configuration"""
    config = ConfigYAML()
    assert config.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True
    descriptor = Descriptor(config.get("descriptor_test"))
    return descriptor