示例#1
0
    def GetDeviceDetails(self, sData, tSenderAddr):
        oRet = QueryDict()
        oRet.bFound = False
        oRet.sFoundIP = ""
        oRet.uFoundPort = ""
        oRet.uFoundModel = ""
        oRet.uFoundIdentifier = ""
        oRet.uFoundCategory = ""
        oRet.sData = ""

        if PY2:
            uResponse = sData[16:]
        else:
            uResponse = ToUnicode(sData)[16:]

        if uResponse.find('ECN') != -1:
            info = re.match(self.rMatch, uResponse.strip(),
                            re.VERBOSE).groupdict()
            uResponse = uResponse[10:]
            oRet.sFoundIP = tSenderAddr[0]
            oRet.uFoundPort = ToUnicode(info['iscp_port'])
            oRet.uFoundModel = info['model_name']
            oRet.uFoundIdentifier = info['identifier']
            oRet.uFoundCategory = ToUnicode(info['device_category'])
            oRet.sData = uResponse
            oRet.bFound = True
        return oRet
示例#2
0
    def ListDiscover(self):
        oSetting = self.GetSettingObjectForConfigName(
            uConfigName=self.uConfigName)
        fTimeOut = oSetting.aScriptIniSettings.fTimeOut
        dArgs = {}
        dArgs["onlyonce"] = 0

        self.Discover(**dArgs)

        try:

            for dResult in self.aResults:
                aDevice = QueryDict()
                aDevice.sFoundIP = dResult["ip"]
                aDevice.uFoundPort = str(dResult["port"])
                aDevice.uFoundModel = dResult["model"]
                aDevice.uFoundHostName = dResult["hostname"]
                Logger.info(u'Bingo: Discovered device %s:%s' %
                            (aDevice.uFoundModel, aDevice.sFoundIP))
                uTageLine = aDevice.sFoundIP + aDevice.uFoundModel
                if self.aDevices.get(uTageLine) is None:
                    self.aDevices[uTageLine] = aDevice
                    self.AddLine([
                        aDevice.sFoundIP, aDevice.uFoundHostName,
                        aDevice.uFoundPort, aDevice.uFoundModel
                    ], aDevice)
        except Exception as e:
            LogErrorSmall(u'Error on Enigma discover', e)
示例#3
0
 def GetDeviceDetails(self,sData,tSenderAddr):
     oRet                     = QueryDict()
     oRet.sFoundIP            = tSenderAddr[0]
     oRet.uFoundPort          = tSenderAddr[1]
     oRet.bFound              = True
     oRet.sData               = sData
     oRet.uIPVersion          = self.uIPVersion
     return oRet