Ejemplo n.º 1
0
    def writeBitmap(self, xPosition, yPosition, xSize, ySize, bitmap):
        _xPosition = ctypes.c_int(xPosition)
        _yPosition = ctypes.c_int(yPosition)
        _xSize = ctypes.c_int(xSize)
        _ySize = ctypes.c_int(ySize)
        _bitmap = (ctypes.c_uint8 * len(bitmap))(*bitmap)

        __func = PhidgetSupport.getDll().PhidgetLCD_writeBitmap
        __func.restype = ctypes.c_int32
        result = __func(self.handle, _xPosition, _yPosition, _xSize, _ySize,
                        ctypes.byref(_bitmap))

        if result > 0:
            raise PhidgetException(result)
Ejemplo n.º 2
0
    def transmit(self, code, codeInfo):
        _code = ctypes.create_string_buffer(code.encode('utf-8'))
        _codeInfo = codeInfo.fromPython()

        try:
            __func = PhidgetSupport.getDll().PhidgetIR_transmit
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_code),
                            ctypes.byref(_codeInfo))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)
Ejemplo n.º 3
0
    def getAntennaEnabled(self):
        _AntennaEnabled = ctypes.c_int()

        try:
            __func = PhidgetSupport.getDll().PhidgetRFID_getAntennaEnabled
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_AntennaEnabled))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _AntennaEnabled.value
Ejemplo n.º 4
0
	def getMinTorque(self):
		_MinTorque = ctypes.c_double()

		try:
			__func = PhidgetSupport.getDll().PhidgetRCServo_getMinTorque
			__func.restype = ctypes.c_int32
			result = __func(self.handle, ctypes.byref(_MinTorque))
		except RuntimeError:
			raise

		if result > 0:
			raise PhidgetException(result)

		return _MinTorque.value
Ejemplo n.º 5
0
	def getVoltage(self):
		_Voltage = ctypes.c_int()

		try:
			__func = PhidgetSupport.getDll().PhidgetRCServo_getVoltage
			__func.restype = ctypes.c_int32
			result = __func(self.handle, ctypes.byref(_Voltage))
		except RuntimeError:
			raise

		if result > 0:
			raise PhidgetException(result)

		return _Voltage.value
Ejemplo n.º 6
0
    def log(level, source, str):
        _level = ctypes.c_int(level)
        _source = ctypes.create_string_buffer(source.encode('utf-8'))
        _str = ctypes.create_string_buffer(str.encode('utf-8'))

        try:
            __func = PhidgetSupport.getDll().PhidgetLog_log
            __func.restype = ctypes.c_int32
            result = __func(_level, ctypes.byref(_source), ctypes.byref(_str))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)
Ejemplo n.º 7
0
	def getIsMoving(self):
		_IsMoving = ctypes.c_int()

		try:
			__func = PhidgetSupport.getDll().PhidgetRCServo_getIsMoving
			__func.restype = ctypes.c_int32
			result = __func(self.handle, ctypes.byref(_IsMoving))
		except RuntimeError:
			raise

		if result > 0:
			raise PhidgetException(result)

		return _IsMoving.value
Ejemplo n.º 8
0
    def getRescaleFactor(self):
        _RescaleFactor = ctypes.c_double()

        try:
            __func = PhidgetSupport.getDll().PhidgetBLDCMotor_getRescaleFactor
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_RescaleFactor))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _RescaleFactor.value
Ejemplo n.º 9
0
    def getMaxVelocity(self):
        _MaxVelocity = ctypes.c_double()

        try:
            __func = PhidgetSupport.getDll().PhidgetBLDCMotor_getMaxVelocity
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_MaxVelocity))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _MaxVelocity.value
Ejemplo n.º 10
0
    def scan(self, start):
        _start = ctypes.create_string_buffer(start.encode('utf-8'))
        _keyList = (ctypes.c_char * 65536)()
        _keyListLen = ctypes.c_int32(65536)

        __func = PhidgetSupport.getDll().PhidgetDictionary_scan
        __func.restype = ctypes.c_int32
        result = __func(self.handle, ctypes.byref(_start),
                        ctypes.byref(_keyList), _keyListLen)

        if result > 0:
            raise PhidgetException(result)

        return _keyList.value.decode('utf-8')
Ejemplo n.º 11
0
    def getIlluminance(self):
        _Illuminance = ctypes.c_double()

        try:
            __func = PhidgetSupport.getDll().PhidgetLightSensor_getIlluminance
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_Illuminance))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _Illuminance.value
Ejemplo n.º 12
0
    def get(self, key):
        _key = ctypes.create_string_buffer(key.encode('utf-8'))
        _value = (ctypes.c_char * 65536)()
        _valueLen = ctypes.c_int32(65536)

        __func = PhidgetSupport.getDll().PhidgetDictionary_get
        __func.restype = ctypes.c_int32
        result = __func(self.handle, ctypes.byref(_key), ctypes.byref(_value),
                        _valueLen)

        if result > 0:
            raise PhidgetException(result)

        return _value.value.decode('utf-8')
Ejemplo n.º 13
0
    def getPowerSupply(self):
        _PowerSupply = ctypes.c_int()

        try:
            __func = PhidgetSupport.getDll().PhidgetDigitalInput_getPowerSupply
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_PowerSupply))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _PowerSupply.value
Ejemplo n.º 14
0
    def getInputMode(self):
        _InputMode = ctypes.c_int()

        try:
            __func = PhidgetSupport.getDll().PhidgetDigitalInput_getInputMode
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_InputMode))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _InputMode.value
Ejemplo n.º 15
0
    def isRotating():
        _isrotating = ctypes.c_int()

        try:
            __func = PhidgetSupport.getDll().PhidgetLog_isRotating
            __func.restype = ctypes.c_int32
            result = __func(ctypes.byref(_isrotating))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _isrotating.value
Ejemplo n.º 16
0
    def setMagneticFieldChangeTrigger(self, MagneticFieldChangeTrigger):
        _MagneticFieldChangeTrigger = ctypes.c_double(
            MagneticFieldChangeTrigger)

        try:
            __func = PhidgetSupport.getDll(
            ).PhidgetMagnetometer_setMagneticFieldChangeTrigger
            __func.restype = ctypes.c_int32
            result = __func(self.handle, _MagneticFieldChangeTrigger)
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)
Ejemplo n.º 17
0
    def getLevel():
        _level = ctypes.c_int()

        try:
            __func = PhidgetSupport.getDll().PhidgetLog_getLevel
            __func.restype = ctypes.c_int32
            result = __func(ctypes.byref(_level))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _level.value
Ejemplo n.º 18
0
 def _localDetachEvent(self, handle, userPtr, Channel):
     if self._Detach == None:
         return
     try:
         __func = PhidgetSupport.getDll().Phidget_retain
         __func.restype = ctypes.c_int32
         result = __func(ctypes.c_void_p(Channel))
     except RuntimeError:
         raise
     if result > 0:
         raise PhidgetException(result)
     ph = Phidget()
     ph.handle = ctypes.c_void_p(Channel)
     self._Detach(self, ph)
Ejemplo n.º 19
0
	def getMaxDataInterval(self):
		_MaxDataInterval = ctypes.c_uint32()

		try:
			__func = PhidgetSupport.getDll().PhidgetRCServo_getMaxDataInterval
			__func.restype = ctypes.c_int32
			result = __func(self.handle, ctypes.byref(_MaxDataInterval))
		except RuntimeError:
			raise

		if result > 0:
			raise PhidgetException(result)

		return _MaxDataInterval.value
Ejemplo n.º 20
0
    def addServer(serverName, address, port, password, flags):
        _serverName = ctypes.create_string_buffer(serverName.encode('utf-8'))
        _address = ctypes.create_string_buffer(address.encode('utf-8'))
        _port = ctypes.c_int(port)
        _password = ctypes.create_string_buffer(password.encode('utf-8'))
        _flags = ctypes.c_int(flags)

        __func = PhidgetSupport.getDll().PhidgetNet_addServer
        __func.restype = ctypes.c_int32
        result = __func(ctypes.byref(_serverName), ctypes.byref(_address),
                        _port, ctypes.byref(_password), _flags)

        if result > 0:
            raise PhidgetException(result)
Ejemplo n.º 21
0
	def getTargetPosition(self):
		_TargetPosition = ctypes.c_double()

		try:
			__func = PhidgetSupport.getDll().PhidgetRCServo_getTargetPosition
			__func.restype = ctypes.c_int32
			result = __func(self.handle, ctypes.byref(_TargetPosition))
		except RuntimeError:
			raise

		if result > 0:
			raise PhidgetException(result)

		return _TargetPosition.value
Ejemplo n.º 22
0
    def setVoltage_async(self, Voltage, asyncHandler):
        _Voltage = ctypes.c_double(Voltage)

        _ctx = ctypes.c_void_p()
        if asyncHandler != None:
            _ctx = ctypes.c_void_p(AsyncSupport.add(asyncHandler, self))
        _asyncHandler = AsyncSupport.getCallback()

        __func = PhidgetSupport.getDll().PhidgetVoltageOutput_setVoltage_async
        __func.restype = ctypes.c_int32
        result = __func(self.handle, _Voltage, _asyncHandler, _ctx)

        if result > 0:
            raise PhidgetException(result)
Ejemplo n.º 23
0
	def getMaxVelocityLimit(self):
		_MaxVelocityLimit = ctypes.c_double()

		try:
			__func = PhidgetSupport.getDll().PhidgetRCServo_getMaxVelocityLimit
			__func.restype = ctypes.c_int32
			result = __func(self.handle, ctypes.byref(_MaxVelocityLimit))
		except RuntimeError:
			raise

		if result > 0:
			raise PhidgetException(result)

		return _MaxVelocityLimit.value
Ejemplo n.º 24
0
    def getAxisCount(self):
        _AxisCount = ctypes.c_int()

        try:
            __func = PhidgetSupport.getDll().PhidgetGyroscope_getAxisCount
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_AxisCount))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _AxisCount.value
Ejemplo n.º 25
0
    def getLastTag(self):
        _tagString = (ctypes.c_char * 25)()
        _tagStringLen = ctypes.c_int32(25)
        _protocol = ctypes.c_int()

        __func = PhidgetSupport.getDll().PhidgetRFID_getLastTag
        __func.restype = ctypes.c_int32
        result = __func(self.handle, ctypes.byref(_tagString), _tagStringLen,
                        ctypes.byref(_protocol))

        if result > 0:
            raise PhidgetException(result)

        return _tagString.value.decode('utf-8'), _protocol.value
Ejemplo n.º 26
0
    def getTimestamp(self):
        _Timestamp = ctypes.c_double()

        try:
            __func = PhidgetSupport.getDll().PhidgetGyroscope_getTimestamp
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_Timestamp))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _Timestamp.value
Ejemplo n.º 27
0
    def getTagPresent(self):
        _TagPresent = ctypes.c_int()

        try:
            __func = PhidgetSupport.getDll().PhidgetRFID_getTagPresent
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_TagPresent))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _TagPresent.value
Ejemplo n.º 28
0
    def getMaxAngularRate(self):
        _MaxAngularRate = (ctypes.c_double * 3)()

        try:
            __func = PhidgetSupport.getDll().PhidgetGyroscope_getMaxAngularRate
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_MaxAngularRate))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return list(_MaxAngularRate)
Ejemplo n.º 29
0
    def getMaxAcceleration(self):
        _MaxAcceleration = ctypes.c_double()

        try:
            __func = PhidgetSupport.getDll().PhidgetStepper_getMaxAcceleration
            __func.restype = ctypes.c_int32
            result = __func(self.handle, ctypes.byref(_MaxAcceleration))
        except RuntimeError:
            raise

        if result > 0:
            raise PhidgetException(result)

        return _MaxAcceleration.value
Ejemplo n.º 30
0
    def getFontSize(self, font):
        _font = ctypes.c_int(font)
        _width = ctypes.c_int()
        _height = ctypes.c_int()

        __func = PhidgetSupport.getDll().PhidgetLCD_getFontSize
        __func.restype = ctypes.c_int32
        result = __func(self.handle, _font, ctypes.byref(_width),
                        ctypes.byref(_height))

        if result > 0:
            raise PhidgetException(result)

        return _width.value, _height.value