temp2.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import asyncio
  2. from mcu.capture.smart_shooter_class import SmartShooter
  3. smart = SmartShooter(None)
  4. async def parserProperty(CameraPropertyType=None):
  5. status, camera_property = await smart.GetCameraProperty()
  6. if CameraPropertyType:
  7. camera_property_obj = None
  8. for item in camera_property:
  9. if item['CameraPropertyType'] == CameraPropertyType:
  10. camera_property_obj = item
  11. break
  12. return camera_property_obj if camera_property_obj else camera_property
  13. return camera_property
  14. async def setCameraProperty(property="Aperture", value=""):
  15. await smart.setCameraProperty(property=property, value=value)
  16. async def main():
  17. '''
  18. Aperture:光圈
  19. ShutterSpeed:快门速度
  20. ISO:ISO设置
  21. Exposure:曝光
  22. "CameraPropertyType": 参数类型,
  23. "CameraPropertyValue": 当前值,
  24. "CameraPropertyIsWriteable": 是否可写,
  25. "CameraPropertyRange" 参数范围
  26. '''
  27. # camera_property = await parserProperty("Aperture")
  28. # print('property', camera_property)
  29. await setCameraProperty('Exposure', '5.0')
  30. if __name__ == "__main__":
  31. asyncio.run(main())