# vim: ts=4 et sts=4 sw=4 autoindent import Pyro.core from Pyro.EventService.Clients import Publisher import sndcs_common from sndcs_common.Logger import logger from sndcs.Config import config from sndcs_common.DateTimeMixin import DateTimeMixin log = logger.getLogger("DCSServerProxy") class DCSServerProxy(Pyro.core.ObjBase, Publisher, DateTimeMixin): def __init__(self): Pyro.core.ObjBase.__init__(self) Publisher.__init__(self) self.eventservice._release() self.startupTimestamp = self.now() self.namespace = config.get("pyro", "namespace", "sndcs") def clientIPAddress(self): """ Return the clients IP address """ caller = self.getLocalStorage().caller log.info("%s", caller) return caller.addr def getServerVersion(self): return (sndcs_common.MAJOR_VERSION, sndcs_common.MINOR_VERSION, sndcs_common.MACRO_VERSION, sndcs_common.CUSTOM_VERSION, sndcs_common.VERSION) def getUptime(self): return self.now() - self.startupTimestamp def ping(self): self.publish(self.namespace + "_ping",{}) self.eventservice._release() def pong(self,data): self.publish(self.namespace + "_pong",data) self.eventservice._release()