Beispiel #1
0
    def _link_library(self, lib_path, convention):
        """Find and link the external librairy if only a path was provided.

        """
        if convention == 'cdll':
            return cdll.LoadLibrary(lib_path)
        elif convention == 'windll':
            return windll.LoadLibrary(lib_path)
        elif convention == 'oledll':
            return oledll.LoadLibrary(lib_path)
        else:
            raise ValueError('Convention cannot be {}'.format(convention))
Beispiel #2
0
	def _create_object_from_path (self, clsid, dll_filename, interface=IBaseFilter):
		iclassfactory = self._raw_guid(IClassFactory._iid_)
		my_dll = oledll.LoadLibrary(dll_filename)
		factory_ptr = c_void_p(0)
		hr = my_dll.DllGetClassObject(self._raw_guid(clsid), iclassfactory, byref(factory_ptr))
		if hr!=S_OK:
			raise COMError(hr, '', '')
		ptr_icf = POINTER(IClassFactory)(factory_ptr.value)
		unk = ptr_icf.CreateInstance()

		# if ScreenCam or SpoutCam is loaded from local file, we also grab its property page
		if clsid==CLSID_ScreenCam or clsid==CLSID_SpoutCam:
			factory_ptr = c_void_p(0)
			hr = my_dll.DllGetClassObject(
					self._raw_guid(CLSID_SpoutCamPropertyPage if clsid==CLSID_SpoutCam else CLSID_ScreenCamPropertyPage),
					iclassfactory,
					byref(factory_ptr))
			if hr!=S_OK:
				raise COMError(hr, '', '')
			ptr_icf = POINTER(IClassFactory)(factory_ptr.value)
			unk2 = ptr_icf.CreateInstance()
			self._page = unk2.QueryInterface(IPropertyPage)
		return unk.QueryInterface(interface)
Beispiel #3
0
"""

from __future__ import print_function
import time
from enum import Enum
from ctypes import (c_int32, c_bool, byref, create_string_buffer, Structure,
                    POINTER, oledll)
from . import Motion
from .. import _ParamDict
from ..util import check_units, check_enums
from ...errors import InstrumentTypeError, InstrumentNotFoundError
from ... import Q_

# __all__ = ['LinearStage', 'Goniometer', 'RotationStage', 'ECC100']

lib = oledll.LoadLibrary('ecc.dll')
_err_map = {
    -1: 'Unspecified error.',
    1: 'Communication timeout.',
    2: 'No active connection to device.',
    3: 'Error in communication with driver.',
    7: 'Device is already in use.',
    9: 'Parameter out of range.',
    10: 'Feature only available in pro version.'
}


def _instrument(params):
    """ Possible params include 'ecc100_id', 'module'
    
    Note that ecc100_id should be a string"""