class
ScriptDeviceRepository.
ScriptDeviceRepository
Bases: object
Device respository.
property
sources
Get the repository sources of the device repository.
create_device_identification
type
id
version
Factory method for a DeviceId object.
type (int) – The device type.
id (str) – The device id.
str
A new DeviceId object with the provided values.
create_module_identification
type
id
version
module_id
Factory method for a ModuleId object.
type (int) – The device type.
id (str) – The device id.
module_id (str) – The module id.
str
A new ModuleId object with the provided values.
import_device
path: str
source: ScriptRepositorySource
converter_factory_guid: Guid
save_device_cache: bool = True
Import a device description file into a repository.
WARNING | |
---|---|
Convert a foreign device description file and import the result into a repository.
{C633F245-876F-45E8-AAB4-3FBD994C08B8} |
Use as default because all available converters are tried |
{3992C588-7BDB-4A7C-908D-F444808D8CD2} |
XML files of EtherCAT |
{6066AEF4-F19A-41ac-A249-721BDAE32D40} |
GSDML files of Profinet IO |
{CDDE0374-9EFD-401e-93C8-F19443FB60ED} |
XML files of Sercos3 |
{1ce4a9c1-37d3-496c-9e80-cd99ad3807ee} |
EDS files of CANbus |
path (str) – The file that contains the device description. This must be a valid device description file. Other types of device descriptions must be imported by special plug-ins.
source (ScriptRepositorySource) – The repository source where the device should be stored. This parameter may be None, in which case the default repository source is used. The repository source must be one of the sources defined in sources.
converter_factory_guid (str) – The guid of the converter to import a foreign device description. For example CANopen EDS files.
save_device_cache (bool) – If True, after removing the device the device cache is also written. If False, the device cache is not written. If many devices are removed, this is much faster.
DeviceId
The ID of the imported device description.
import_vendor_description
path: str
source: ScriptRepositorySource
Import a device description file into a repository.
WARNING | |
---|---|
import_vendor_description(path, source) (2/2)
path (str) – The file that contains the vendor description. This must be a valid vendor description file.
source (ScriptRepositorySource) – The repository source where the device should be stored. This parameter may be None, in which case the default repository source is used. The repository source must be one of the sources defined in sources.
ScriptVendorDescription
The imported vendor description.
remove_device
device_id
source
save_device_cache=True
Remove a device from the specified repository source.
device_id (DeviceId) – Defines the device to remove.
source (ScriptRepositorySource) – Remove the device from this repository source. If None the device is removed from the default repository source.
save_device_cache (bool) – If True, after removing the device the device cache is also written. If False, the device cache is not written. If many devices are removed, this is much faster.
remove_vendor_description
vendor_id
source
Remove a vendor description from the specified repository source.
vendor_id (int) – The vendor id.
source (ScriptRepositorySource) – Remove the device from this repository source. If None the device is removed from the default repository source.
save_device_cache
Saves the current devices in the device cache. Could be used to force it after adding or removing many devices.
rebuild_device_cache
Rebuild the device cache.
The device cache is deleted, initialized and saved.
get_device_category
category: Guid
This overload is called when category_id is of type int.
Get the device category with the specified type GUID.
category_id (Guid) – The type GUID of the device category implementation.
The requested device category, or None if the device category does not exist.
get_device_family
family
Device family.
family (str) – VendorID:FamilyID.
ScriptDeviceFamily
get_all_devices
name: str
source: ScriptRepositorySource
Get a collection containing all devices in the repository.
WARNING | |
---|---|
Get all device which contain the specified name.
name (str) – Text which the name of the device has to contain.
source (ScriptRepositorySource) – If not None, only this repository source will be searched.
tuple
A device tuple containing the current result of the query.
get_device
device_id
Get the device description with the specified device identification.
device_id (DeviceId) – Device identification.
The requested device description, or None if the device description does not exist.
get_all_vendor_descriptions
source: ScriptRepositorySource
Get a collection of all vendor descriptions in the repository.
WARNING | |
---|---|
Get the vendor description with the specified vendor Id.
source (ScriptRepositorySource) – Repository source.
tuple[ScriptVendorDescription]
A collection of vendor descriptions containing the current result of the query.
get_vendor_description
vendor_id
Get the vendor description with the specified vendor Id.
vendor_id (int) – Vendor Id.
ScriptVendorDescription
The requested vendor description, or None if the vendor description does not exist.
class
ScriptDeviceRepository.
ScriptRepositorySourceList
iterable=()
/
Bases: list
A collection of ScriptRepositorySource objects.
add
name
location_url
Add a new repository source with the specified name.
name (str) – Name for the new source.
The added repository source.
remove
source
Remove an existing repository source.
Internal sources cannot be removed.
source (ScriptRepositorySource) – The repository source to remove.
move
source
index
Move an existing repository source to the specified location in the collection.
source (ScriptRepositorySource) – Existing repository source.
index (int) – New index of the repository source.
class
ScriptDeviceRepository.
ScriptRepositorySource
Bases: object
Repository source.
property
name
Get or set the name of the repository source.
str
property
location_url
Get or set the location URL.
str
property
is_internal
Return whether the repository source is internal.
If true, then this repository source is an implicit source (like the project internal repository or the installation specific repository). Therefore its properties like name and location are readonly and may not be changed.
bool
class
ScriptDeviceRepository.
ScriptDeviceCategory
Bases: object
Category of devices.
Devices can be grouped into categories by means of the DeviceDescription/Device/DeviceInfo/Category tags of the device description file. One can implement a corresponding class of this interface to display these types in a user-friendly way.
property
category_id
Id of the category.
int
property
parent_category
The type GUID of the parent device category implementation, or Guid.Empty, if this device implementation is top-level.
Guid
property
name
Gets a user-friendly display name for this device category.
This string should be localized.
str
property
description
Gets a user-friendly description for this device category.
This string should be localized.
str