Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Parameter (ServiceInfo) #2

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Changes from 6 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0ce708d
Fixed Parameter (ServiceInfo)
rifoerster Sep 8, 2020
a21fb48
Merge pull request #1 from bodiroga/master
rifoerster Sep 17, 2020
e9110c6
Enabling the usage of Port Range for Devices
rifoerster Sep 17, 2020
e09b861
Additional Device Configurations
rifoerster Sep 17, 2020
c9f4a15
Extracting First Config Value into a dedicated File
rifoerster Sep 25, 2020
21c3228
adding protokoll
rifoerster Sep 25, 2020
810f137
Redirector init can fail too
rifoerster Sep 25, 2020
ef68569
Leaving it to the device to figure its own unique name.
rifoerster Oct 7, 2020
9f5fca1
Sarad Device Unique Name
rifoerster Oct 7, 2020
1ea89d5
Revert "Sarad Device Unique Name"
rifoerster Oct 7, 2020
97d5c17
Port Ranges
rifoerster Oct 7, 2020
6a5bc09
Update sarad_gateway_device.py
rifoerster Oct 7, 2020
68f82a3
Fixed type name when protocol is present
rifoerster Oct 15, 2020
04082e6
Update sarad_gateway_device.py
rifoerster Oct 15, 2020
b383452
Some utility bash commands
rifoerster Oct 16, 2020
c5a0386
Should now work from outside the git project root dir
rifoerster Oct 16, 2020
cf42301
Update rfc2217-gateway
rifoerster Oct 16, 2020
1a8c333
Some bash variants don't like it if it isn't LF
rifoerster Oct 16, 2020
843c91e
ingore venv directory
rifoerster Oct 16, 2020
db9c89b
Debugging Changes (Temp)
rifoerster Dec 10, 2020
095e51f
!: adapt to changes in sarad.cluster library
mistrey Dec 21, 2020
7f98db3
~: Formatting
mistrey Dec 22, 2020
3917759
~: lazy formatting in logging
mistrey Dec 23, 2020
25d3062
~: Inheriting from object is no longer required.
mistrey Dec 23, 2020
395a0ba
~: Handle PyLint hints
mistrey Dec 23, 2020
ae69f33
~: Follow hints from linter
mistrey Jan 5, 2021
2ffb618
~: Add type definitions for devices
mistrey Jan 29, 2021
fce2571
!: data_collector is a special, editable requirement
mistrey Feb 10, 2021
db4e277
+: documentation framework
mistrey Feb 16, 2021
686f074
+: build files of documentation
mistrey Feb 18, 2021
aababee
!: ZeroConf type is only _rfc2217.
mistrey Mar 20, 2021
f0938c5
~: Formatting with Black. Additional debug messages.
mistrey Apr 14, 2021
af96271
~: \tmp\ -> gitignore
mistrey May 14, 2021
705b7a2
+: detect FTDI devices as sarad-1688
mistrey Jun 2, 2021
1f44bcc
~ Changes to match new sari version
rifoerster Jun 2, 2021
adcfa08
Merge branch 'master' of //server.hq.sarad.de/sarad/projekte/2020-WLA…
rifoerster Jun 2, 2021
6964888
!: allow multiple devices at Instrument Server
mistrey Jun 2, 2021
29ea964
Merge remote-tracking branch 'origin/master'
mistrey Jun 2, 2021
a2b2b3f
~: add interface config for ap-strey
mistrey Jun 3, 2021
35409be
Merge branch 'master' of /home/SARAD/mstrey/Y/Projekte/2020-WLAN_Modu…
mistrey Jun 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 24 additions & 29 deletions src/gateway_devices/ftdi_gateway_device.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,9 @@

import logging
from typing import Type

from sarad.cluster import SaradCluster

from gateway_devices.generic_gateway_device import GenericGatewayDevice

logger = logging.getLogger(__name__)
@@ -15,55 +17,48 @@ def get_class() -> Type[GenericGatewayDevice]:

class FTDIGatewayDevice(GenericGatewayDevice):
"""FT232 serial to USB converter"""

NAME = "FT232R USB UART"
ID_MODEL_ID = "6001"
ID_VENDOR_ID = "0403"
ID_VENDOR_ENC = "FTDI"
PORT_RANGE = [5600, 5640]
PROTOCOL = "unknown"
PROTOCOL = "sarad-1688"

def __init__(self, device):
super().__init__(device)
self.__cluster = SaradCluster()
try:
self.__devi = self.__cluster.update_connected_instruments()
except Exception: # pylint: disable=broad-except
self.__devi = self.__cluster.update_connected_instruments(
[device.get("DEVNAME")]
)
except Exception: # pylint: disable=broad-except
logger.error("USB device access failed %s", device)
self.get_properties()

def get_serial_id(self):
if len(self.__devi) == 1:
return "{}:{}".format(self.device.get("ID_MODEL", ""),
self.__devi[0].device_id)
return f"{self.device.get('ID_MODEL', '')}:{self.__devi[0].device_id}"
return self.device.get("ID_SERIAL", "")

def get_properties(self):
if len(self.__devi) == 1:
self.model_id = self.device.get("ID_MODEL_ID", "")
self.model = self.device.get("ID_MODEL", "")
self.model_enc = self.device.get("ID_MODEL_ENC", "")
self.model_db = self.device.get("ID_MODEL_FROM_DATABASE", "")
self.vendor_id = self.device.get("ID_VENDOR_ID", "")
self.vendor = self.device.get("ID_VENDOR_FROM_DATABASE", "")
self.vendor_enc = self.device.get("ID_VENDOR_ENC", "")
self.vendor_db = self.device.get("ID_VENDOR_FROM_DATABASE", "")
self.serial_short = str(self.__devi[0].device_id)
self.serial = f'{self.serial_short}'

properties = {
"MODEL_ID": self.model_id,
"MODEL": self.model,
"MODEL_ENC": self.model_enc,
"MODEL_DB": self.model_db,
"VENDOR_ID": self.vendor_id,
"VENDOR": self.vendor,
"VENDOR_ENC": self.vendor_enc,
"VENDOR_DB": self.vendor_db,
"SERIAL": "{}_{}".format(self.model, self.serial_short),
"SERIAL_SHORT": self.serial_short
model = self.device.get("ID_MODEL", "")
serial_short = f"{self.__devi[0].device_id}.{self.get_protocol()}"
self.serial = serial_short
return {
"MODEL_ID": self.device.get("ID_MODEL_ID", ""),
"MODEL": model,
"MODEL_ENC": self.device.get("ID_MODEL_ENC", ""),
"MODEL_DB": self.device.get("ID_MODEL_FROM_DATABASE", ""),
"VENDOR_ID": self.device.get("ID_VENDOR_ID", ""),
"VENDOR": self.device.get("ID_VENDOR_FROM_DATABASE", ""),
"VENDOR_ENC": self.device.get("ID_VENDOR_ENC", ""),
"VENDOR_DB": self.device.get("ID_VENDOR_FROM_DATABASE", ""),
"SERIAL": f"{model}_{serial_short}",
"SERIAL_SHORT": f"{self.__devi[0].device_id}.{self.get_protocol()}",
}
return properties
return super().get_properties()

def get_name_unique(self):
return f'{self.serial}'
return f"{self.serial}"
46 changes: 18 additions & 28 deletions src/gateway_devices/sarad_gateway_device.py
Original file line number Diff line number Diff line change
@@ -29,45 +29,35 @@ def __init__(self, device):
super().__init__(device)
self.__cluster = SaradCluster()
try:
self.__devi = self.__cluster.update_connected_instruments()
self.__devi = self.__cluster.update_connected_instruments(
[device.get("DEVNAME")]
)
except Exception: # pylint: disable = broad-except
logger.error("USB Device Access Failed %s", device)
self.get_properties()

def get_serial_id(self):

if len(self.__devi) == 1:
return "{}:{}".format(
self.device.get("ID_MODEL", ""), self.__devi[0].device_id
)
return f"{self.device.get('ID_MODEL', '')}:{self.__devi[0].device_id}"
return self.device.get("ID_SERIAL", "")

def get_properties(self):
if len(self.__devi) == 1:
self.model_id = self.device.get("ID_MODEL_ID", "")
self.model = self.device.get("ID_MODEL", "")
self.model_enc = self.device.get("ID_MODEL_ENC", "")
self.model_db = self.device.get("ID_MODEL_FROM_DATABASE", "")
self.vendor_id = self.device.get("ID_VENDOR_ID", "")
self.vendor = self.device.get("ID_VENDOR_FROM_DATABASE", "")
self.vendor_enc = self.device.get("ID_VENDOR_ENC", "")
self.vendor_db = self.device.get("ID_VENDOR_FROM_DATABASE", "")
self.serial_short = f"{self.__devi[0].device_id}.{self.get_protocol()}"
self.serial = f"{self.serial_short}"

properties = {
"MODEL_ID": self.model_id,
"MODEL": self.model,
"MODEL_ENC": self.model_enc,
"MODEL_DB": self.model_db,
"VENDOR_ID": self.vendor_id,
"VENDOR": self.vendor,
"VENDOR_ENC": self.vendor_enc,
"VENDOR_DB": self.vendor_db,
"SERIAL": "{}_{}".format(self.model, self.serial_short),
"SERIAL_SHORT": self.serial_short,
model = self.device.get("ID_MODEL", "")
serial_short = f"{self.__devi[0].device_id}.{self.get_protocol()}"
self.serial = serial_short
return {
"MODEL_ID": self.device.get("ID_MODEL_ID", ""),
"MODEL": model,
"MODEL_ENC": self.device.get("ID_MODEL_ENC", ""),
"MODEL_DB": self.device.get("ID_MODEL_FROM_DATABASE", ""),
"VENDOR_ID": self.device.get("ID_VENDOR_ID", ""),
"VENDOR": self.device.get("ID_VENDOR_FROM_DATABASE", ""),
"VENDOR_ENC": self.device.get("ID_VENDOR_ENC", ""),
"VENDOR_DB": self.device.get("ID_VENDOR_FROM_DATABASE", ""),
"SERIAL": f"{model}_{serial_short}",
"SERIAL_SHORT": f"{self.__devi[0].device_id}.{self.get_protocol()}",
}
return properties
return super().get_properties()

def get_name_unique(self):