33 #include <libphidget22/phidget22.h>
41 bool is_hub_port_device,
42 std::function<
void(
double)> temperature_handler)
43 : temperature_handler_(temperature_handler)
45 PhidgetReturnCode ret =
47 if (ret != EPHIDGET_OK)
49 throw Phidget22Error(
"Failed to create TemperatureSensor handle", ret);
54 hub_port, is_hub_port_device, 0);
56 ret = PhidgetTemperatureSensor_setOnTemperatureChangeHandler(
58 if (ret != EPHIDGET_OK)
60 throw Phidget22Error(
"Failed to set change handler for Temperature",
73 PhidgetReturnCode ret = PhidgetTemperatureSensor_setThermocoupleType(
75 static_cast<PhidgetTemperatureSensor_ThermocoupleType
>(type));
76 if (ret != EPHIDGET_OK)
78 throw Phidget22Error(
"Failed to set Temperature thermocouple type",
85 double current_temperature;
86 PhidgetReturnCode ret = PhidgetTemperatureSensor_getTemperature(
88 if (ret != EPHIDGET_OK)
92 return current_temperature;
97 PhidgetReturnCode ret = PhidgetTemperatureSensor_setDataInterval(
99 if (ret != EPHIDGET_OK)
111 PhidgetTemperatureSensorHandle ,
void *ctx,
114 ((
Temperature *)ctx)->temperatureChangeHandler(temperature);