Ejemplo n.º 1
0
class AstronServer:
    def __init__(self,
                 dc_file = DC_FILE,
                 stateserver = STATESERVER,
                 dbss = DBSS,
                 ai_channel = SERVICES_CHANNEL,
                 host = '127.0.0.1',
                 port = 7199,
                 frame_time = 1./100.):
        self.host = host
        self.port = port
        self.frame_time = frame_time
        self.repo = InternalRepository(dc_file,
                                       stateserver = stateserver,
                                       dbss = dbss,
                                       ai_channel = ai_channel)

    def start(self):
        self.repo.connect(self.connected, self.failed, host = self.host, port = self.port)
        while True:
            self.repo.poll_till_empty()
            # FIXME: Measure the time left in the frame, and sleep accordingly here.
            # FIXM: Log ratio of time left, prevalence of overlong frames, total accumulated lag
            sleep(0.1)

    def connected(self):
        print('Connection established, connected() not overridden.')

    def failed(self):
        print('Connection attempt failed, failed() not overridden.')
Ejemplo n.º 2
0
class AstronServer:
    def __init__(self,
                 dc_file=DC_FILE,
                 stateserver=STATESERVER,
                 dbss=DBSS,
                 ai_channel=SERVICES_CHANNEL,
                 host='127.0.0.1',
                 port=7199,
                 frame_time=1. / 100.):
        self.host = host
        self.port = port
        self.frame_time = frame_time
        self.repo = InternalRepository(dc_file,
                                       stateserver=stateserver,
                                       dbss=dbss,
                                       ai_channel=ai_channel)

    def start(self):
        self.repo.connect(self.connected,
                          self.failed,
                          host=self.host,
                          port=self.port)
        while True:
            self.repo.poll_till_empty()
            # FIXME: Measure the time left in the frame, and sleep accordingly here.
            # FIXM: Log ratio of time left, prevalence of overlong frames, total accumulated lag
            sleep(0.1)

    def connected(self):
        print('Connection established, connected() not overridden.')

    def failed(self):
        print('Connection attempt failed, failed() not overridden.')
Ejemplo n.º 3
0
 def __init__(self,
              dc_file = DC_FILE,
              stateserver = STATESERVER,
              dbss = DBSS,
              ai_channel = SERVICES_CHANNEL,
              host = '127.0.0.1',
              port = 7199,
              frame_time = 1./100.):
     self.host = host
     self.port = port
     self.frame_time = frame_time
     self.repo = InternalRepository(dc_file,
                                    stateserver = stateserver,
                                    dbss = dbss,
                                    ai_channel = ai_channel)
Ejemplo n.º 4
0
 def __init__(self,
              dc_file=DC_FILE,
              stateserver=STATESERVER,
              dbss=DBSS,
              ai_channel=SERVICES_CHANNEL,
              host='127.0.0.1',
              port=7199,
              frame_time=1. / 100.):
     self.host = host
     self.port = port
     self.frame_time = frame_time
     self.repo = InternalRepository(dc_file,
                                    stateserver=stateserver,
                                    dbss=dbss,
                                    ai_channel=ai_channel)