How to know if supported
Before you call the temperature API. You need to use the IsQHYCCDControlAvailable API to check if the camera supports it. If QHYCCD_SUCCESS returned, it should support such a function. otherwise it does not support this function
//check if camera support to read the humidity sensor
ret = IsQHYCCDControlAvailable(h,CONTROL_HUMIDITY);
//check if camera support to read the pressure sensor
ret = IsQHYCCDControlAvailable(h,CONTROL_PRESSURE);
Get the value
There is two method to get the value .
(1)By using the GetQHYCCDParam API.
Please note this API return the double value. But if the camera has no sensor installed, it will return 0.0
humidity=GetQHYCCDParam(h,CONTROL_HUMIDITY); //humidity range is 0.0 to 100.0 , it is 0.0% to 100.0%
pressure=GetQHYCCDParam(h,CONTROL_PRESSURE); //pressure range is 0.0 to 2000.0, it is 0.0mbar to 2000.0mbar
(2)By using the standalone APIs
uint32_t STDCALL GetQHYCCDPressure(qhyccd_handle *handle, double *pressure);
uint32_t STDCALL GetQHYCCDHumidity(qhyccd_handle *handle, double *hd);
Please note the API return value is QHYCCD_SUCCESS or QHYCCD_ERROR. If it is QHYCCD_ERROR, it means the sensor is not detected by camera hardware. Although a camera supports these sensor, but some early version of the camera may have no the sensor installed. So it will return QHYCCD_ERROR. And because the camera will detect if there is the sensor after InitQHYCCD() API. So if you want to use the return value to detect if there is the sensor, need to call it after InitQHYCCD(). Otherwise it will always return QHYCCD_ERROR. If you do not care if there is the sensor installed. You can just ignore the returned value. When in this case, you will get value of 0.0 for pressure or humidity.
ret=GetQHYCCDHumidity(h,&humidity); //humidity range is 0.0 to 100.0 , it is 0.0% to 100.0%
ret=GetQHYCCDPressure(h,&pressure); //pressure range is 0.0 to 2000.0, it is 0.0mbar to 2000.0mbar
You can call those APIs serval seconds periodically. Since the humidity and pressure is a slow changed value. So it is no necessary to call it too fast to reduce the communication between host computer and camera. for example,each 2-5 seconds call once it good.