Exemplo n.º 1
0
 def getAttachedDevices(self):
     """Returns a list of Phidgets attached to the host computer.
     
     This list is updated right before the attach and detach events, and so will be up to date within these events.
     
     Returns:
         The list of attached phidgets <array of Phidget objects>.
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
         PhidgetException
     """
     devices = []
     count = c_int()
     listptr = pointer(c_void_p())
     
     try:
         result = PhidgetLibrary.getDll().CPhidgetManager_getAttachedDevices(self.handle, byref(listptr), byref(count))
     except RuntimeError:
         raise
     
     if result > 0:
             raise PhidgetException(result)
     
     for i in range(count.value):
         phid = Phidget()
         devicePtr = c_void_p(listptr[i])
         phid.handle = devicePtr
         devices.append(phid)
     
     return devices
Exemplo n.º 2
0
 def __nativeDetachEvent(self, handle, usrptr):
     phid = Phidget()
     phid.handle = handle
     if self.__detach != None:
         self.__detach(DetachEventArgs(phid))
     return 0