示例#1
0
    async def get_device_info(self):
        # parse firmware version
        matches = re.search(self.VERSION_PATTERN,
                            self._command_list,
                            flags=re.MULTILINE)
        if matches:
            version = matches.group(1)
        else:
            raise SyntaxError("unable to find version string")

        # request serial
        self._writer.write(b"q\r")
        await self._writer.drain()
        serial = await self._reader.readuntil(b"?")
        serial = serial.decode()

        # parse serial
        matches = re.search(self.SERIAL_PATTERN, serial)
        if matches:
            serial = matches.group(1)
        else:
            raise SyntaxError("unable to find serial number")

        return DeviceInfo(version=version,
                          vendor="AA",
                          model="MDSnC",
                          serial_number=serial)
示例#2
0
 def info(self) -> DeviceInfo:
     self.handle.write(b"$HI\r")
     try:
         response = self.handle.read_until("\r").decode("utf-8")
         _, sn, name, _ = tuple(response.strip("* ").split())
     except (ValueError, UnicodeDecodeError):
         raise SyntaxError("unable to parse device info")
     return DeviceInfo(version=None,
                       vendor="Ophir",
                       model=name,
                       serial_number=sn)
示例#3
0
    def info(self):
        model = self.handle.get_stage_type().strip()
        model = model.split("=")[1]

        # extract info from parent
        parent_info = self.parent.info
        parms = {
            "vendor": parent_info.vendor,
            "model": model,
            "version": parent_info.version,
            "serial_number": parent_info.serial_number,
        }
        return DeviceInfo(**parms)
    async def get_device_info(self) -> DeviceInfo:
        params = {
            "version": Info.APIVersion,
            "vendor": Info.Vendor,
            "model": Info.Model,
            "serial_number": Info.CameraID,
        }
        for key, value in params.items():
            params[key] = await sync(self.api.get_string, value)

        # serial number requires further parsing
        parsed_sn = re.match(r"S/N: (\d+)", params["serial_number"]).group(1)
        params["serial_number"] = parsed_sn

        # DEBUG
        for option in (Capability.Region, Capability.FrameOption,
                       Capability.LUT):
            try:
                print(self.api.get_capability(option))
            except RuntimeError as err:
                logger.error(err)

        return DeviceInfo(**params)
示例#5
0
    def info(self):
        # extract info from *IDN?, since SSN? may not exist
        vendor, *args = self.desc_str.split(" ")
        sn = args[-1]

        return DeviceInfo(vendor=vendor, model="DAISY", version=None, serial_number=sn)
示例#6
0
 def info(self):
     response = self.handle.get_identification_string()
     vendor, model, sn, version = tuple(
         token.strip() for token in response.split(",")
     )
     return DeviceInfo(vendor=vendor, model=model, version=version, serial_number=sn)
示例#7
0
 def info(self):
     return DeviceInfo(version="0.0",
                       vendor="olive",
                       model=self.sample,
                       serial_number="DEADBEEF")