Ejemplo n.º 1
0
 def __init__(self, append_sys_path, append_environ_path, **kwargs):
     Client64.__init__(self,
                       'cli32',
                       append_sys_path=[os.path.dirname(__file__)] +
                       append_sys_path,
                       append_environ_path=append_environ_path,
                       **kwargs)
Ejemplo n.º 2
0
 def __init__(self):
     """
     Communicates with 32-bit LCDriver.dll library via lcserver32.py.
     """
     Client64.__init__(self,
                       module32='lcserver32',
                       append_sys_path=os.path.dirname(__file__))
Ejemplo n.º 3
0
def decode(filename):
    f = open(filename, 'rb')
    bytes = f.read()
    f.close()
    if (bytes[:11] != b'[offset:0]\n'):
        print('[Error] Unknown format for file %s' % filename)
        return ''
    client = Client64(module32='wrapper')
    result = client.request32('decrypt', bytes[11:])
    result = decompress(result)
    return str(result, encoding='utf-8')
Ejemplo n.º 4
0
    def __init__(self, record):
        """A wrapper around the :class:`~.benhw32.Bentham32` class.

        This class can be used with either a 32- or 64-bit Python interpreter
        to call the 32-bit functions in ``benhw32_cdecl.dll``.

        The :attr:`~msl.equipment.record_types.ConnectionRecord.properties`
        for a Bentham connection supports the following key-value pairs in the
        :ref:`connections_database`::

            'cfg': str, the path to the System.cfg file [default: None]
            'atr': str, the path to the System.atr file [default: None]
        
        If the ``cfg`` and ``atr`` values are not defined in the :ref:`connections_database`
        then you will have to call :meth:`build_system_model`, :meth:`load_setup`
        and :meth:`initialise` (in that order) to configure the SDK.

        Do not instantiate this class directly. Use the :meth:`~.EquipmentRecord.connect`
        method to connect to the equipment.

        Parameters
        ----------
        record : :class:`~.EquipmentRecord`
            A record from an :ref:`equipment_database`.
        """
        self._is_connected = False

        super(Bentham, self).__init__(record)
        self.set_exception_class(BenthamError)

        path = record.connection.address[5:]
        head, tail = os.path.split(path)
        self._tail = tail
        self.log_debug('Starting 32-bit server for {}'.format(tail))

        # the IEEE_32M.dll library must be available on PATH
        env_path = [head, os.path.join(head, 'IEEE', 'Dummy')]

        self._client = Client64('benhw32',
                                append_sys_path=os.path.dirname(__file__),
                                append_environ_path=env_path,
                                lib_path=path)

        self._hw_id = None

        cfg_path = record.connection.properties.get('cfg')
        atr_path = record.connection.properties.get('atr')
        if cfg_path and atr_path:
            self.build_system_model(cfg_path)
            self.load_setup(atr_path)
            self.initialise()

        self._is_connected = True
Ejemplo n.º 5
0
    def __init__(self, record):
        """A wrapper around the :class:`~.datarayocx_32.DataRayOCX32` class.

        This class can be used with either a 32- or 64-bit Python interpreter
        to call the 32-bit functions in the ``DATARAYOCX`` library. A GUI is
        created to configure and visualize the images taken by the camera.

        The :attr:`~msl.equipment.record_types.ConnectionRecord.properties`
        for a DataRay connection supports the following key-value pairs in the
        :ref:`connections-database`::

            'area_filter': int, area filter: 1=1pixel, 2=3pixels, 3=5pixels, 4=7pixels, 5=9pixels [default: 1]
            'camera_index': int, the camera to use (between 0 and 7; 0=first camera found) [default: 0]
            'centroid_method': int, the centroid method to use (0, 1 or 2) [default: 0]
            'filter': float, percent full scale filter (0, 0.1, 0.2, 0.5, 1, 2, 5 or 10) [default: 0.2]
            'major_minor_method': int, the major/minor method to use (0, 1 or 2) [default: 0]
            'ui_size': int, the size of the User Interface (value=height of a button in pixels) [default: 25]

        Do not instantiate this class directly. Use the :meth:`~.EquipmentRecord.connect`
        method to connect to the equipment.

        Parameters
        ----------
        record : :class:`~.EquipmentRecord`
            A record from an :ref:`equipment-database`.
        """
        self._client = None
        super(DataRayOCX64, self).__init__(record)
        self.set_exception_class(DataRayError)

        error_connecting = None
        try:
            self._client = Client64('datarayocx_32',
                                    append_sys_path=os.path.dirname(__file__),
                                    timeout=10,
                                    **record.connection.properties)
        except Exception as err:
            error_connecting = err

        if error_connecting:
            self.raise_exception(
                'Cannot connect to the DataRay Beam Profiler.\n{}'.format(
                    error_connecting))

        self.log_debug('Connected to {}'.format(record.connection))
Ejemplo n.º 6
0
 def __init__(self):
     # specify the name of the corresponding 32-bit server module, dotnet32, which hosts
     # the 32-bit .NET library -- dotnet_lib32.dll.
     Client64.__init__(self,
                       module32='dotnet32',
                       append_path=os.path.dirname(__file__))
Ejemplo n.º 7
0
 def __init__(self):
     # specify the name of the corresponding 32-bit server module, kernel32, which hosts
     # the Windows 32-bit library -- kernel32.dll
     Client64.__init__(self,
                       module32='kernel32',
                       append_path=os.path.dirname(__file__))
Ejemplo n.º 8
0
 def __init__(self):
     # specify the name of the corresponding 32-bit server module, fortran32, which hosts
     # the 32-bit FORTRAN library -- fortran_lib32.
     Client64.__init__(self,
                       module32='fortran32',
                       append_path=os.path.dirname(__file__))
Ejemplo n.º 9
0
    def __init__(self, quiet=False):
        Client64.__init__(self, module32='dummy32', append_path=os.path.dirname(__file__), quiet=quiet)

        self._quiet = quiet
        if not quiet:
            print('Client running on ' + sys.version)
Ejemplo n.º 10
0
 def __init__(self):
     # specify the name of the corresponding 32-bit server module, cpp32, which hosts
     # the 32-bit C++ library -- cpp_lib32.
     Client64.__init__(self,
                       module32='cpp32',
                       append_sys_path=os.path.dirname(__file__))
Ejemplo n.º 11
0
 def __init__(self):
     # specify the name of the corresponding 32-bit server module, labview32, which hosts
     # the 32-bit LabVIEW library -- labview_lib32.dll
     Client64.__init__(self, module32='labview32', append_sys_path=os.path.dirname(__file__))
Ejemplo n.º 12
0
 def __init__(self):
     # Use the default '127.0.0.1' address to start the 'my_server.py' module
     Client64.__init__(self, module32='modules/imic_my_server')