Printing the value returned by the AysncHandler result value gives a byte string:
Code: Select all
b'Success'
Code: Select all
from Phidget22.Phidget import *
from Phidget22.Devices.DigitalOutput import *
from Phidget22.ErrorCode import *
from Phidget22.Net import *
import time
Net.addServer('phidget',
'phidget.localdomain',
5661,
'',
0)
ch = DigitalOutput()
ch.setDeviceSerialNumber(123456)
ch.setHubPort(0)
ch.setIsRemote(True)
ch.setIsHubPortDevice(False)
ch.setChannel(0)
ch.openWaitForAttachment(1000)
def AsyncResult(ch, res, details):
# if res != ErrorCode.EPHIDGET_OK:
print("Async results: %i : %s" % (res, details))
ch.setState_async(False, AsyncResult)
# NOTE: Make sure to wait for async call to complete before closing the channel
time.sleep(1)
ch.close()