sim-io linux TBT
This commit is contained in:
parent
5a823d0564
commit
ea381a4093
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
from Automation.BDaq.BDaqApi import TNosFltChannel, BioFailed
|
from dummies.Automation.BDaq.BDaqApi import TNosFltChannel, BioFailed
|
||||||
from Automation.BDaq import ErrorCode
|
from dummies.Automation.BDaq import ErrorCode
|
||||||
|
|
||||||
|
|
||||||
class NoiseFilterChannel(object):
|
class NoiseFilterChannel(object):
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from .serial_label_printer import Serial_Label_Printer
|
|||||||
from .tecna_marposs_provaset_t3 import TecnaMarpossProvasetT3
|
from .tecna_marposs_provaset_t3 import TecnaMarpossProvasetT3
|
||||||
from .tecna_screwdriver import TecnaScrewdriver
|
from .tecna_screwdriver import TecnaScrewdriver
|
||||||
from .test_component import TestComponent
|
from .test_component import TestComponent
|
||||||
|
from .usb_586x import USB_586x
|
||||||
if "--vision" in sys.argv:
|
if "--vision" in sys.argv:
|
||||||
from .galaxy_camera import GalaxyCamera
|
from .galaxy_camera import GalaxyCamera
|
||||||
from .neo_pixels import NeoPixels
|
from .neo_pixels import NeoPixels
|
||||||
|
|||||||
@ -13,7 +13,7 @@ if platform.architecture()[0] == '32bit':
|
|||||||
if platform.system().lower() == 'windows':
|
if platform.system().lower() == 'windows':
|
||||||
dll = windll.LoadLibrary(r"biodaq")
|
dll = windll.LoadLibrary(r"biodaq")
|
||||||
else:
|
else:
|
||||||
dll = cdll.LoadLibrary(r"libbiodaq.so")
|
dll = None
|
||||||
|
|
||||||
|
|
||||||
def AdxEnumToString(enumName, enumValue, enumStrLen):
|
def AdxEnumToString(enumName, enumValue, enumStrLen):
|
||||||
@ -716,9 +716,7 @@ class TDaqCtrlBase(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Create(scenario):
|
def Create(scenario):
|
||||||
dll.TDaqCtrlBase_Create.argtypes = [c_int32]
|
return None
|
||||||
dll.TDaqCtrlBase_Create.restype = c_uint64
|
|
||||||
return dll.TDaqCtrlBase_Create(scenario)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getModule(obj):
|
def getModule(obj):
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
from Automation.BDaq import ErrorCode
|
from Automation.BDaq import ErrorCode
|
||||||
from Automation.BDaq.BDaqApi import TDaqCtrlBase, TArray, BioFailed
|
from dummies.Automation.BDaq.BDaqApi import TDaqCtrlBase, TArray, BioFailed
|
||||||
from Automation.BDaq import DeviceInformation, ControlState
|
from dummies.Automation.BDaq import DeviceInformation, ControlState
|
||||||
from Automation.BDaq.DeviceCtrl import DeviceCtrl
|
from dummies.Automation.BDaq.DeviceCtrl import DeviceCtrl
|
||||||
from Automation.BDaq import Utils
|
from dummies.Automation.BDaq import Utils
|
||||||
from Automation.BDaq import ErrorCode
|
from dummies.Automation.BDaq import ErrorCode
|
||||||
|
|
||||||
|
|
||||||
class DaqCtrlBase(object):
|
class DaqCtrlBase(object):
|
||||||
@ -39,11 +39,11 @@ class DaqCtrlBase(object):
|
|||||||
raise TypeError('The parameter value is not supported.')
|
raise TypeError('The parameter value is not supported.')
|
||||||
|
|
||||||
if isinstance(devInfo, str):
|
if isinstance(devInfo, str):
|
||||||
ret = ErrorCode.lookup(TDaqCtrlBase.setSelectedDevice(self._obj, DeviceInformation(Description=devInfo)))
|
ret = ErrorCode.Success
|
||||||
elif isinstance(devInfo, int):
|
elif isinstance(devInfo, int):
|
||||||
ret = ErrorCode.lookup(TDaqCtrlBase.setSelectedDevice(self._obj, DeviceInformation(Description=u'', DeviceNumber=devInfo)))
|
ret = ErrorCode.Success
|
||||||
else:
|
else:
|
||||||
ret = ErrorCode.lookup(TDaqCtrlBase.setSelectedDevice(self._obj, devInfo))
|
ret = ErrorCode.Success
|
||||||
|
|
||||||
#if BioFailed(ret):
|
#if BioFailed(ret):
|
||||||
# raise ValueError('ERRORE MODULO I/O: CODICE 0x%X' % (ret.value))
|
# raise ValueError('ERRORE MODULO I/O: CODICE 0x%X' % (ret.value))
|
||||||
|
|||||||
@ -5,10 +5,10 @@ from ctypes import c_int32, c_byte, c_uint8
|
|||||||
from ctypes import create_unicode_buffer
|
from ctypes import create_unicode_buffer
|
||||||
from ctypes import pointer
|
from ctypes import pointer
|
||||||
|
|
||||||
from Automation.BDaq.BDaqApi import TArray, TerminalBoard
|
from dummies.Automation.BDaq.BDaqApi import TArray, TerminalBoard
|
||||||
from Automation.BDaq.BDaqApi import TDeviceCtrl, BioFailed
|
from dummies.Automation.BDaq.BDaqApi import TDeviceCtrl, BioFailed
|
||||||
from Automation.BDaq import ErrorCode
|
from dummies.Automation.BDaq import ErrorCode
|
||||||
from Automation.BDaq import Utils
|
from dummies.Automation.BDaq import Utils
|
||||||
|
|
||||||
|
|
||||||
class DeviceCtrl(object):
|
class DeviceCtrl(object):
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from Automation.BDaq.BDaqApi import TDiCosintPort, BioFailed
|
from dummies.Automation.BDaq.BDaqApi import TDiCosintPort, BioFailed
|
||||||
from Automation.BDaq import ErrorCode
|
from dummies.Automation.BDaq import ErrorCode
|
||||||
|
|
||||||
|
|
||||||
class DiCosintPort(object):
|
class DiCosintPort(object):
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
from Automation.BDaq.BDaqApi import TDiPmintPort
|
from dummies.Automation.BDaq.BDaqApi import TDiPmintPort
|
||||||
from Automation.BDaq import ErrorCode
|
from dummies.Automation.BDaq import ErrorCode
|
||||||
|
|
||||||
|
|
||||||
class DiPmintPort(object):
|
class DiPmintPort(object):
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
from Automation.BDaq.BDaqApi import TDiintChannel, BioFailed
|
from dummies.Automation.BDaq.BDaqApi import TDiintChannel, BioFailed
|
||||||
from Automation.BDaq import ErrorCode, ActiveSignal
|
from dummies.Automation.BDaq import ErrorCode, ActiveSignal
|
||||||
from Automation.BDaq import Utils
|
from dummies.Automation.BDaq import Utils
|
||||||
|
|
||||||
|
|
||||||
class DiintChannel(object):
|
class DiintChannel(object):
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
from Automation.BDaq.BDaqApi import TArray
|
from dummies.Automation.BDaq.BDaqApi import TArray
|
||||||
from Automation.BDaq.BDaqApi import TDioFeatures
|
from dummies.Automation.BDaq.BDaqApi import TDioFeatures
|
||||||
from Automation.BDaq import MathInterval
|
from dummies.Automation.BDaq import MathInterval
|
||||||
from Automation.BDaq import Utils
|
from dummies.Automation.BDaq import Utils
|
||||||
|
|
||||||
|
|
||||||
class DioFeatures(object):
|
class DioFeatures(object):
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
from Automation.BDaq.BDaqApi import TDioPort, BioFailed
|
from dummies.Automation.BDaq.BDaqApi import TDioPort, BioFailed
|
||||||
from Automation.BDaq import Utils
|
from dummies.Automation.BDaq import Utils
|
||||||
from Automation.BDaq import ErrorCode, DioPortDir, DoCircuitType
|
from dummies.Automation.BDaq import ErrorCode, DioPortDir, DoCircuitType
|
||||||
|
|
||||||
|
|
||||||
class DioPort(object):
|
class DioPort(object):
|
||||||
|
|||||||
@ -70,43 +70,51 @@ class USB_586x(Component):
|
|||||||
|
|
||||||
def open_device(self):
|
def open_device(self):
|
||||||
# DIGITAL INPUTS CLASS
|
# DIGITAL INPUTS CLASS
|
||||||
if is_win:
|
if not self.simulate:
|
||||||
|
if is_win:
|
||||||
|
self.di_ctrl = InstantDiCtrl(self.info.Description)
|
||||||
|
self.do_ctrl = InstantDoCtrl(self.info.Description)
|
||||||
|
self.di_read = self.di_ctrl.readAny
|
||||||
|
self.do_write_bit = self.do_ctrl.writeBit
|
||||||
|
self.buffer = ctypes.create_string_buffer(2)
|
||||||
|
else:
|
||||||
|
self.di_create = libbiodaq.AdxInstantDiCtrlCreate
|
||||||
|
self.di_create.restype = ctypes.c_void_p
|
||||||
|
self.di_setSelectedDevice = libbiodaq.InstantDiCtrl_setSelectedDevice
|
||||||
|
self.di_setSelectedDevice.argtypes = [ctypes.c_void_p, ctypes.POINTER(self.DeviceInformation)]
|
||||||
|
self.di_setSelectedDevice.restype = ctypes.c_uint32
|
||||||
|
# DIGITAL INPUTS READ FUNCTION
|
||||||
|
self.di_read = libbiodaq.InstantDiCtrl_ReadAny
|
||||||
|
self.di_read.argtypes = [ctypes.c_void_p, ctypes.c_int32, ctypes.c_int32, ctypes.c_char_p]
|
||||||
|
self.di_read.restype = ctypes.c_int32
|
||||||
|
# DIGITAL OUTPUTS CLASS
|
||||||
|
self.do_create = libbiodaq.AdxInstantDoCtrlCreate
|
||||||
|
self.do_create.restype = ctypes.c_void_p
|
||||||
|
# SET SELECTED DEVICE
|
||||||
|
self.do_setSelectedDevice = libbiodaq.InstantDoCtrl_setSelectedDevice
|
||||||
|
self.do_setSelectedDevice.argtypes = [ctypes.c_void_p, ctypes.POINTER(self.DeviceInformation)]
|
||||||
|
self.do_setSelectedDevice.restype = ctypes.c_uint32
|
||||||
|
# get ports
|
||||||
|
self.get_ports = libbiodaq.InstantDoCtrl_getPortDirection
|
||||||
|
self.get_ports.argtypes = [ctypes.c_void_p]
|
||||||
|
self.get_ports.restype = ctypes.POINTER(ctypes.c_void_p)
|
||||||
|
# DIGITAL OUTPUTS WRITE FUNCTION
|
||||||
|
self.do_write_bit = libbiodaq.InstantDoCtrl_WriteBit
|
||||||
|
self.do_write_bit.argtypes = [ctypes.c_void_p, ctypes.c_int32, ctypes.c_int32, ctypes.c_char]
|
||||||
|
self.do_write_bit.restype = ctypes.c_int32
|
||||||
|
self.buffer = ctypes.create_string_buffer(2)
|
||||||
|
# INIT OBJECTS
|
||||||
|
self.di_ctrl = self.di_create()
|
||||||
|
self.do_ctrl = self.do_create()
|
||||||
|
self.di_init_status = self.di_setSelectedDevice(self.di_ctrl, ctypes.byref(self.info))
|
||||||
|
self.do_init_status = self.do_setSelectedDevice(self.do_ctrl, ctypes.byref(self.info))
|
||||||
|
else:
|
||||||
self.di_ctrl = InstantDiCtrl(self.info.Description)
|
self.di_ctrl = InstantDiCtrl(self.info.Description)
|
||||||
self.do_ctrl = InstantDoCtrl(self.info.Description)
|
self.do_ctrl = InstantDoCtrl(self.info.Description)
|
||||||
self.di_read = self.di_ctrl.readAny
|
self.di_read = self.di_ctrl.readAny
|
||||||
self.do_write_bit = self.do_ctrl.writeBit
|
self.do_write_bit = self.do_ctrl.writeBit
|
||||||
self.buffer = ctypes.create_string_buffer(2)
|
self.buffer = ctypes.create_string_buffer(2)
|
||||||
else:
|
|
||||||
self.di_create = libbiodaq.AdxInstantDiCtrlCreate
|
|
||||||
self.di_create.restype = ctypes.c_void_p
|
|
||||||
self.di_setSelectedDevice = libbiodaq.InstantDiCtrl_setSelectedDevice
|
|
||||||
self.di_setSelectedDevice.argtypes = [ctypes.c_void_p, ctypes.POINTER(self.DeviceInformation)]
|
|
||||||
self.di_setSelectedDevice.restype = ctypes.c_uint32
|
|
||||||
# DIGITAL INPUTS READ FUNCTION
|
|
||||||
self.di_read = libbiodaq.InstantDiCtrl_ReadAny
|
|
||||||
self.di_read.argtypes = [ctypes.c_void_p, ctypes.c_int32, ctypes.c_int32, ctypes.c_char_p]
|
|
||||||
self.di_read.restype = ctypes.c_int32
|
|
||||||
# DIGITAL OUTPUTS CLASS
|
|
||||||
self.do_create = libbiodaq.AdxInstantDoCtrlCreate
|
|
||||||
self.do_create.restype = ctypes.c_void_p
|
|
||||||
# SET SELECTED DEVICE
|
|
||||||
self.do_setSelectedDevice = libbiodaq.InstantDoCtrl_setSelectedDevice
|
|
||||||
self.do_setSelectedDevice.argtypes = [ctypes.c_void_p, ctypes.POINTER(self.DeviceInformation)]
|
|
||||||
self.do_setSelectedDevice.restype = ctypes.c_uint32
|
|
||||||
# get ports
|
|
||||||
self.get_ports = libbiodaq.InstantDoCtrl_getPortDirection
|
|
||||||
self.get_ports.argtypes = [ctypes.c_void_p]
|
|
||||||
self.get_ports.restype = ctypes.POINTER(ctypes.c_void_p)
|
|
||||||
# DIGITAL OUTPUTS WRITE FUNCTION
|
|
||||||
self.do_write_bit = libbiodaq.InstantDoCtrl_WriteBit
|
|
||||||
self.do_write_bit.argtypes = [ctypes.c_void_p, ctypes.c_int32, ctypes.c_int32, ctypes.c_char]
|
|
||||||
self.do_write_bit.restype = ctypes.c_int32
|
|
||||||
self.buffer = ctypes.create_string_buffer(2)
|
|
||||||
# INIT OBJECTS
|
|
||||||
self.di_ctrl = self.di_create()
|
|
||||||
self.do_ctrl = self.do_create()
|
|
||||||
self.di_init_status = self.di_setSelectedDevice(self.di_ctrl, ctypes.byref(self.info))
|
|
||||||
self.do_init_status = self.do_setSelectedDevice(self.do_ctrl, ctypes.byref(self.info))
|
|
||||||
def close_device(self):
|
def close_device(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -148,7 +156,7 @@ class USB_586x(Component):
|
|||||||
def get(self):
|
def get(self):
|
||||||
self.mutex.lock()
|
self.mutex.lock()
|
||||||
read = []
|
read = []
|
||||||
if is_win:
|
if is_win or self.simulate:
|
||||||
if self.simulate:
|
if self.simulate:
|
||||||
read.append(bytearray(0))
|
read.append(bytearray(0))
|
||||||
else:
|
else:
|
||||||
|
|||||||
11
src/main.py
11
src/main.py
@ -4,7 +4,6 @@ import faulthandler
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
# import pdb
|
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
@ -12,10 +11,10 @@ import weakref
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system().lower() == "windows":
|
||||||
sys.path.append(f"{os.getcwd()}\src\components")
|
sys.path.append(f"{os.getcwd()}\src\components")
|
||||||
|
else:
|
||||||
#from components.usb_586x import USB_586x
|
sys.path.append(f"{os.getcwd()}/src/components")
|
||||||
|
|
||||||
app = None
|
app = None
|
||||||
|
|
||||||
@ -64,7 +63,7 @@ try:
|
|||||||
# IMPORT PROJECT ONLY AFTER SETTING UP SIGNAL, FAULTHANDLER AND LOGGHING
|
# IMPORT PROJECT ONLY AFTER SETTING UP SIGNAL, FAULTHANDLER AND LOGGHING
|
||||||
from components import (ArchiveSynchronizer, Multicomp730424,
|
from components import (ArchiveSynchronizer, Multicomp730424,
|
||||||
Os_Label_Printer, RemoteAPI,
|
Os_Label_Printer, RemoteAPI,
|
||||||
TecnaMarpossProvasetT3, TecnaScrewdriver)
|
TecnaMarpossProvasetT3, TecnaScrewdriver, USB_586x)
|
||||||
from lib.db import Users
|
from lib.db import Users
|
||||||
from lib.helpers import ConfigReader
|
from lib.helpers import ConfigReader
|
||||||
from PyQt5.QtCore import QObject, QThread, pyqtSignal
|
from PyQt5.QtCore import QObject, QThread, pyqtSignal
|
||||||
@ -102,7 +101,7 @@ try:
|
|||||||
"remote_api": {"c": RemoteAPI, "k": {"main": self}},
|
"remote_api": {"c": RemoteAPI, "k": {"main": self}},
|
||||||
"screwdriver": {"c": TecnaScrewdriver, "k": {"paused": True}},
|
"screwdriver": {"c": TecnaScrewdriver, "k": {"paused": True}},
|
||||||
"tecna_t3": {"c": TecnaMarpossProvasetT3, "k": {"paused": True}},
|
"tecna_t3": {"c": TecnaMarpossProvasetT3, "k": {"paused": True}},
|
||||||
#"digital_io":{"c":USB_586x,"k":{"paused":True}}
|
"digital_io":{"c":USB_586x,"k":{"paused":True}}
|
||||||
}
|
}
|
||||||
# VISION COMPONENT IS OPTIONAL AND DISABLED BY DEFAULT
|
# VISION COMPONENT IS OPTIONAL AND DISABLED BY DEFAULT
|
||||||
if "--vision" in sys.argv:
|
if "--vision" in sys.argv:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user