Esempio n. 1
0
File: IR.py Progetto: Jak23/modular
 def __init__(self):
     """The Constructor Method for the Accelerometer Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__IRCodeDelegate = None;
     self.__IRLearnDelegate = None;
     self.__IRRawDataDelegate = None;
     
     self.__onIRCodeHandler = None;
     self.__onIRLearnHandler = None;
     self.__onIRRawDataHandler = None;
     
     try:
         PhidgetLibrary.getDll().CPhidgetIR_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__IRCODEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, c_int, c_int)
         self.__IRLEARNHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, POINTER(CPhidgetIR_CodeInfo))
         self.__IRRAWDATAHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_int), c_int)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__IRCODEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, c_int, c_int)
         self.__IRLEARNHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, POINTER(CPhidgetIR_CodeInfo))
         self.__IRRAWDATAHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_int), c_int)
Esempio n. 2
0
 def __init__(self):
     """The Constructor Method for the Encoder Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
         PhidgetException: If this Phidget is not opened.
     """
     Phidget.__init__(self)
     
     self.__inputChange = None
     self.__positionChange = None
     
     self.__onInputChange = None
     self.__onPositionChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetEncoder_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__INPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
     elif sys.platform == 'darwin' or sys.platform.startswith('linux'):
         self.__INPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
Esempio n. 3
0
 def __init__(self):
     """The Constructor Method for the InterfaceKit Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
         PhidgetException: If this Phidget is not opened.
     """
     Phidget.__init__(self)
     
     self.__inputChange = None
     self.__outputChange = None
     self.__sensorChange = None
     
     self.__onInputChange = None
     self.__onSensorChange = None
     self.__onOutputChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetInterfaceKit_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__INPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__OUTPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__SENSORCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
     elif sys.platform == 'darwin' or sys.platform.startswith('linux'):
         self.__INPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__OUTPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__SENSORCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
Esempio n. 4
0
 def __init__(self):
     """The Constructor Method for the Accelerometer Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__numAccelAxes = 0;
     self.__numGyroAxes = 0;
     self.__numCompassAxes = 0;
     
     self.__attach = None
     self.__spatialData = None;
     
     self.__onAttach = None
     self.__onSpatialData = None;
     
     try:
         PhidgetLibrary.getDll().CPhidgetSpatial_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__ATTACHHANDLER = WINFUNCTYPE(c_long, c_void_p, c_void_p)
         self.__SPATIALDATAHANDLER = WINFUNCTYPE(c_long, c_void_p, c_void_p, POINTER(c_long), c_long)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__ATTACHHANDLER = CFUNCTYPE(c_long, c_void_p, c_void_p)
         self.__SPATIALDATAHANDLER = CFUNCTYPE(c_long, c_void_p, c_void_p, POINTER(c_long), c_long)
Esempio n. 5
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
Esempio n. 6
0
 def __init__(self):
     """The Constructor Method for the Stepper Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__inputChange = None
     self.__velocityChange = None
     self.__positionChange = None
     self.__currentChange = None
     
     self.__onInputChange = None
     self.__onVelocityChange = None
     self.__onPositionChange = None
     self.__onCurrentChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetStepper_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__INPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__VELOCITYCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_longlong)
         self.__CURRENTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__INPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__VELOCITYCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_longlong)
         self.__CURRENTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 7
0
 def __init__(self):
     """The Constructor Method for the RFID Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__outputChange = None
     self.__tagGain = None
     self.__tagLoss = None
     
     self.__onTagHandler = None
     self.__onTagLostHandler = None
     self.__onOutputChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetRFID_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__OUTPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__TAGHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_char_p, c_int)
         self.__TAGLOSTHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_char_p, c_int)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__OUTPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__TAGHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_char_p, c_int)
         self.__TAGLOSTHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_char_p, c_int)
 def __init__(self):
     """The Constructor Method for the AdvancedServo Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__currentChange = None
     self.__positionChange = None
     self.__velocityChange = None
     
     self.__onCurrentChange = None
     self.__onPositionChange = None
     self.__onVelocityChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetAdvancedServo_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__CURRENTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__VELOCITYCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__CURRENTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__VELOCITYCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 9
0
 def __init__(self):
     """The Constructor Method for the RFID Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     hexArray = c_char*16
     self.__hexLookup = hexArray(b'0', b'1', b'2', b'3', b'4',
         b'5', b'6', b'7', b'8', b'9', b'A', b'B', b'C', b'D', b'E', b'F')
     
     self.__outputChange = None
     self.__tagGain = None
     self.__tagLoss = None
     
     self.__onTagHandler = None
     self.__onTagLostHandler = None
     self.__onOutputChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetRFID_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__OUTPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__TAGHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte))
         self.__TAGLOSTHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte))
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__OUTPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__TAGHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte))
         self.__TAGLOSTHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte))
Esempio n. 10
0
 def __init__(self):
     """The Constructor Method for the InterfaceKit Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
         PhidgetException: If this Phidget is not opened.
     """
     Phidget.__init__(self)
     
     self.__inputChange = None
     self.__outputChange = None
     self.__sensorChange = None
     
     self.__onInputChange = None
     self.__onSensorChange = None
     self.__onOutputChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetInterfaceKit_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__INPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__OUTPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__SENSORCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__INPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__OUTPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__SENSORCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
Esempio n. 11
0
    def __init__(self):
        """The Constructor Method for the GPS Class

        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__positionChangeDelegate = None
        self.__positionFixStatusChangeDelegate = None

        self.__onPositionChangeHandler = None
        self.__onPositionFixStatusChangeHandler = None

        try:
            PhidgetLibrary.getDll().CPhidgetGPS_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__POSITIONCHANGEHANDLER = ctypes.WINFUNCTYPE(
                c_int, c_void_p, c_void_p, c_double, c_double, c_double)
            self.__POSITIONFIXSTATUSCHANGEHANDLER = ctypes.WINFUNCTYPE(
                c_int, c_void_p, c_void_p, c_int)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__POSITIONCHANGEHANDLER = ctypes.CFUNCTYPE(
                c_int, c_void_p, c_void_p, c_double, c_double, c_double)
            self.__POSITIONFIXSTATUSCHANGEHANDLER = ctypes.CFUNCTYPE(
                c_int, c_void_p, c_void_p, c_int)
Esempio n. 12
0
    def __init__(self):
        """The Constructor Method for the Accelerometer Class
        
        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__numAccelAxes = 0
        self.__numGyroAxes = 0
        self.__numCompassAxes = 0

        self.__attach = None
        self.__spatialData = None

        self.__onAttach = None
        self.__onSpatialData = None

        try:
            PhidgetLibrary.getDll().CPhidgetSpatial_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__ATTACHHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p)
            self.__SPATIALDATAHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p,
                                                    POINTER(c_long), c_int)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__ATTACHHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p)
            self.__SPATIALDATAHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p,
                                                  POINTER(c_long), c_int)
Esempio n. 13
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
Esempio n. 14
0
File: GPS.py Progetto: cyface/boxbot
    def __init__(self):
        """The Constructor Method for the GPS Class

        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__positionChangeDelegate = None;
        self.__positionFixStatusChangeDelegate = None;

        self.__onPositionChangeHandler = None;
        self.__onPositionFixStatusChangeHandler = None;

        try:
            PhidgetLibrary.getDll().CPhidgetGPS_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__POSITIONCHANGEHANDLER = ctypes.WINFUNCTYPE(c_int, c_void_p, c_void_p, c_double, c_double, c_double)
            self.__POSITIONFIXSTATUSCHANGEHANDLER = ctypes.WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__POSITIONCHANGEHANDLER = ctypes.CFUNCTYPE(c_int, c_void_p, c_void_p, c_double, c_double, c_double)
            self.__POSITIONFIXSTATUSCHANGEHANDLER = ctypes.CFUNCTYPE(c_int, c_void_p, c_void_p, c_int)
Esempio n. 15
0
    def __init__(self):
        """The Constructor Method for the RFID Class
        
        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__outputChange = None
        self.__tagGain = None
        self.__tagLoss = None

        self.__onTagHandler = None
        self.__onTagLostHandler = None
        self.__onOutputChange = None

        try:
            PhidgetLibrary.getDll().CPhidgetRFID_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__OUTPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p,
                                                     c_int, c_int)
            self.__TAG2HANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p,
                                             c_char_p, c_int)
            self.__TAGLOST2HANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p,
                                                 c_char_p, c_int)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__OUTPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p,
                                                   c_int, c_int)
            self.__TAG2HANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_char_p,
                                           c_int)
            self.__TAGLOST2HANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p,
                                               c_char_p, c_int)
Esempio n. 16
0
 def __init__(self):
     """The Constructor Method for the Accelerometer Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__IRCodeDelegate = None;
     self.__IRLearnDelegate = None;
     self.__IRRawDataDelegate = None;
     
     self.__onIRCodeHandler = None;
     self.__onIRLearnHandler = None;
     self.__onIRRawDataHandler = None;
     
     try:
         PhidgetLibrary.getDll().CPhidgetIR_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__IRCODEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, c_int, c_int)
         self.__IRLEARNHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, POINTER(CPhidgetIR_CodeInfo))
         self.__IRRAWDATAHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_int), c_int)
     elif sys.platform == 'darwin' or sys.platform.startswith('linux'):
         self.__IRCODEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, c_int, c_int)
         self.__IRLEARNHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_ubyte), c_int, POINTER(CPhidgetIR_CodeInfo))
         self.__IRRAWDATAHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, POINTER(c_int), c_int)
Esempio n. 17
0
    def __init__(self):
        """The Constructor Method for the Encoder Class
        
        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
            PhidgetException: If this Phidget is not opened.
        """
        Phidget.__init__(self)

        self.__inputChange = None
        self.__positionChange = None

        self.__onInputChange = None
        self.__onPositionChange = None

        try:
            PhidgetLibrary.getDll().CPhidgetEncoder_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__INPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p,
                                                    c_int, c_int)
            self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p,
                                                       c_void_p, c_int, c_int,
                                                       c_int)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__INPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p,
                                                  c_int, c_int)
            self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p,
                                                     c_int, c_int, c_int)
Esempio n. 18
0
 def __init__(self):
     """The Constructor Method for the TextLCD Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     try:
         PhidgetLibrary.getDll().CPhidgetTextLCD_create(byref(self.handle))
     except RuntimeError:
         raise
Esempio n. 19
0
 def __init__(self):
     """The Constructor Method for the MotorControl Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__inputChange = None
     self.__velocityChange = None
     self.__currentChange = None
     self.__currentUpdate = None
     self.__positionChange = None
     self.__positionUpdate = None
     self.__sensorUpdate = None
     self.__backEMFUpdate = None
     
     self.__onInputChange = None
     self.__onVelocityChange = None
     self.__onCurrentChange = None
     self.__onCurrentUpdate = None
     self.__onPositionChange = None
     self.__onPositionUpdate = None
     self.__onSensorUpdate = None
     self.__onBackEMFUpdate = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetMotorControl_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__INPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__VELOCITYCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__CURRENTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__CURRENTUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
         self.__POSITIONUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__SENSORUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__BACKEMFUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
     elif sys.platform == 'darwin' or sys.platform.startswith('linux'):
         self.__INPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__VELOCITYCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__CURRENTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__CURRENTUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
         self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
         self.__POSITIONUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__SENSORUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
         self.__BACKEMFUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 20
0
    def __init__(self):
        """The Constructor Method for the MotorControl Class
        
        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__inputChange = None
        self.__velocityChange = None
        self.__currentChange = None
        self.__currentUpdate = None
        self.__positionChange = None
        self.__positionUpdate = None
        self.__sensorUpdate = None
        self.__backEMFUpdate = None

        self.__onInputChange = None
        self.__onVelocityChange = None
        self.__onCurrentChange = None
        self.__onCurrentUpdate = None
        self.__onPositionChange = None
        self.__onPositionUpdate = None
        self.__onSensorUpdate = None
        self.__onBackEMFUpdate = None

        try:
            PhidgetLibrary.getDll().CPhidgetMotorControl_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == "win32":
            self.__INPUTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
            self.__VELOCITYCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
            self.__CURRENTCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
            self.__CURRENTUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
            self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
            self.__POSITIONUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
            self.__SENSORUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
            self.__BACKEMFUPDATEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
        elif sys.platform == "darwin" or sys.platform == "linux2":
            self.__INPUTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
            self.__VELOCITYCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
            self.__CURRENTCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
            self.__CURRENTUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
            self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
            self.__POSITIONUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
            self.__SENSORUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int)
            self.__BACKEMFUPDATEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 21
0
    def closeDictionary(self):
        """Closes this Dictionary.
        
        This will shut down all threads dealing with this Dictionary and you won't recieve any more events.
        
        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
            PhidgetException: If this Dictionary is not opened.
        """

        try:
            result = PhidgetLibrary.getDll().CPhidgetDictionary_close(
                self.handle)
        except RuntimeError:
            raise

        if result > 0:
            description = Phidget.getErrorDescription(result)
            raise PhidgetException(result, description)
        else:
            try:
                result = PhidgetLibrary.getDll().CPhidgetDictionary_delete(
                    self.handle)
            except RuntimeError:
                raise

            if result > 0:
                raise PhidgetException(result)
Esempio n. 22
0
 def closeDictionary(self):
     """Closes this Dictionary.
     
     This will shut down all threads dealing with this Dictionary and you won't recieve any more events.
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
         PhidgetException: If this Dictionary is not opened.
     """
     
     try:
         result = PhidgetLibrary.getDll().CPhidgetDictionary_close(self.handle)
     except RuntimeError:
         raise
     
     if result > 0:
         description = Phidget.getErrorDescription(result)
         raise PhidgetException(result, description)
     else:
         try:
             result = PhidgetLibrary.getDll().CPhidgetDictionary_delete(self.handle)
         except RuntimeError:
             raise
         
         if result > 0:
             raise PhidgetException(result)
Esempio n. 23
0
 def __init__(self):
     """The Constructor Method for the PHSensor Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__phChange = None
     
     self.__onPhChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetPHSensor_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__PHCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_double)
     elif sys.platform == 'darwin' or sys.platform.startswith('linux'):
         self.__PHCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_double)
Esempio n. 24
0
    def __init__(self):
        """The Constructor Method for the Bridge Class

        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__bridgeDataDelegate = None

        self.__onBridgeDataHandler = None

        try:
            PhidgetLibrary.getDll().CPhidgetBridge_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__BRIDGEDATAHANDLER = ctypes.WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__BRIDGEDATAHANDLER = ctypes.CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 25
0
    def __init__(self):
        """The Constructor Method for the Servo Class
        
        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__positionChange = None

        self.__onPositionChange = None

        try:
            PhidgetLibrary.getDll().CPhidgetServo_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == "win32":
            self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
        elif sys.platform == "darwin" or sys.platform == "linux2":
            self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
    def __init__(self):
        """The Constructor Method for the FrequencyCounter Class

        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__frequencyCountDelegate = None

        self.__onFrequencyCountHandlerHandler = None

        try:
            PhidgetLibrary.getDll().CPhidgetFrequencyCounter_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__FREQUENCYCOUNTHANDLER = ctypes.WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__FREQUENCYCOUNTHANDLER = ctypes.CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_int, c_int)
Esempio n. 27
0
 def __init__(self):
     """The Constructor Method for the TemperatureSensor Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__tempChange = None
     
     self.__onTemperatureChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetTemperatureSensor_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__TEMPCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__TEMPCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 28
0
    def __init__(self):
        """The Constructor Method for the Bridge Class

        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__bridgeDataDelegate = None

        self.__onBridgeDataHandler = None

        try:
            PhidgetLibrary.getDll().CPhidgetBridge_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__BRIDGEDATAHANDLER = ctypes.WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
        elif sys.platform == 'darwin' or sys.platform == 'linux2':
            self.__BRIDGEDATAHANDLER = ctypes.CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 29
0
 def __init__(self):
     """The Constructor Method for the Accelerometer Class
     
     Exceptions:
         RuntimeError - If current platform is not supported/phidget c dll cannot be found
     """
     Phidget.__init__(self)
     
     self.__accelChange = None
     
     self.__onAccelChange = None
     
     try:
         PhidgetLibrary.getDll().CPhidgetAccelerometer_create(byref(self.handle))
     except RuntimeError:
         raise
     
     if sys.platform == 'win32':
         self.__ACCELCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
     elif sys.platform == 'darwin' or sys.platform == 'linux2':
         self.__ACCELCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int, c_double)
Esempio n. 30
0
    def __init__(self):
        """The Constructor Method for the Servo Class
        
        Exceptions:
            RuntimeError - If current platform is not supported/phidget c dll cannot be found
        """
        Phidget.__init__(self)

        self.__positionChange = None

        self.__onPositionChange = None

        try:
            PhidgetLibrary.getDll().CPhidgetServo_create(byref(self.handle))
        except RuntimeError:
            raise

        if sys.platform == 'win32':
            self.__POSITIONCHANGEHANDLER = WINFUNCTYPE(c_int, c_void_p,
                                                       c_void_p, c_int,
                                                       c_double)
        elif sys.platform == 'darwin' or sys.platform.startswith('linux'):
            self.__POSITIONCHANGEHANDLER = CFUNCTYPE(c_int, c_void_p, c_void_p,
                                                     c_int, c_double)
Esempio n. 31
0
 def __del__(self):
     """The Destructor Method for the FrequencyCounter Class
     """
     Phidget.dispose(self)
Esempio n. 32
0
 def __nativeAttachEvent(self, handle, usrptr):
     phid = Phidget()
     phid.handle = handle
     if self.__attach != None:
         self.__attach(AttachEventArgs(phid))
     return 0
Esempio n. 33
0
 def __del__(self):
     """The Destructor Method for the GPS Class
     """
     Phidget.dispose(self)
 def __del__(self):
     """The Destructor Method for the FrequencyCounter Class
     """
     Phidget.dispose(self)
Esempio n. 35
0
 def __nativeDetachEvent(self, handle, usrptr):
     phid = Phidget()
     phid.handle = c_void_p(handle)
     if self.__detach != None:
         self.__detach(DetachEventArgs(phid))
     return 0
 def __del__(self):
     """The Destructor Method for the TemperatureSensor Class
     """
     Phidget.dispose(self)
Esempio n. 37
0
 def __del__(self):
     """The Destructor Method for the TemperatureSensor Class
     """
     Phidget.dispose(self)
 def __del__(self):
     """The Destructor Method for the AdvancedServo Class
     """
     Phidget.dispose(self)
Esempio n. 39
0
 def __del__(self):
     """The Destructor Method for the AdvancedServo Class
     """
     Phidget.dispose(self)
Esempio n. 40
0
 def __del__(self):
     """The Destructor Method for the InterfaceKit Class
     """
     Phidget.dispose(self)
Esempio n. 41
0
 def __del__(self):
     """The Destructor Method for the InterfaceKit Class
     """
     Phidget.dispose(self)
Esempio n. 42
0
 def __del__(self):
     """The Destructor Method for the Accelerometer Class
     """
     Phidget.dispose(self)
Esempio n. 43
0
File: GPS.py Progetto: cyface/boxbot
 def __del__(self):
     """The Destructor Method for the GPS Class
     """
     Phidget.dispose(self)
Esempio n. 44
0
 def __del__(self):
     """The Destructor Method for the MotorControl Class
     """
     Phidget.dispose(self)
Esempio n. 45
0
 def __nativeDetachEvent(self, handle, usrptr):
     phid = Phidget()
     phid.handle = c_void_p(handle)
     if self.__detach != None:
         self.__detach(DetachEventArgs(phid))
     return 0
Esempio n. 46
0
 def __nativeAttachEvent(self, handle, usrptr):
     phid = Phidget()
     phid.handle = handle
     if self.__attach != None:
         self.__attach(AttachEventArgs(phid))
     return 0
Esempio n. 47
0
 def __del__(self):
     """The Destructor Method for the Accelerometer Class
     """
     Phidget.dispose(self)
Esempio n. 48
0
 def __del__(self):
     """The Destructor Method for the MotorControl Class
     """
     Phidget.dispose(self)