def parse_sys_ver(self, sys_ver): """ Given the camera system version as a string, parse into what we show, which is the last 2 digits """ self.full_sys_ver = str(sys_ver) vnums = self.full_sys_ver.split(".") if len(vnums) == 4: self.l_debug( "parse_sys_ver", "{0} 0={1} 1={2} 2={3} 3={4}".format(sys_ver, vnums[0], vnums[1], vnums[2], vnums[3])) self.sys_s_ver = myfloat("%d.%d" % (int(vnums[0]), int(vnums[1])), 2) self.sys_e_ver = myfloat("%d.%d" % (int(vnums[2]), int(vnums[3])), 2) self.l_debug( "parse_sys_ver", "sys_s_ver={} sys_e_ver".format(self.sys_s_ver, self.sys_e_ver)) else: self.l_waning("parse_sys_ver", "Unknown sys_Ver{}".format(sys_ver)) self.sys_s_ver = None self.sys_e_ver = None
def query(self, **kwargs): """ query the camera """ # pylint: disable=unused-argument self.l_info("query","start") self._get_status() if self.connected == 1: # Full System Version self.full_sys_ver = self.camera.software_information[0].split('=')[1].decode('utf-8'); sys_ver_l = self.full_sys_ver.split('.') # Just the first part as a float self.sys_ver = myfloat("{0}.{1}".format(sys_ver_l[0],sys_ver_l[1])) self.set_driver('GV1', self.sys_ver, uom=56) # Initialize network info self.ip_address = get_network_ip(self.host) self.set_driver('GV2', ip2long(self.ip_address), uom=56, report=False) self.set_driver('GV3', self.port, uom=56, report=False) # Motion self.set_driver('GV5', bool2int(self.camera.is_motion_detector_on()), uom=2) self._get_motion_params() self.set_driver('GV6', self.record_enable, uom=2) self.set_driver('GV7', self.mail_enable, uom=2) self.set_driver('GV8', self.snapshot_enable, uom=2) self.set_driver('GV9', self.snapshot_times, uom=56) # All done. self.report_driver() self.l_info("query","done") return True
def query(self): """ query the camera """ # pylint: disable=unused-argument self.l_info("query", "start") self.get_status() if self.st: # Full System Version self.full_sys_ver = str_d( self.camera.software_information[0].split('=')[1]) sys_ver_l = self.full_sys_ver.split('.') # Just the first part as a float self.sys_ver = myfloat("{0}.{1}".format(sys_ver_l[0], sys_ver_l[1])) self.setDriver('GV1', self.sys_ver) # Initialize network info # Motion self.setDriver('GV5', bool2int(self.camera.is_motion_detector_on())) self.get_motion_params() self.setDriver('GV6', self.record_enable) self.setDriver('GV7', self.mail_enable) self.setDriver('GV8', self.snapshot_enable) self.setDriver('GV9', self.snapshot_times) # All done. self.reportDrivers() self.l_info("query", "done") return True
def _parse_sys_ver(self,sys_ver): """ Given the camera system version as a string, parse into what we show, which is the last 2 digits """ vnums = sys_ver.split(".") self.parent.logger.debug("FoscamHD2:parse_sys_ver: %s 0=%s 1=%s 2=%s 3=%s",sys_ver,vnums[0],vnums[1],vnums[2],vnums[3]) ver = myfloat("%d.%d" % (int(vnums[2]),int(vnums[3])),2) self.parent.logger.debug("FoscamHD2:parse_sys_ver: ver=%f",ver) return ver