Пример #1
0
 def __init__(self):
     xmlrpc.XMLRPC.__init__(self)
     self.classroom=None
     self.externalIP=NetworkUtils.get_ip_inet_address()
     if self.externalIP=='':
         self.externalIP=NetworkUtils.get_ip_inet_address('192.168.0.254')
     self.hostname=NetworkUtils.getHostName()
     pynotify.init('controlaula')
Пример #2
0
    def requestRegister(self, uid):
        """The client sends the registration data to the server
        and start pings as a keepalive detection"""
        self.uuid = uid
        self.my_server = self.transport.getPeer()
        self.mylogin = MyUtils.getLoginName()
        self.hostip = NetworkUtils.get_ip_inet_address(self.transport.getPeer().host)
        is_host_not_user = (self.mylogin=='root')
        isLTSP = MyUtils.isLTSP()

        info_host = {'login' : self.mylogin,
                   'hostname' : NetworkUtils.getHostName(),
                   'hostip' : self.hostip,
                   'ltsp' : isLTSP != '',
                   'classname' : Configs.RootConfigs['classroomname'],
                   'isHostnotUser' : is_host_not_user ,
                   'uuid' : self.uuid
                   }                 

        if is_host_not_user :
            info_host['mac'] = NetworkUtils.get_inet_HwAddr(self.transport.getPeer().host)
        else:
            info_host['username'] = MyUtils.getFullUserName()
            info_host['ipLTSP'] = isLTSP
            info_host['internetEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('internet') == '1'
            info_host['mouseEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('mouse') == '1'
            info_host['soundEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('sound') == '1'
            info_host['messagesEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('messages') == '1'
            info_host['photo'] = ''
            
        self.doPing()            
        return {'result': info_host}                
Пример #3
0
    def sendNext():
        global myIp
        global exitStatus
        nuevaIP = NetworkUtils.get_ip_inet_address()

        if myIp != "None" and myIp != nuevaIP:
            exitStatus = 97
            reactor.stop()
        else:
            myIp = nuevaIP

        if not MyUtils.isActive():
            reactor.stop()
Пример #4
0
 def __init__(self,bcastport=0):
     '''
     Parameters:
     bcastport=The port use in the video broadcasting
     '''          
     if bcastport==0:
         self.port=str(7000+os.getuid())
     else:
         self.port=bcastport
        
     self.procTx=None
     self.procRx=None
     self.handler=None
     self._callbacks = {'started':[],  'ended':[]}
     self.url=''
     self.dvd=False
     self.broadcasting=False
     self.myIP=NetworkUtils.get_ip_inet_address()
     self.codec_h264=self.is_h264_available()
Пример #5
0
    if not isTeacher:
        from twisted.internet import glib2reactor
        glib2reactor.install()
    from twisted.internet import reactor
    from twisted.web import server
    
    ######### Begin the application loop #######
    if  isTeacher:
        logging.getLogger().debug("The user is a teacher")
        from ControlAula import TeacherMainLoop, Classroom
        from ControlAula.Utils  import Publications

        NetworkUtils.getWirelessData()
        if MyUtils.isLTSPServer():
            externalIP = NetworkUtils.get_ip_inet_address(NetworkUtils.ltspGW())
        else:
            externalIP = NetworkUtils.get_ip_inet_address()
        if externalIP == '':
            externalIP = NetworkUtils.get_ip_inet_address('192.168.0.254')
        service = Publications.Publications(port = Configs.PORT, name = USERNAME + '@' + HOSTNAME, text = ["ipINET=" + externalIP, "web=" + str(Configs.PORT), "classroomname=" + Configs.RootConfigs['classroomname']])
        service_controlies = Publications.Publications(stype = "_controlaula._udp", port = Configs.PORT, name = USERNAME + '@' + HOSTNAME, text = ["ipINET=" + externalIP, "web=" + str(Configs.PORT), "classroomname=" + Configs.RootConfigs['classroomname']])
        service_controlies.publish()
        try:  # in case cache are filled with a previous "bad stopped" instance of controlaula
            service.unpublish()
            service_controlies.unpublish()
            sleep(0.1)
        except:
            pass

        #Initialize classroom data