def get_dict(self):
r = {}
for k, _ in self._fields_:
v = getattr(self, k)
if sys.version_info[0] >= 3 and isinstance(v, bytes):
v = v.decode()
r[k] = v
del r['Unused']
r['SupportedBins'] = []
for i in range(len(self.SupportedBins)):
if self.SupportedBins[i]:
r['SupportedBins'].append(self.SupportedBins[i])
else:
break
r['SupportedVideoFormat'] = []
for i in range(len(self.SupportedVideoFormat)):
if self.SupportedVideoFormat[i] == ASI_IMG_END:
break
r['SupportedVideoFormat'].append(self.SupportedVideoFormat[i])
for k in ('IsColorCam', 'MechanicalShutter', 'IsCoolerCam',
'IsUSB3Host', 'IsUSB3Camera'):
r[k] = bool(getattr(self, k))
return r
评论列表
文章目录