# Path: basestation/base_station.py
# class BaseStation(object, metaclass=Singleton):
#     """
#     Contains logic to manage and unify input and output between bots and vision
#     sources. This class is a singleton to prevent accidental BaseStation
#     duplication.
#     """
#     # https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
# 
#     def __init__(self):
#         """
#         Creates singleton base station. Contains a bot and vision manager.
#         """
#         self.bot_manager = BotManager()
#         self.vision_manager = VisionManager()
#         return
# 
#     def get_bot_manager(self):
#         """
#         Gets the bot manager associated with current BaseStation.
#         """
#         return self.bot_manager
# 
#     def get_vision_manager(self):
#         """
#         Gets the vision manager associated with current BaseStation.
#         """
#         return self.vision_manager


import tornado
import tornado.web
import os.path
import json
import logging
import sys
from basestation.base_station import BaseStation
# Minibot imports.

class BaseInterface:
    """
    Class which contains the base station and necessary functions for running the
    base station GUI.
    """
    def __init__(self, port):
        """
        Initializes base station
        :param port: Port number from which basestation runs.
        """
        self.port = port
        self.handlers = [
            ("/", BaseStationHandler),
            ("/gui", BaseStationHandler),
            ("/addBot", AddBotHandler),
            ("/commandBot", CommandBotHandler),
            ("/discoverBots", DiscoverBotsHandler),
            ("/getTrackedBots", GetTrackedBotHandler),
            ("/removeBot", RemoveBotHandler),
            ("/sendKV", SendKVHandler),
            ("/vision", VisionHandler),
            ("/updateloc", VisionHandler),
            ("/findScripts", FindScriptsHandler),
            ("/addScenario", AddScenarioHandler)
        ]
        self.settings = {
            "static_path": os.path.join(os.path.dirname(__file__), "static")
        }

# Path: basestation/base_station.py
# class BaseStation(object, metaclass=Singleton):
#     """
#     Contains logic to manage and unify input and output between bots and vision
#     sources. This class is a singleton to prevent accidental BaseStation
#     duplication.
#     """
#     # https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
# 
#     def __init__(self):
#         """
#         Creates singleton base station. Contains a bot and vision manager.
#         """
#         self.bot_manager = BotManager()
#         self.vision_manager = VisionManager()
#         return
# 
#     def get_bot_manager(self):
#         """
#         Gets the bot manager associated with current BaseStation.
#         """
#         return self.bot_manager
# 
#     def get_vision_manager(self):
#         """
#         Gets the vision manager associated with current BaseStation.
#         """
#         return self.vision_manager


# Path: gui/main.py
import tornado
import tornado.web
import os.path
import json
import logging
import sys
from basestation.base_station import BaseStation

# Minibot imports.

class BaseInterface:
    """
    Class which contains the base station and necessary functions for running the
    base station GUI.
    """
    def __init__(self, port):
        """
        Initializes base station
        :param port: Port number from which basestation runs.
        """
        self.port = port
        self.handlers = [
            ("/", BaseStationHandler),
            ("/gui", BaseStationHandler),
            ("/addBot", AddBotHandler),
            ("/commandBot", CommandBotHandler),
            ("/discoverBots", DiscoverBotsHandler),
            ("/getTrackedBots", GetTrackedBotHandler),
            ("/removeBot", RemoveBotHandler),
            ("/sendKV", SendKVHandler),
            ("/vision", VisionHandler),
            ("/updateloc", VisionHandler),
            ("/findScripts", FindScriptsHandler),
            ("/addScenario", AddScenarioHandler)
        ]
        self.settings = {
            "static_path": os.path.join(os.path.dirname(__file__), "static")
        }

        self.base_station = BaseStation()