def getDeviceName(self): """Return the name of this Phidget. This is a string that describes the device. For example, a PhidgetInterfaceKit could be described as "Phidget InterfaceKit 8/8/8", or "Phidget InterfaceKit 0/0/4", among others, depending on the specific device. This lets you determine the specific type of a Phidget, within the broader classes of Phidgets, such as PhidgetInterfaceKit, or PhidgetServo. Returns: The name of the device <string>. Exceptions: RuntimeError - If current platform is not supported/phidget c dll cannot be found PhidgetException: If this phidget is not opened or attached. """ ptr = c_char_p() try: result = PhidgetLibrary.getDll().CPhidget_getDeviceName(self.handle, byref(ptr)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(ptr)
def getServerAddress(self): """Returns the Address of a Phidget Webservice. Returns the Address of a Phidget Webservice when this Phidget was opened as remote. This may be an IP Address or a hostname. Returns: The Address of the Webservice <string>. Exceptions: RuntimeError - If current platform is not supported/phidget c dll cannot be found PhidgetException: if this Phidget was open opened as a remote Phidget. """ serverAddr = c_char_p() port = c_int() try: result = PhidgetLibrary.getDll().CPhidget_getServerAddress(self.handle, byref(serverAddr), byref(port)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(serverAddr)
def getErrorDescription(self, code): """ """ description = c_char_p() try: result = self.dll.CPhidget_getErrorDescription(c_int(code), byref(description)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(description)
def getErrorDescription(self, code): """ """ description = c_char_p() try: result = self.dll.CPhidget_getErrorDescription( c_int(code), byref(description)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(description)
def __init__(self, code): if sys.platform == 'win32': self.dll = windll.LoadLibrary("phidget21.dll") elif sys.platform == 'darwin': self.dll = cdll.LoadLibrary("/Library/Frameworks/Phidget21.framework/Versions/Current/Phidget21") elif sys.platform == 'linux2': self.dll = cdll.LoadLibrary("libphidget21.so.0") else: self.dll = None print("Platform not supported") if(self.dll != None): self.code = code description = c_char_p() result = self.dll.CPhidget_getErrorDescription(c_int(code), byref(description)) self.details = prepOutput(description)
def __init__(self, code): if sys.platform == 'win32': self.dll = windll.LoadLibrary("phidget21.dll") elif sys.platform == 'darwin': self.dll = cdll.LoadLibrary( "/Library/Frameworks/Phidget21.framework/Versions/Current/Phidget21" ) elif sys.platform == 'linux2': self.dll = cdll.LoadLibrary("libphidget21.so.0") else: self.dll = None print("Platform not supported") if (self.dll != None): self.code = code description = c_char_p() result = self.dll.CPhidget_getErrorDescription( c_int(code), byref(description)) self.details = prepOutput(description)
def getServerID(self): """Returns the Server ID of a Phidget Webservice. Returns the Server ID of a Phidget Webservice when this Phidget was opened as remote. This is an arbitrary server identifier, independant of IP address and Port. Returns: The ServerID of the Webservice <string>. Exceptions: RuntimeError - If current platform is not supported/phidget c dll cannot be found PhidgetException: if this Phidget was open opened as a remote Phidget. """ serverID = c_char_p() try: result = PhidgetLibrary.getDll().CPhidget_getServerID(self.handle, byref(serverID)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(serverID)
def getLibraryVersion(self): """Returns the library version. This is the library version of the underlying phidget21 C library and not the version of the Python wrapper module implementation. The version is retured as a string which contains the version number and build date. Returns: The Library Version <string>. Exceptions: RuntimeError - If current platform is not supported/phidget c dll cannot be found PhidgetException: If this Phidget is not opened and attached. """ libVer = c_char_p() try: result = PhidgetLibrary.getDll().CPhidget_getLibraryVersion(byref(libVer)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(libVer)
def getDeviceType(self): """Return the device type of this Phidget. This is a string that describes the device as a class of devices. For example, all PhidgetInterfaceKit Phidgets will returns the String "PhidgetInterfaceKit". Returns: The Device Type <string>. Exceptions: RuntimeError - If current platform is not supported/phidget c dll cannot be found PhidgetException: If there is no Phidget attached. """ ptr = c_char_p() try: result = PhidgetLibrary.getDll().CPhidget_getDeviceType(self.handle, byref(ptr)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(ptr)
def getDeviceLabel(self): """Gets the label associated with this Phidget. This label is a String - up to ten digits - that is stored in the Flash memory of newer Phidgets. This label can be set programatically (see setDeviceLabel), and is non-volatile - so it is remembered even if the Phidget is unplugged. Returns: The label associated with this Phidget <string>. Exceptions: RuntimeError - If current platform is not supported/phidget c dll cannot be found PhidgetException: If this Phidget is not opened and attached, or if this Phidget does not support labels. """ label = c_char_p() try: result = PhidgetLibrary.getDll().CPhidget_getDeviceLabel(self.handle, byref(label)) except RuntimeError: raise if result > 0: raise PhidgetException(result) else: return prepOutput(label)