Calling getAttached() in attach handler
Posted: Sun Sep 19, 2021 12:34 pm
I was troubleshooting an issue with setting the RTD type of a temperature sensor in the attach handler. In the process I discovered calling getAttached() on the channel gives a False result. If the attach handler is called then the channel should be attached, right? It appears that maybe the attached status is updated after the attach handler is called since it later calls give a True result.
It seems strange that one would call getAttached() from the attach handler, but I was getting an exception when trying to set the RTD from the attach handler.
It seems strange that one would call getAttached() from the attach handler, but I was getting an exception when trying to set the RTD from the attach handler.
Code: Select all
Phidget22.PhidgetException.PhidgetException: PhidgetException 0x34 (Device not Attached)
This can happen for a number of common reasons. Be sure you are opening the channel before trying to use it. If you are opening the channel, the program may not be waiting for the channel to be attached. If possible use openWaitForAttachment. Otherwise, be sure to check the Attached property of the channel before trying to use it.