From 4fb724430d8706a544083c09c4f424a22a8ded13 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Mon, 13 Sep 2021 11:50:23 -0500 Subject: [PATCH] Uploading extronlib documentation to github Not completed yet still need to fix some things --- __init__.py | 14 + device/ProcessorDevice.py | 220 +++++++ device/UIDevice.py | 863 +++++++++++++++++++++++++ device/__init__.py | 3 + device/eBUSDevice.py | 271 ++++++++ interface/CircuitBreakerInterface.py | 72 +++ interface/ClientObject.py | 42 ++ interface/ContactInterface.py | 69 ++ interface/DigitalIOInterface.py | 74 +++ interface/DigitalInputInterface.py | 45 ++ interface/EthernetClientInterface.py | 123 ++++ interface/EthernetServerInterface.py | 86 +++ interface/EthernetServerInterfaceEx.py | 81 +++ interface/FlexIOInterface.py | 93 +++ interface/IRInterface.py | 85 +++ interface/PoEInterface.py | 51 ++ interface/RelayInterface.py | 51 ++ interface/SPInterface.py | 1 + interface/SWACReceptacleInterface.py | 49 ++ interface/SWPowerInterface.py | 53 ++ interface/SerialInterface.py | 133 ++++ interface/TallyInterface.py | 1 + interface/VolumeInterface.py | 71 ++ interface/__init__.py | 17 + software/SummitConnect.py | 115 ++++ software/__init__.py | 1 + standard/__init__.py | 1 + standard/exml.py | 43 ++ system/Clock.py | 70 ++ system/Email.py | 70 ++ system/File.py | 173 +++++ system/MESet.py | 79 +++ system/RFile.py | 172 +++++ system/Timer.py | 67 ++ system/Wait.py | 41 ++ system/__init__.py | 57 ++ ui_wrapper/Button.py | 132 ++++ ui_wrapper/Knob.py | 26 + ui_wrapper/Label.py | 48 ++ ui_wrapper/Level.py | 70 ++ ui_wrapper/Slider.py | 2 + ui_wrapper/__init__.py | 5 + 42 files changed, 3740 insertions(+) create mode 100644 __init__.py create mode 100644 device/ProcessorDevice.py create mode 100644 device/UIDevice.py create mode 100644 device/__init__.py create mode 100644 device/eBUSDevice.py create mode 100644 interface/CircuitBreakerInterface.py create mode 100644 interface/ClientObject.py create mode 100644 interface/ContactInterface.py create mode 100644 interface/DigitalIOInterface.py create mode 100644 interface/DigitalInputInterface.py create mode 100644 interface/EthernetClientInterface.py create mode 100644 interface/EthernetServerInterface.py create mode 100644 interface/EthernetServerInterfaceEx.py create mode 100644 interface/FlexIOInterface.py create mode 100644 interface/IRInterface.py create mode 100644 interface/PoEInterface.py create mode 100644 interface/RelayInterface.py create mode 100644 interface/SPInterface.py create mode 100644 interface/SWACReceptacleInterface.py create mode 100644 interface/SWPowerInterface.py create mode 100644 interface/SerialInterface.py create mode 100644 interface/TallyInterface.py create mode 100644 interface/VolumeInterface.py create mode 100644 interface/__init__.py create mode 100644 software/SummitConnect.py create mode 100644 software/__init__.py create mode 100644 standard/__init__.py create mode 100644 standard/exml.py create mode 100644 system/Clock.py create mode 100644 system/Email.py create mode 100644 system/File.py create mode 100644 system/MESet.py create mode 100644 system/RFile.py create mode 100644 system/Timer.py create mode 100644 system/Wait.py create mode 100644 system/__init__.py create mode 100644 ui_wrapper/Button.py create mode 100644 ui_wrapper/Knob.py create mode 100644 ui_wrapper/Label.py create mode 100644 ui_wrapper/Level.py create mode 100644 ui_wrapper/Slider.py create mode 100644 ui_wrapper/__init__.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..d34e926 --- /dev/null +++ b/__init__.py @@ -0,0 +1,14 @@ +import device, interface, software, standard, system, ui_wrapper + +__all__ = ['Version', 'event'] + +def Version(): + """ Return the Extron Library version string in the form of ..""" + return '' + +def event(Object, EventName): + """ Decorate a function to be the handler of Object when EventName happens. + + The decorated function must have the exact signature as specified by the definition of EventName, which must appear in the Object class or one of its parent classes. Lists of objects and/or events can be passed in to apply the same handler to multiple events. + """ + pass diff --git a/device/ProcessorDevice.py b/device/ProcessorDevice.py new file mode 100644 index 0000000..620ae96 --- /dev/null +++ b/device/ProcessorDevice.py @@ -0,0 +1,220 @@ + +class ProcessorDevice(): + """ Defines common interface to Extron Control Processors + + Note: + - `DeviceAlias` must be a valid device Device Alias of an Extron device in the system. + - If the part number is provided, the device will trigger a warning message in the program log if it does not match the connected device. + + --- + + Functions: + - Reboot: Performs a soft restart of this device – this is equivalent to rebooting a PC. + - SetExecutiveMode: Sets the desired Executive Mode + + --- + + Arguments: + - DeviceAlias (string) - Device Alias of the Extron device + - (optional) PartNumber (string) - device’s part number + + --- + + Parameters: + - CurrentLoad - Returns (float) - the current load of 12V DC power supply. This only applies to ProcessorDevice featuring 12V DC power supply. It returns None otherwise. + - DeviceAlias - Returns (string) - the device alias of the object + - ExecutiveMode - Returns (int) - The current executive mode number. + - FirmwareVersion - Returns (string) - the firmware version of this device + - Hostname - Returns (string) - the hostname of this device + - IPAddress - Returns (string) - IP address of this device + - LinkLicenses - Returns (list of strings) - List of LinkLicense® part numbers. + - MACAddress - Returns (string) - MAC address of this device. For dual NIC devices, the LAN address is returned. + - ModelName - Returns (string) - Model name of this device + - PartNumber - Returns (string) - the part number of this device + - SerialNumber - Returns (string) - Serial number of this device + - UserUsage - Returns (tuple of ints) - user data usage of this device in KB (used, total). + + --- + + Events: + - ExecutiveModeChanged - (Event) Triggers when executive mode changes. The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is is the executive mode number. + - Offline - (Event) Triggers when the device goes offline. The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Offline'). + - Online - (Event) Triggers when the device comes online. The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Online'). + + --- + + Example: + ``` + # Create Primary Processor + ConfRoom = ProcessorDevice('Main') + + # Create Secondary Processor, Confirm Partnumber + ConfRoom3 = ProcessorDevice('profRobertsRm', '60-1234-01') + + # Create Touch Panel + PodiumTLP = UIDevice('Podium TLP') + + # Create System Switcher AV Device + SystemSwitcher = SPDevice('SysSwitcher') + ``` + """ + + CurrentLoad: float + """ the current load of 12V DC power supply in watts + + Note: + - This only applies to ProcessorDevice featuring 12V DC power supply. It returns None otherwise. + """ + DeviceAlias: str + ExecutiveMode: int + ExecutiveModeChanged: callable + """Event: Triggers when executive mode changes. + + The callback takes two arguments. The first is the extronlib.device instance triggering the event and the second is the executive mode number. + + --- + + Example: + ``` + @event(proc, 'ExecutiveModeChanged') + def HandleExecutiveMode(device, ExecutiveMode): + - print('Executive mode changed to {}.'.format(ExecutiveMode)) + ``` + """ + FirmwareVersion: str + HostName: str + IPAddress: str + """Note: + - For control processors with AV LAN, the LAN address is returned.""" + LinkLicenses: list[str] + """ List of LinkLicense® part numbers.""" + MACAddress: str + """ + Note: + - For control processors with AV LAN, the LAN address is returned. + """ + ModelName: str + Offline: callable + """ + Event: + - Triggers when the device goes offline. + + The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Offline'). + """ + Online: callable + """ + Event: + - Triggers when the device goes online. + + The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Online'). + """ + PartNumber: str + SerialNumber: str + UserUsage: tuple[int, int] + """user data usage of this device in KB (used, total).""" + SystemSettings: dict + """ + Returns: + - dict: a dictionary of data describing the settings (defined in Toolbelt) of this device + + --- + + Example: + ``` + { + - 'Network': { + - 'LAN': [ + - - 'DNSServers': ['192.168.1.1',], + - - 'Gateway': '192.168.254.1', + - - 'Hostname': 'ConfRoom', + - - 'IPAddress': '192.168.254.250', + - - 'SubnetMask': '255.255.255.0', + - - 'SearchDomains': ['extron.com',], + - ], + - 'AVLAN': [ + - - 'DHCPServer': 'Off', + - - 'DNSServers': ['192.168.1.1',], + - - 'Hostname': 'ConfRoom', + - - 'IPAddress': '192.168.253.251', + - - 'SubnetMask': '255.255.255.0', + - - 'SearchDomains': ['extron.com',], + - ], + - }, + - 'MailServer': { + - 'IPAddress': '192.168.254.100', + - 'SMTPPort': 25, + - 'SSLEnabled': True, + - 'UserID': 'jdoe', + - }, + - 'DateTime': { + - 'NTPSettings': { + - - 'Enabled': True, + - - 'Server': '192.168.254.101', # '' if Enable == False + - }, + - 'TimeZone': '(UTC-08:00/UTC-07:00) Pacific Time', + - } + - 'ProgramInformation': { + - 'Author': 'jdoe', + - 'DeviceName': 'IPCP Pro 550 : 192.168.254.250', + - 'FileLoaded': 'GS Project.gs', + - 'LastUpdated': '1/23/2016 9:08:29 AM', + - 'SoftwareVersion': '1.0.2.195', + - } + } + ``` + """ + + def __init__(self, DeviceAlias: str, PartNumber: str=None): + """ + ProcessorDevice class constructor. + + Arguments: + + - DeviceAlias (string) - Device Alias of the Extron device + - PartNumber (string) - device’s part number + """ + ... + + def Reboot(self) -> None: + """Performs a soft restart of this device – this is equivalent to rebooting a PC. + + --- + + ### WARNING + - Any unsaved data will be lost, including Program Log. Follow the example below. + + --- + + Example: + ``` + from extronlib.system import File, SaveProgramLog + from datetime import datetime + + # Save the ProgramLog for later inspection. + dt = datetime.now() + filename = 'ProgramLog {}.txt'.format(dt.strftime('%Y-%m-%d %H%M%S')) + + with File(filename, 'w') as f: + - SaveProgramLog(f) + + device.Reboot() + ``` + """ + ... + + def SetExecutiveMode(self, ExecutiveMode: int) -> float: + """ Sets the desired Executive Mode. + + --- + + Note: + - See product manual for list of available modes. + + --- + + Arguments: + - ExecutiveMode (int) - The mode to set. 0 to n. + """ + ... + + \ No newline at end of file diff --git a/device/UIDevice.py b/device/UIDevice.py new file mode 100644 index 0000000..0a00722 --- /dev/null +++ b/device/UIDevice.py @@ -0,0 +1,863 @@ +from typing import Union + + +class UIDevice(): + """Entity to communicate with Extron Device featuring user interactive input. + + Note: + - DeviceAlias must be a valid device Device Alias of an Extron device in the system. + - If the part number is provided, the device will trigger a warning message in the program log if it does not match the connected device. + + --- + + Arguments: + - DeviceAlias (string) - Device Alias of the Extron device + - (optional) PartNumber (string) - device’s part number + + --- + + Parameters: + - `AmbientLightValue` - Returns (int) - current ambient light value + - `AutoBrightness` - Returns (bool) - current auto brightness state + - `Brightness` - Returns (int) - current LCD brightness level + - `DeviceAlias` - Returns (string) - the device alias of the object + - `DisplayState` - Returns (string) - the current display state of the device ('On', 'Off'). Note This property is applicable to TLI only. + - `DisplayTimer` - Returns (int) - Return display timer timeout seconds + - `DisplayTimerEnabled` - Returns (bool) - current state of the display timer + - `FirmwareVersion` - Returns (string) - the firmware version of this device + - `Hostname` - Returns (string) - the hostname of this device + - `IPAddress` - Returns (string) - IP address of this device + - `InactivityTime` - Returns (string) - Seconds since last activity. Note 0 = Active, Nonzero = Time of inactivity. + - `LidState` - Returns (string) - the current lid state ('Opened' or 'Closed') + - `LightDetectedState` - Returns (string) - State of light detection. ('Detected', 'Not Detected') + - `MACAddress` - Returns (string) -MAC address of this device. Note For dual NIC devices, the LAN address is returned. + - `ModelName` - Returns (string) - Model name of this device + - `MotionDecayTime` - Returns (int) - the period of time to trigger MotionDetected event after last motion was detected. The default (and minimum) value is 10 seconds. + - `MotionState` - Returns (string) - the state of the Motion sensor (e.g. Motion, No Motion) + - `PartNumber` - Returns (string) - the part number of this device + - `SerialNumber` - Returns (string) - Serial number of this device + - `SleepState` - Returns (string) - the current sleep state of the device ('Asleep', 'Awake') + - `SleepTimer` - Returns (int) - sleep timer timeout + - `SleepTimerEnabled` - Returns (bool) - True if sleep timer is enabled + - `UserUsage` - Returns (tuple of ints) - user data usage of this device in KB (used, total). + - `WakeOnMotion` - Returns (bool) - current wake on motion state + + --- + + Events: + - `BrightnessChanged` (Event) Triggers when LCD brightness has changed. The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second one is the current brightness level as an integer. + - `HDCPStatusChanged` (Event) Triggers when HDCP Status changes. The callback takes two arguments. The first one is the UIDevice instance triggering the event and state with a tuple (Input, Status). + - `InactivityChanged` (Event) Triggers at times specified by SetInactivityTime() after state transition of inactivity timer. The callback takes two arguments. The first one is the UIDevice instance triggering the event and time with a float value of inactivity time in seconds. + - `InputPresenceChanged` (Event) Triggers when Input Presence changes. The callback takes two arguments. The first one is the UIDevice instance triggering the event and state with a tuple (Input, Status). + - `LidChanged` (Event) Triggers when the Lid state changes. The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second is the current lid state ('Opened' or 'Closed'). + - `LightChanged` (Event) Triggers when ambient light changes. The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second is the ambient light level in the range of 0 ~ 255. + - `MotionDetected` (Event) Triggers when Motion is detected. The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second one is a string ('Motio' or 'No Motion') + - `Offline` (Event) Triggers when the device goes offline. The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Offline'). + - `Online` (Event) Triggers when the device comes online. The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Online'). + - `SleepChanged` (Event) Triggers when sleep state changes. The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second one is a string ('Asleep' or 'Awake'). + + --- + + Example: + ``` + # Create Primary Processor + ConfRoom = ProcessorDevice('Main') + + # Create Secondary Processor, Confirm Partnumber + ConfRoom3 = ProcessorDevice('profRobertsRm', '60-1234-01') + + # Create Touch Panel + PodiumTLP = UIDevice('Podium TLP') + + # Create System Switcher AV Device + SystemSwitcher = SPDevice('SysSwitcher') + ``` + """ + + DeviceAlias: str + PartNumber: str + AmbientLightValue: int + AutoBrightness: bool + Brightness: int + BrightnessChanged: callable + """ + ## Event: + - Triggers when LCD brightness has changed. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second one is the current brightness level as an integer. + + --- + + Example: + ``` + @event(PodiumTLP, 'BrightnessChanged') + def HandleBrightnessChanged(tlp, brightness): + print('{} Brightness Changed: {}'.format(tlp.DeviceAlias, brightness)) + ``` + """ + DisplayState: str + """ the current display state of the device ('On', 'Off') + + Note: + - This property is applicable to TLI only. + """ + DisplayTimer: int + """Return display timer timeout seconds""" + DisplayTimerEnabled: bool + FirmwareVersion: str + HDCPStatusChanged: callable + """ + ## Event: + - Triggers when HDCP Status changes. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and state with a tuple: (Input, Status). + + --- + + Example: + ``` + @event(PodiumTLP, 'HDCPStatusChanged') + def HandleHDCPStatusChangedChange(tlp, state): + if state[0] == 'HDMI' and not state[1]: + PodiumTLP.ShowPopup('No HDCP') + ``` + """ + Hostname: str + IPAddress: str + InactivityChanged: callable + """ + ## Event: + - Triggers at times specified by SetInactivityTime() after state transition of inactivity timer. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and time with a float value of inactivity time in seconds. + + --- + + Example: + ``` + PodiumTLP = UIDevice('Podium TLP') + PodiumTLP.SetInactivityTime([3000, 3600]) # Fifty minutes and One hour + + @event(PodiumTLP, 'InactivityChanged') + def UnoccupyRoom(tlp, time): + if time == 3000: + ShowWarning() + else: + ShutdownSystem() + ``` + """ + InactivityTime: int + """ Seconds since last activity. + + Note: + - 0 = Active, Nonzero = Time of inactivity. + """ + InputPresenceChanged: callable + """ + ## Event: + - Triggers when Input Presence changes. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and state with a tuple: (Input, Status). + + --- + + Example: + ``` + @event(PodiumTLP, 'InputPresenceChanged') + def HandleInputPresenceChanged(tlp, state): + if state[0] == 'HDMI' and not state[1]: + if PodiumTLP.GetInputPresence('XTP'): + PodiumTLP.SetInput('XTP') + else: + PodiumTLP.ShowPopup('No Input Available') + ``` + """ + LidChanged: callable + """ + ## Event: + - Triggers when the Lid state changes. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second is the current lid state ('Opened' or 'Closed'). + """ + LidState: str + """the current lid state ('Opened' or 'Closed')""" + LightChanged: callable + """ + ## Event: + - Triggers when ambient light changes + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second is the ambient light level in the range of 0 ~ 255. + """ + LightDetectedState: str + """State of light detection. ('Detected', 'Not Detected')""" + MACAddress: str + ModelName: str + MotionDecayTime: int + """ the period of time to trigger MotionDetected event after last motion was detected. The default (and minimum) value is 10 seconds.""" + MotionDetected: callable + """ + ## Event: + - Triggers when Motion is detected. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second one is a string ('Motion' or 'No Motion'). + """ + MotionState: str + """the state of the Motion sensor (e.g. Motion, No Motion)""" + Offline: callable + """ + ## Event: + - Triggers when the device goes offline. + + The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Offline'). + """ + Online: callable + """ + ## Event: + - Triggers when the device comes online. + + The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Online'). + """ + PartNumber: str + SerialNumber: str + SleepChanged: callable + """ + ## Event: + - Triggers when sleep state changes. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second one is a string ('Asleep' or 'Awake'). + + + --- + + Example: + ``` + @event(PodiumTLP, 'SleepChanged') + def HandleSleepChanged(tlp, state): + print('{} Sleep State Changed: {}'.format(tlp.DeviceAlias, state)) + ``` + """ + SleepState: str + """the current sleep state of the device ('Asleep', 'Awake')""" + SleepTimer: int + """sleep timer timeout""" + SleepTimerEnabled: bool + UserUsage: tuple[int, int] + """user data usage of this device in KB (used, total).""" + WakeOnMotion: bool + OverTemperature: int + """ + Returns: the current operating temperature value, in degrees Centigrade, as a differential from the product maximum operating temperature. + + Return type: int + + Note: + - This feature only supported by the TLI Pro 201 TouchLink Interface. + + ## Warning: + - Not implemented. + + --- + + Example: + ``` + # If the product is 5 degrees C over maximum operating temperature, this + # prints 5. + print(PoduiumTLP.OverTemperature) + + # If the product is 15 degrees C below maximum operating temperature, this + # prints -15. + print(PoduiumTLP.OverTemperature) + ``` + """ + OverTemperatureChanged: callable + """ + ## Event: + - Triggers when Over Temperature changes. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second is the new temperature differential as an integer. + + Note: + - This event triggers for each 1 degree change but no more than once every 10 seconds if the temperature is oscillating. + - This feature only supported by the TLI Pro 201 TouchLink Interface + - New in version 1.1. + + --- + + Example: + ``` + @event(PodiumTLP, 'OverTemperatureChanged') + def HandleOverTemperatureChanged(tlp, temp): + print('Podium TLP OverTemperature is ' + str(temp)) + ``` + """ + OverTemperatureWarning: callable + """ + ## Event: + - Triggers when the product’s operating temperature exceeds the maximum by 5 percent. + + Note: + - This event retriggers once every minute until the operating temperature falls below the maximum operating temperature. + - This feature only supported by the TLI Pro 201 TouchLink Interface + - New in version 1.1. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second is current operating temperature in degrees Centigrade over the maximum as an integer. + + --- + + Example: + ``` + @event(PodiumTLP, 'OverTemperatureWarning') + def HandleOverTemperatureWarning(device, temp): + print('The podium TLP is {} degrees over maximum operating temperature.'.format(temp)) + ``` + """ + OverTemperatureWarningState: bool + """ + Returns: + - Whether this device is currently over temperature. + + Return type: + - bool + + Note: + - This feature only supported by the TLI Pro 201 TouchLink Interface. + - New in version 1.1. + + --- + + Example: + ``` + if PodiumTLP.OverTemperatureWarningState: + print('Podium TLP is over maximum temperature.') + ``` + """ + OverTemperatureWarningStateChanged: callable + """ + ## Event: + - Triggers when the product’s operating temperature warning changes state. + + Note: + - This feature only supported by the TLI Pro 201 TouchLink Interface. + - New in version 1.1. + + The callback takes two arguments. The first one is the UIDevice instance triggering the event and the second is current state of the over temperature warning as a bool. + + --- + + Example: + ``` + @event(PodiumTLP, 'OverTemperatureWarningStateChanged') + def HandleOverTemperatureWarningStateChanged(device, state): + if state: + print('The podium TLP is over maximum operating temperature.') + else: + print('The podium TLP operating temperature is normal.') + ``` + """ + SystemSettings: dict + """ + Returns: + - a dictionary of data describing the settings (defined in Toolbelt) of this device + + Return type: + - dict + + --- + + Example: + ``` + { + 'Network': { + 'LAN': [ + - 'DNSServers': ['192.168.1.1',], + - 'Gateway': '192.168.254.1', + - 'Hostname': 'ConfRoom', + - 'IPAddress': '192.168.254.250', + - 'SubnetMask': '255.255.255.0', + - 'SearchDomains': ['extron.com',], + ], + }, + 'ProgramInformation': { + 'Author': 'jdoe', + 'DeviceName': 'TLP Pro 720T : 192.168.254.251', + 'FileLoaded': 'GS Project.gs', + 'LastUpdated': '1/23/2016 9:08:29 AM', + 'SoftwareVersion': '1.0.2.195', + } + } + ``` + """ + + + + + def __init__(self, DeviceAlias: str, PartNumber: str=None) -> None: + """ + UIDevice class constructor. + + Arguments: + - DeviceAlias (string) - Device Alias of the Extron device + - (optional) PartNumber (string) - device’s part number + """ + ... + + def Click(self, count: int=1, interval: float=None) -> None: + """ Play default buzzer sound on applicable device + + Arguments: + - (optional) count (int) - number of buzzer sound to play + - (optional) interval (float) - time gap between the starts of consecutive buzzer sounds + + Note: + If count is greater than 1, interval must be provided. + """ + ... + + def GetHDCPStatus(self, videoInput: str) -> bool: + """ Return the current HDCP Status for the given input. + + Arguments: + - videoInput (string) - input ('HDMI' or 'XTP') + + --- + + Returns: + - True or False (bool) + + --- + + Example: + ``` + HDCPStatus = PodiumTLP.GetHDCPStatus('XTP') + if not HDCPStatus: + PodiumTLP.ShowPopup('No HDCP') + ``` + """ + ... + + def GetInputPresence(self, videoInput: str) -> bool: + """ Return the current input presence status for the given input. + + Arguments: + - videoInput (string) - input ('HDMI' or 'XTP') + + --- + + Returns: + - True or False (bool) + + --- + + Example: + ``` + InputPresence = PodiumTLP.GetInputPresence('XTP') + if not InputPresence: + PodiumTLP.ShowPopup('No XTP') + ``` + """ + ... + + def GetMute(self, name: str) -> str: + """ Get the mute state for the given channel + + The defined channel names are: + - 'Master' - the master volume + - 'Speaker' - the built-in speakers + - 'Line' - the line out + - 'Click' - button click volume + - 'Sound' - sound track playback volume + - 'HDMI' - HDMI input volume + - 'XTP' - XTP input volume + + --- + + Arguments: + - name (string) - name of channel. + + --- + + Returns: + - mute state ('On' or 'Off') (string) + + --- + + Example: + ``` + @event(ToggleMute, 'Pressed') + def toggleMute(button, state): + if PodiumTLP.GetMute('HDMI') == 'On': + PodiumTLP.SetMute('HDMI', 'Off') + else: + PodiumTLP.SetMute('HDMI', 'On') + ``` + """ + return '' + + def GetVolume(self, name: str) -> int: + """ Return current volume level for the given channel + + The defined channel names are: + - 'Master' - the master volume + - 'Click' - button click volume + - 'Sound' - sound track playback volume + - 'HDMI' - HDMI input volume + - 'XTP' - XTP input volume + + --- + + Arguments: + - name (string) - name of volume channel. + + --- + + Returns: + - volume level (int) + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def RefreshPage(button, state): + currentVolume = PodiumTLP.GetVolume('HDMI') + ... + ``` + """ + return 0 + + def HideAllPopups(self) -> None: + """ Dismiss all popup pages """ + ... + + def HidePopup(self, popup: Union[int, str]) -> None: + """ Hide popup page + + Arguments: + - popup (int, string) - popup page number or name + """ + ... + + def HidePopupGroup(self, group: int) -> None: + """ Hide all popup pages in a popup group + + Arguments: + - group (int) - popup group number + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def Reset(button, state): + PodiumTLP.HidePopupGroup(1) + ``` + """ + ... + + def PlaySound(self, filename: str) -> None: + """ Play a sound file identified by the filename + + Arguments: + - filename (string) - name of sound file + + --- + + Note: + - Only WAV files can be played. + - A subsequent call will preempt the currently playing file. + - Sound file must be added to the project file. + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def OccupyRoom(button, state): + PodiumTLP.SetLEDBlinking(65533, 'Slow', ['Red', 'Off']) + PodiumTLP.PlaySound('startup.wav') + ``` + """ + ... + + def Reboot(self) -> None: + """Performs a soft restart of this device – this is equivalent to rebooting a PC.""" + ... + + def SetAutoBrightness(self, state: Union[bool, str]) -> None: + """ Set auto brightness state. Either 'On' or True turns on auto brightness. 'Off' or False turns off auto brightness. + + Arguments: + - state (bool, string) - whether to enable auto brightness + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def Initialize(button, state): + PodiumTLP.SetAutoBrightness('On') + ``` + """ + ... + + def SetBrightness(self, level: int) -> None: + """ Set LCD screen brightness level + + Arguments: + - level (int) - brightness level from 0 ~ 100 + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def Initialize(button, state): + PodiumTLP.SetAutoBrightness('Off') + PodiumTLP.SetBrightness(50) + ``` + """ + ... + + def SetDisplayTimer(self, state: Union[bool, str], timeout: int) -> None: + """ Enable/disable display timer. Either 'On' or True enables display timer. 'Off' or False disables display timer. + + Note: + - Display timer is applicable to TLI only. + + Arguments: + - state (bool, string) - whether to enable the display timer + - timeout (int) - time in seconds before turn off the display + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def Initialize(button, state): + PodiumTLP.SetDisplayTimer(True, 180) + ``` + """ + ... + + def SetInactivityTime(self, times: list[int]) -> None: + """ Set the inactivity times of the UIDevice. When each time expires, the InactivityChanged event will be triggered. All times are absolute. + + Arguments: + - times (list of ints) - list of times. Each time in whole seconds + + --- + + Example: + ``` + PodiumTLP = UIDevice('Podium TLP') + PodiumTLP.SetInactivityTime([3000, 3600]) # Fifty minutes and One hour + + @event(PodiumTLP, 'InactivityChanged') + def UnoccupyRoom(tlp, time): + if time == 3000: + ShowWarning() + else: + ShutdownSystem() + ``` + """ + ... + + def SetInput(self, videoInput: str) -> None: + """ Sets the input. Inputs must be published for each device. + + Arguments: + - videoInput (string) - input to select ('HDMI' or 'XTP') + + --- + + Example: + >>> PodiumTLP.SetInput('HDMI') + """ + ... + + def SetLEDBlinking(self, ledId: int, rate: str, stateList: list[str]) -> None: + """ Make the LED cycle, at ADA compliant rates, through each of the states provided. + + --- + + Blink rates: + ``` + +-----------+-------------+ + | Rate | Frequency | + +===========+=============+ + | Slow | 0.5 Hz | + +-----------+-------------+ + | Medium | 1 Hz | + +-----------+-------------+ + | Fast | 2 Hz | + +-----------+-------------+ + ``` + Note: + - Using this function will blink in unison with other LEDs. + + --- + + Arguments: + - ledId (int) - LED id + - rate (string) - ADA compliant blink rate. ('Slow', 'Medium', 'Fast') + - stateList (list of strings) - List of colors + + Note: + - Available colors are Red, Green, and Off. + + --- + + Example: + ``` + PodiumTLP = UIDevice('Podium TLP') + + @event(ButtonObject, 'Pressed') + def UnoccupyRoom(button, state): + PodiumTLP.SetLEDBlinking(65533, 'Slow', ['Off', 'Red']) + ``` + """ + ... + + def SetLEDState(self, ledId: int, state: str) -> None: + """ Drive the LED to the given color + + Arguments: + - ledId (int) - LED id + - rate (string) - LED color or ‘Off’. + + Note: + - Available colors are Red, Green, and Off. + + --- + + Example: + ``` + @event(SomeOtherButton, 'Released') + def UnoccupyRoom(button, state): + PodiumTLP.SetLEDState(65533, 'Off') + ``` + """ + ... + + def SetMotionDecayTime(self, duration: float) -> None: + """ Set the period of time to trigger MotionDetected after last motion was detected. + + Arguments: + - duration (float) - time in seconds (minimum/default value is 10) + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def Initialize(button, state): + PodiumTLP.SetMotionDecayTime(30) + ``` + """ + ... + + def SetMute(self, name: str, mute: str) -> None: + """ Set the mute state for the given channel + + The defined channel names are: + - 'Master' - the master volume + - 'Speaker' - the built-in speakers + - 'Line' - the line out + - 'Click' - button click volume + - 'Sound' - sound track playback volume + - 'HDMI' - HDMI input volume + - 'XTP' - XTP input volume + + --- + + Arguments: + - name (string) - name of channel. + - mute (string) - mute state ('On' or 'Off') + + --- + + Example: + ``` + @event(ToggleMute, 'Pressed') + def toggleMute(button, state): + if PodiumTLP.GetMute('HDMI') == 'On': + PodiumTLP.SetMute('HDMI', 'Off') + else: + PodiumTLP.SetMute('HDMI', 'On') + ``` + """ + ... + + def SetSleepTimer(self, state: Union[bool, str], duration: int=None) -> None: + """ Enable/disable sleep timer. Either 'On' or True enables sleep timer. 'Off' or False disables sleep timer. + + Arguments: + - state (bool, string) - name of channel. + - (optional) duration (int) - time in seconds to sleep + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def Initialize(button, state): + PodiumTLP.SetSleepTimer('On', 60) + ``` + """ + ... + + def SetVolume(self, name: str, level: int) -> None: + """ Adjust volume level for the given channel + + The defined channel names are: + - 'Master' - the master volume + - 'Click' - button click volume + - 'Sound' - sound track playback volume + - 'HDMI' - HDMI input volume + - 'XTP' - XTP input volume + + Arguments: + - name (string) - name of channel. + - level (int) - volume level 0 ~ 100 + """ + ... + + def SetWakeOnMotion(self, state: Union[bool, str]) -> None: + """ Enable/disable wake on motion. + + Arguments: + - state (bool, string) - True ('On') or False (‘Off’) to enable and disable wake on motion, respectively. + """ + ... + + def ShowPage(self, page: Union[int, str]) -> None: + """ Show page on the screen + + Arguments: + - page (int, string) - absolute page number or name + """ + ... + + def ShowPopup(self, popup: Union[int, str], duration: float=0) -> None: + """ Display pop-up page for a period of time. + + Arguments: + - page (int, string) - pop-up page number or name + - (optional) duration (float) - duration the pop-up remains on the screen. 0 means forever. + + Note: + - If a pop-up is already showing for a finite period of time, calling this method again with the same pop-up will replace the remaining period with the new period. + """ + ... + + def Sleep(self): + """ Force the device to sleep immediately """ + ... + + def StopSound(self): + """ Stop playing sound file """ + ... + + def Wake(self): + """ Force the device to wake up immediately """ + ... diff --git a/device/__init__.py b/device/__init__.py new file mode 100644 index 0000000..41d2f26 --- /dev/null +++ b/device/__init__.py @@ -0,0 +1,3 @@ +from eBUSDevice import eBUSDevice +from ProcessorDevice import ProcessorDevice +from UIDevice import UIDevice \ No newline at end of file diff --git a/device/eBUSDevice.py b/device/eBUSDevice.py new file mode 100644 index 0000000..7e1bdbe --- /dev/null +++ b/device/eBUSDevice.py @@ -0,0 +1,271 @@ +import ProcessorDevice +from typing import Optional, Union + + +class eBUSDevice(): + """ Defines common interface to Extron eBUS panels + + --- + + Parameters: + - Host (`ProcessorDevice`) - handle to Extron ProcessorDevice to which the eBUSDevice is connected + - DeviceAlias (`string`) - Device Alias of the Extron device + + --- + + Properties: + - DeviceAlias - Returns (`string`) - the device alias of the object + - Host - Returns (extronlib.device.ProcessorDevice) - Handle to the Extron ProcessorDevice to which the eBUSDevice is connected. + - ID - Returns (`int`) - device’s ID (set by DIP switch) + - InactivityTime - Returns (`int`) - Seconds since last activity. Note: 0 = Active, Nonzero = Time of inactivity + - LidState - Returns (`string`) - the current lid state ('Opened' | 'Closed') + - ModelName - Returns (`string`) - Model name of this device + - PartNumber - Returns (`string`) - the part number of this device + - SleepState - Returns (`string`) - the current sleep state of the device ('Asleep', 'Awake') + - SleepTimer - Returns (`int`) - sleep timer timeout + - SleepTimerEnabled - Returns (`bool`) - True if sleep timer is enabled + + --- + + Events: + - `InactivityChanged` - (Event) Triggers at times specified by SetInactivityTime(`int`) after state transition of inactivity timer. The callback takes two Parameters. The first one is the eBUSDevice instance triggering the event and time with a float value of inactivity time in seconds. + - `LidChanged` - (Event) Triggers when the Lid state changes.The callback takes two Parameters. The first one is the eBUSDevice instance triggering the event and the second is the current lid state ('Opened' | 'Closed'). + - `Offline` - (Event) Triggers when the device goes offline. The callback takes two Parameters. The first one is the extronlib.device instance triggering the event and the second one is a string ('Offline'). + - `Online` - (Event) Triggers when the device comes online. The callback takes two Parameters. The first one is the extronlib.device instance triggering the event and the second one is a string ('Online'). + - `SleepChanged` - (Event) Triggers when sleep state changes. The callback takes two Parameters. The first one is the eBUSDevice instance triggering the event and the second one is a string ('Asleep' | 'Awake'). + """ + def __init__(self, Host: object, DeviceAlias: str) -> None: + """ + eBUSDevice class constructor. + + --- + + Parameters: + - Host (`object`) - handle to Extron ProcessorDevice to which the eBUSDevice is connected + - DeviceAlias (`string`) - Device Alias of the Extron device + """ + + self.InactivityChanged: callable = None + """ + Event: + - Triggers at times specified by SetInactivityTime() after state transition of inactivity timer. + - The callback takes two arguments. The first one is the eBUSDevice instance triggering the event and time with a float value of inactivity time in seconds. + + --- + + ``` + PodiumPanel = eBUSDevice('Podium Panel') + PodiumPanel.SetInactivityTime([3000, 3600]) # Fifty minutes and One hour + + @event(PodiumPanel, 'InactivityChanged') + def UnoccupyRoom(Panel, time): + if time == 3000: + ShowWarning() + else: + ShutdownSystem() + ``` + + Note: + Applies to EBP models only. + """ + self.SleepChanged: callable = None + """ + Event: + - Triggers when sleep state changes. + - The callback takes two arguments. The first one is the eBUSDevice instance triggering the event and the second one is a string ('Asleep' or 'Awake'). + + --- + ``` + @event(PodiumPanel, 'SleepChanged') + def HandleSleepChanged(Panel, state): + print('{} Sleep State Changed: {}'.format(Panel.DeviceAlias, state)) + ``` + """ + self.LidChanged: callable = None + """ + Event: + - Triggers when the Lid state changes. + - The callback takes two arguments. The first one is the eBUSDevice instance triggering the event and the second is the current lid state ('Opened' or 'Closed'). + """ + self.Offline: callable = None + """ + Event: + - Triggers when the device goes offline. + - The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Offline'). + """ + self.Online: callable = None + """ + Event: + - Triggers when the device comes online. + - The callback takes two arguments. The first one is the extronlib.device instance triggering the event and the second one is a string ('Online'). + """ + self.SleepTimerEnabled: bool = False + self.DeviceAlias: str = DeviceAlias + self.Host: ProcessorDevice = Host + """ Handle to the Extron ProcessorDevice to which the eBUSDevice is connected. """ + self.InactivityTime: int = 0 + """Seconds since last activity. + + Note: + - 0 = Active, Nonzero = Time of inactivity. + - Applies to EBP models only. + """ + self.SleepState: str = '' + """ the current sleep state of the device ('Asleep', 'Awake')""" + self.PartNumber: str = '' + self.ModelName: str = '' + self.LidState: str = '' + """the current lid state ('Opened' or 'Closed')""" + self.SleepTimer: int = 0 + """ sleep timer timeout""" + self.ID: int = 0 + """device’s ID (set by DIP switch)""" + + + + def Click(self, count: int=1, interval: int=None) -> None: + """ Play default buzzer sound on applicable device + + --- + + Parameters: + - count (`int`) - number of buzzer sound to play + - interval (`int`) - time gap in millisecond between consecutive sounds + """ + ... + + def GetMute(self, name: str) -> str: + """ Get the mute state for the given channel + + --- + + The defined channel names are: + - 'Click' - button click volume + + --- + + Parameters: + - name (`string`) - name of channel. + + --- + + Returns + - mute state ('On' | 'Off') (`string`) + """ + ... + + def Reboot(self) -> None: + """Performs a soft restart of this device – this is equivalent to rebooting a PC.""" + ... + + def SendCommand(self, command: str, value: Union[int, tuple[int]]) -> None: + """Send command to eBUSDevice. + + --- + + Args: + - command (`string`): command name to issue + - value (`int | tuple[int]`): command specific value to pass with commend + + --- + + Example: + ``` + VoiceLiftDevice.SendCommand('Chime', 1) # Enable Chime + VoiceLiftDevice.SendCommand('Usage') # Query usage + ``` + + --- + + Note: + - For supported eBUS devices. + - See device documentation for supported commands. + """ + ... + + def SetInactivityTime(self, times: list[int]) -> None: + """ Set the inactivity times of the eBUSDevice. When each time expires, the InactivityChanged event will be triggered. All times are absolute. + + --- + + Parameters: + - times (`list of ints`) - list of times. Each time in whole seconds + + --- + + Example: + ``` + PodiumPanel = eBUSDevice('Podium Panel') + PodiumPanel.SetInactivityTime([3000, 3600]) # Fifty minutes and One hour + + @event(PodiumPanel, 'InactivityChanged') + def UnoccupyRoom(Panel, time): + if time == 3000: + ShowWarning() + else: + ShutdownSystem() + ``` + + --- + + Note: + - Applies to EBP models only. + """ + ... + + def SetMute(self, name: str, mute: str) -> None: + """ Set the mute state for the given channel + + --- + + The defined channel names are: + - `Click` - button click volume + + --- + + Parameters: + - name (`string`) - name of channel. + - mute (`string`) - mute state ('On' | 'Off') + + --- + + Example: + ``` + @event(ToggleMute, 'Pressed') + def toggleMute(button, state): + if PodiumEBP.GetMute('Click') == 'On': + PodiumEBP.SetMute('Click', 'Off') + else: + PodiumEBP.SetMute('Click', 'On') + ``` + """ + ... + + def SetSleepTimer(self, state: Union[bool, str], duration: int=None) -> None: + """ Enable/disable sleep timer. Either 'On' | True enables sleep timer. 'Off' | False disables sleep timer. + + --- + + Parameters: + - state (bool, string) - whether to enable the sleep timer + - (optional) duration (`int`) - time in seconds to sleep (`int`) + + --- + + Example: + ``` + @event(ButtonObject, 'Pressed') + def Initialize(button, state): + PodiumPanel.SetSleepTimer('On', 60) + ``` + """ + ... + + def Sleep(self) -> None: + """ Force the device to sleep immediately """ + ... + + def Wake(self) -> None: + """ Force the device to wake up immediately """ + ... + diff --git a/interface/CircuitBreakerInterface.py b/interface/CircuitBreakerInterface.py new file mode 100644 index 0000000..c18ba6d --- /dev/null +++ b/interface/CircuitBreakerInterface.py @@ -0,0 +1,72 @@ +class CircuitBreakerInterface(): + """ This class provides a common interface to a circuit breaker on an Extron product (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + - Host (object) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'CBR1') + + Parameters: + - Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port - Returns (string) - port name + - State - Returns (string) - current state of the circuit breaker ('Closed', 'Tripped') + + Events: + - Offline - (Event) Triggers when the device goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + - Online - (Event) Triggers when the device comes online. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + - StateChanged - (Event) Triggers when the circuit breaker state changes. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event, and the second is a string ('Closed' or 'Tripped'). + """ + + Host: object + """handle to Extron device class that instantiated this interface class""" + + Port: str + + State: str + """current state of the circuit breaker ('Closed', 'Tripped')""" + + Offline = None + """ + Event: + - Triggers when port goes offline + - The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + + --- + ``` + @event(SomeInterface, ['Online', 'Offline']) + def HandleConnection(interface, state): + print('{} is now {}'.format(interface.Port, state)) + ``` + """ + + Online = None + """ + Event: + - Triggers when port goes online + - The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + """ + + StateChanged = None + """ + Event: + - Triggers when the circuit breaker state changes. + - The callback takes two arguments. The first one is the extronlib.interface instance triggering the event, and the second is a string ('Closed' or 'Tripped'). + + --- + ``` + @event(SomeInterface, 'StateChanged') + def HandleStateChanged(interface, state): + if state == 'Tripped': + TrippedAlert() + ``` + """ + + def __init__(self, Host: object, Port: str): + """ + CircuitBreaker class constructor. + + Arguments: + - Host (object) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'CBR1') + """ + ... + diff --git a/interface/ClientObject.py b/interface/ClientObject.py new file mode 100644 index 0000000..2f6823b --- /dev/null +++ b/interface/ClientObject.py @@ -0,0 +1,42 @@ +from typing import Union + + +class ClientObject(): + """ This class provides a handle to connected clients to an EthernetServerInterfaceEx. + + Note: + - This class cannot be instantiated by the programmer. It is only created by the `EthernetServerInterfaceEx` object. + + Parameters: + - Hostname - Returns (string) - Hostname DNS name of the connection. Can be the IP Address + - IPAddress - Returns (string) - the IP Address of the connected device + - ServicePort - Returns (int) - ServicePort port on which the client will listen for data + """ + Hostname: str + """Hostname DNS name of the connection. Can be the IP Address""" + IPAddress: str + """the IP Address of the connected device""" + ServicePort: int + """ServicePort port on which the client will listen for data""" + + def __init__(self): + """ ClientObject class constructor. """ + ... + + def Disconnect(self): + """ Closes the connection gracefully on client. """ + ... + + def Send(self, data: Union[bytes, str]) -> None: + """ Send string to the client. + + Arguments: + - data (bytes, string) - string to send out + + Raises: + - TypeError + - IOError + + >>> client.Send(b'Hello.\n') + """ + ... diff --git a/interface/ContactInterface.py b/interface/ContactInterface.py new file mode 100644 index 0000000..c47de62 --- /dev/null +++ b/interface/ContactInterface.py @@ -0,0 +1,69 @@ +class ContactInterface(): + """ This class will provide a common interface for controlling and collecting data from Contact Input ports on Extron devices (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'CII1') + + Parameters: + - Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port - Returns (string) - port name + - State - Returns (string) - current state of IO port ('On', 'Off') + + Events: + - Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + - Online - (Event) Triggers when port goes online. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + - StateChanged - (Event) Triggers when the input state changes. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('On' or 'Off'). + """ + Host: object + """ handle to Extron device class that instantiated this interface class""" + Port: str + """the port name this interface is attached to""" + Offline = None + """ + Event: + - Triggers when port goes offline + - The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + + --- + ``` + @event(SomeInterface, ['Online', 'Offline']) + def HandleConnection(interface, state): + print('{} is now {}'.format(interface.Port, state)) + ``` + """ + Online = None + """ + Event: + - Triggers when port goes online + - The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + """ + Port: str + """ the port name this interface is attached to""" + State: str + """ current state of IO port ('On', 'Off')""" + StateChanged = None + """ + Event: + - Triggers when the input state changes. + - The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('On' or 'Off'). + + --- + ``` + @event(InputInterface, 'StateChanged') + def HandleStateChanged(interface, state): + if state == 'On': + StartCombinedInit() + else: + StartSeparateInit() + ``` + """ + + def __init__(self, Host: object, Port: str): + """ ContactInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'CII1') + """ + ... diff --git a/interface/DigitalIOInterface.py b/interface/DigitalIOInterface.py new file mode 100644 index 0000000..f624aad --- /dev/null +++ b/interface/DigitalIOInterface.py @@ -0,0 +1,74 @@ +class DigitalIOInterface(): + """ This class will provide a common interface for controlling and collecting data from Digital IO ports on Extron devices (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g. 'DIO1') + (optional) Mode (string) - Possible modes are: 'DigitalInput' (default), and 'DigitalOutput' + (optional) Pullup (bool) - pull-up state on the port + + Parameters: + Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + Mode - Returns (string) - mode of the Digital IO port ('DigitalInput', 'DigitalOutput') + Port - Returns (string) - port name + Pullup - Returns (bool) - indicates if the Input port is being pulled up or not + State - Returns (string) - current state of Input port ('On', 'Off') + + Events: + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes online. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + StateChanged - (Event) Triggers when the input state changes. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('On' or 'Off'). + """ + Host = None + Port = '' + Mode = '' + Pullup = False + Offline = None + Online = None + State = '' + StateChanged = None + + def __init__(self, Host, Port, Mode='DigitalInput', Pullup=False): + """ DigitalIOInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'DIO1') + - (optional) Mode (string) - Possible modes are: 'DigitalInput' (default), and 'DigitalOutput' + - (optional) Pullup (bool) - pull-up state on the port + """ + self.Host = Host + self.Port = Port + self.Mode = Mode + + self.Pullup = Pullup + + def Initialize(self, Mode=None, Pullup=None): + """ Initializes Digital IO Port to given values. User may provide any or all of theparameters. None leaves property unmodified. + + Arguments: + - (optional) Mode (string) - Possible modes are: 'DigitalInput' (default), and 'DigitalOutput' + - (optional) Pullup (bool) - pull-up state on the port + """ + pass + + def Pulse(self, duration): + """ Turns the port on for the specified time in seconds with 10ms accuracy and a 100ms minimum value. + + Arguments: + - duration (float) - pulse duration + """ + pass + + def SetState(self, State): + """ Sets output state to be set ('On' or 1, 'Off' or 0) + + Arguments: + - State (int, string) - output state to be set ('On' or 1, 'Off' or 0) + """ + pass + + def Toggle(self): + """ Changes the state of the IO Object to the logical opposite of the current state. + """ + pass diff --git a/interface/DigitalInputInterface.py b/interface/DigitalInputInterface.py new file mode 100644 index 0000000..b72a874 --- /dev/null +++ b/interface/DigitalInputInterface.py @@ -0,0 +1,45 @@ +class DigitalInputInterface(): + """ This class will provide a common interface for collecting data from Digital Input ports on Extron devices (extronlib.device). he user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'DII1') + - (optional) Pullup (bool) - pull-up state on the port + + Parameters: + - Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port - Returns (string) - port name + - Pullup - Returns (bool) - indicates if the Input port is being pulled up or not + - State - Returns (string) - current state of Input port ('On', 'Off') + + Events: + - Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + - Online - (Event) Triggers when port goes online. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + - StateChanged - (Event) Triggers when the input state changes. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('On' or 'Off'). + """ + Host = None + Port = '' + Pullup = False + State = '' + Online = None + Offline = None + StateChanged = None + + def __init__(self, Host: object, Port: str, Pullup: bool=False): + """ DigitalInputInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'DII1') + - (optional) Pullup (bool) - pull-up state on the port + """ + ... + + def Initialize(self, Pullup=None): + """ Initializes Digital Input Port to given values. User may provide any or all of theparameters. None leaves property unmodified. + + Arguments: + - (optional) Pullup (bool) - pull-up state on the port + """ + ... + diff --git a/interface/EthernetClientInterface.py b/interface/EthernetClientInterface.py new file mode 100644 index 0000000..7a43be8 --- /dev/null +++ b/interface/EthernetClientInterface.py @@ -0,0 +1,123 @@ +class EthernetClientInterface(): + """ This class provides an interface to a client ethernet socket. This class allows the user to send data over the ethernet port in a synchronous or asynchronous manner. + + Note: In synchronous mode, the user will use SendAndWait to wait for the response. In asynchronous mode, the user will assign a handler function to ReceiveData event handler. Then responses and unsolicited messages will be sent to the users receive data handler. + + Arguments: + Hostname (string) - DNS Name of the connection. Can be IP Address + IPPort (int) - IP port number of the connection + (optional) Protocol (string) - Value for either 'TCP', 'UDP', or 'SSH' + (optional) ServicePort (int) - Sets the port on which to listen for response data, UDP only, zero means listen on port OS assigns + (optional) Credentials (tuple) - Username and password for SSH connection. + + Parameters: + Credentials - Returns (tuple, bool) - Username and password for SSH connection. + + >Note: + > returns tuple: ('username', 'password') if provided otherwise None. + > only applies when protocol 'SSH' is used. + Hostname - Returns (string) - server Host name + IPAddress - Returns (string) - server IP Address + IPPort - Returns (int) - IP port number of the connection + Protocol - Returns (string) - Value for either ’TCP’, ’UDP’, 'SSH' connection. + ServicePort - Returns (int) - the port on which the socket is listening for response data + + Events: + Connected - (Event) Triggers when socket connection is established. + Disconnected - (Event) Triggers when the socket connection is broken + ReceiveData - (Event) Receive Data event handler used for asynchronous transactions. The callback takes two arguments. The first one is the EthernetClientInterface instance triggering the event and the second one is a bytes string. + >Note: + > The maximum amount of data per ReceiveData event that will be passed into the handler is 1024 bytes. For payloads greater than 1024 bytes, multiple events will be triggered. + > When UDP protocol is used, the data will be truncated to 1024 bytes. + """ + Hostname = '' + IPAddress = '' + IPPort = 0 + Protocol = '' + ServicePort = 0 + Credentials = None + Connected = None + Disconnected = None + ReceiveData = None + + def __init__(self, Hostname, IPPort, Protocol='TCP', ServicePort=0, Credentials=None): + """ EthernetClientInterface class constructor. + + Arguments: + - Hostname (string) - DNS Name of the connection. Can be IP Address + - IPPort (int) - IP port number of the connection + - (optional) Protocol (string) - Value for either 'TCP', 'UDP', or 'SSH' + - (optional) ServicePort (int) - Sets the port on which to listen for response data, UDP only, zero means listen on port OS assigns + - (optional) Credentials (tuple) - Username and password for SSH connection. + """ + self.Hostname = Hostname + self.IPPort = IPPort + self.Protocol = Protocol + self.ServicePort = ServicePort + self.Credentials = Credentials + + def Connect(self, timeout=None): + """ Connect to the server + + Arguments: + - (optional) timeout (float) - time in seconds to attempt connection before giving up. + + Returns + - 'Connected' or 'ConnectedAlready' or reason for failure (string) + + Note: Does not apply to UDP connections. + """ + pass + + def Disconnect(self): + """ Disconnect the socket + + Note: Does not apply to UDP connections. + """ + pass + + def Send(self, data): + """ Send string over ethernet port if it’s open + + Arguments: + - data (bytes, string) - string to send out + + Raises: + - TypeError + - IOError + """ + pass + + def SendAndWait(self, data, timeout, delimiter): + """ Send data to the controlled device and wait (blocking) for response. It returns after timeout seconds expires or immediately if the optional condition is satisfied. + + Note: In addition to data and timeout, the method accepts an optional delimiter, which is used to compare against the received response. It supports any one of the following conditions: + - > deliLen (int) - length of the response + - > deliTag (bytes) - suffix of the response + - > deliRex (regular expression object) - regular expression + + Note: The function will return an empty byte array if timeout expires and nothing is received, or the condition (if provided) is not met. + + Arguments: + - data (bytes, string) - data to send. + - timeout (float) - amount of time to wait for response. + - delimiter (see above) - optional conditions to look for in response. + + Returns: + - Response received data (may be empty) (bytes) + """ + pass + + def StartKeepAlive(self, interval, data): + """ Repeatedly sends data at the given interval + + Arguments: + - interval (float) - Time in seconds between transmissions + - data (bytes, string) - data bytes to send + """ + pass + + def StopKeepAlive(self): + """ Stop the currently running keep alive routine + """ + pass diff --git a/interface/EthernetServerInterface.py b/interface/EthernetServerInterface.py new file mode 100644 index 0000000..c4d2941 --- /dev/null +++ b/interface/EthernetServerInterface.py @@ -0,0 +1,86 @@ +class EthernetServerInterface(): + """ This class provides an interface to a server Ethernet socket. After instantiation, the server is started by calling StartListen(). This class allows the user to send data over the Ethernet port in an asynchronous manner using Send() and ReceiveData after a client has connected. + + :Warning:: This class is no longer supported. For any new development, EthernetServerInterfaceEx should be used. + + Arguments: + IPPort (int) - IP port number of the listening service. + (optional) Protocol (string) - Value for either 'TCP' or 'UDP' + (optional) Interface (string) - Defines the network interface on which to listen ('Any', 'LAN' of 'AVLAN') + (optional) ServicePort (int) - sets the port from which the client will send data. Zero means any service port is valid. + + Note: ServicePort is only applicable to 'UDP' protocol type. + + Parameters: + Hostname - Returns (string) - Hostname DNS name of the connection. Can be the IP Address + IPAddress - Returns (string) - the IP Address of the connected device + IPPort - Returns (int) - IP Port number of the listening service + Interface - Returns (string) - name of interface on which the server is listening + Protocol - Returns (string) - Value for either ’TCP’, ’UDP’ connection. + ServicePort - Returns (int) - ServicePort port on which the client will listen for data + + Events: + Connected - (Event) Triggers when socket connection is established. + Disconnected - (Event) Triggers when the socket connection is broken + ReceiveData - (Event) Receive Data event handler used for asynchronous transactions. The callback takes two arguments. The first one is the EthernetServerInterface instance triggering the event and the second one is a bytes string. + """ + + IPPort = 0 + Protocol = '' + Interface = '' + ServicePort = 0 + Connected = None + Disconnected = None + HostName = '' + IPAddress = '' + ReceiveData = None + + def __init__(self, IPPort, Protocol='TCP', Interface='Any', ServicePort=0): + """ EthernetServerInterface class constructor. + + Arguments: + - IPPort (int) - IP port number of the listening service. + - (optional) Protocol (string) - Value for either 'TCP' or 'UDP' + - (optional) Interface (string) - Defines the network interface on which to listen ('Any', 'LAN' of 'AVLAN') + - (optional) ServicePort (int) - sets the port from which the client will send data. Zero means any service port is valid. + """ + self.IPPort = IPPort + self.Protocol = Protocol + self.Interface = Interface + self.ServicePort = ServicePort + + def Disconnect(self): + """ Closes the connection gracefully. + """ + pass + + def Send(self, data): + """ Send string over ethernet port if it’s open + + Arguments: + - data (int) - string to send out + + Raises: + - TypeError + - IOError + """ + pass + + def StartListen(self, timeout=0): + """ Start the listener + + Arguments: + - (optional) timeout (float) - how long to listen for connections (0=Forever) + + Returns: + - 'Listening' or a reason for failure (e.g. 'PortUnavailable') + + Raises: + - IOError + """ + pass + + def StopListen(self): + """ Stop the listener + """ + pass diff --git a/interface/EthernetServerInterfaceEx.py b/interface/EthernetServerInterfaceEx.py new file mode 100644 index 0000000..d4cb967 --- /dev/null +++ b/interface/EthernetServerInterfaceEx.py @@ -0,0 +1,81 @@ +class EthernetServerInterfaceEx(): + """ This class provides an interface to an Ethernet server that allows a user-defined amount of client connections. After instantiation, the server is started by calling StartListen(). This class allows the user to send data over the Ethernet port in an asynchronous manner using Send() and ReceiveData after a client has connected. + + Arguments: + IPPort (int) - IP port number of the listening service. + (optional) Protocol (string) - Value for either 'TCP' or 'UDP' + (optional) Interface (string) - Defines the network interface on which to listen ('Any', 'LAN' of 'AVLAN') + (optional) MaxClients (int) - maximum number of client connections to allow (None == Unlimited, 0 == Invalid) + + Parameters: + Clients - Returns (list of ClientObject) - List of connected clients. + IPPort - Returns (int) - IP Port number of the listening service + Interface - Returns (string) - name of interface on which the server is listening ('Any', 'LAN' of 'AVLAN') + MaxClients - Returns (int or None) - maximum number of client connections to allow (None == Unlimited, 0 == Invalid) + Protocol - Returns (string) - socket protocol ('TCP', 'UDP') + + Events: + Connected - (Event) Triggers when socket connection is established. The callback takes two arguments. The first one is the ClientObject instance triggering the event and the second one is a string ('Connected'). + Disconnected - (Event) Triggers when the socket connection is broken. The callback takes two arguments. The first one is the ClientObject instance triggering the event and the second one is a string ('Disconnected'). + ReceiveData - (Event) Receive Data event handler used for asynchronous transactions. The callback takes two arguments. The first one is the ClientObject instance triggering the event and the second one is a bytes string. + """ + + IPPort = 0 + Protocol = '' + Interface = '' + MaxClients = None + Clients = [] + Connected = None + Disconnected = None + ReceiveData = None + + def __init__(self, IPPort, Protocol='TCP', Interface='Any', MaxClients=None): + """ EthernetServerInterfaceEx class constructor. + + Arguments: + - IPPort (int) - IP port number of the listening service. + - (optional) Protocol (string) - Value for either 'TCP' or 'UDP' + - (optional) Interface (string) - Defines the network interface on which to listen + - (optional) MaxClients (int) - maximum number of client connections to allow (None == Unlimited, 0 == Invalid) + """ + + self.IPPort = IPPort + self.Protocol = Protocol + self.Interface = Interface + self.MaxClients = MaxClients + + def Disconnect(self, client): + """ Closes the connection gracefully on specified client. + + Arguments: + - client (ClientObject) - handle to client object + """ + pass + + def StartListen(self, timeout=0): + """ Start the listener + + Arguments: + - (optional) timeout (float) - how long to listen for connections (0=Forever) + + Returns: + - 'Listening' or a reason for failure (e.g. 'PortUnavailable') + + Raises: + - IOError + + Note: Return examples: + - Listening + - ListeningAlready + - PortUnavailable + - InterfaceUnavailable: LAN + - InterfaceUnavailable: LAN, AVLAN + + Note: If 'Listening' not in result, the server will not be listening. + """ + pass + + def StopListen(self, client): + """ Stop the listener + """ + pass diff --git a/interface/FlexIOInterface.py b/interface/FlexIOInterface.py new file mode 100644 index 0000000..a526e20 --- /dev/null +++ b/interface/FlexIOInterface.py @@ -0,0 +1,93 @@ +class FlexIOInterface(): + """ This class will provide a common interface for controlling and collecting data from Flex IO ports on Extron devices (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g. 'FIO1') + (optional) Mode (string) - Possible modes are: 'AnalogInput', 'DigitalInput' (default), and 'DigitalOutput'. + (optional) Pullup (bool) - pull-up state on the port + (optional) Upper (float) - upper threshold in volts + (optional) Lower (float) - lower threshold in volts + + Parameters: + AnalogVoltage - Returns (float) - current voltage of analog input port + Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + Lower - Returns (float) - lower threshold for digital input in volts + >Note: Only applicable when Flex IO is in 'DigitalInput' mode. + Mode - Returns (string) - mode of the Flex IO port ('AnalogInput', 'DigitalInput', 'DigitalOutput'). + Port - Returns (string) - port name + Pullup - Returns (bool) - indicates if the input port is being pulled up or not + State - Returns (string) - current state of IO port ('On', 'Off') + Upper - Returns (float) - upper threshold for digital input in volts + >Note: Only applicable when Flex IO is in 'DigitalInput' mode. + + Events: + AnalogVoltageChanged - (Event) triggers when the input voltage changes. The callback takes two arguments. The first one is the extronlib.interface.FlexIOInterface instance triggering the event and the second one is the voltage. + >Note: Minimum voltage change required to trigger event is 0.05V. + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + StateChanged - (Event) Triggers when the input state changes. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('On' or 'Off'). + >Note: Only triggers for ports in Input mode. + """ + + Host = None + Port = '' + Mode = '' + Pullup = False + Upper = 0.0 + Lower = 0.0 + AnalogVoltage = 0.0 + AnalogVoltageChanged = None + Offline = None + Online = None + StateChanged = None + + def __init__(self, Host, Port, Mode='DigitalInput', Pullup=False, Upper=2.8, Lower=2.0): + """ FlexIOInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'FIO1') + - (optional) Mode (string) - Possible modes are: 'AnalogInput', 'DigitalInput' (default), and 'DigitalOutput'. + - (optional) Pullup (bool) - pull-up state on the port + - (optional) Upper (float) - upper threshold in volts + - (optional) Lower (float) - lower threshold in volts + """ + self.Host = Host + self.Port = Port + self.Mode = Mode + self.Pullup = Pullup + self.Upper = Upper + self.Lower = Lower + + def Initialize(self, Mode=None, Pullup=None, Upper=None, Lower=None): + """ Initializes Flex IO Port to given values. User may provide any or all of the parameters. None leaves property unmodified. + + Arguments: + - (optional) Mode (string) - Possible modes are: 'AnalogInput', 'DigitalInput' (default), and 'DigitalOutput'. + - (optional) Pullup (bool) - pull-up state on the port + - (optional) Upper (float) - upper threshold in volts + - (optional) Lower (float) - lower threshold in volts + """ + pass + + def Pulse(self, duration): + """ Turns the port on for the specified time in seconds with 10ms accuracy and a 100ms minimum value. + + Arguments: + - duration (float) - pulse duration + """ + pass + + def SetState(self, State): + """ Sets output state + + Arguments: + - State (int, string) - output state to be set ('On' or 1, 'Off' or 0) + """ + pass + + def Toggle(self): + """ Changes the state of the IO Object to the logical opposite of the current state. + """ + pass diff --git a/interface/IRInterface.py b/interface/IRInterface.py new file mode 100644 index 0000000..b93005c --- /dev/null +++ b/interface/IRInterface.py @@ -0,0 +1,85 @@ +class IRInterface(): + """ This class provides an interface to an IR port. This class allows the user to transmit IR data through an IR or IR/Serial port. + + Note: If an IR/Serial port is passed in and it has already been instantiated as an SerialInterface, an exception will be raised. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g., 'IRS1') + File (string) - IR file name (e.g. 'someDevice.eir') + + Parameters: + File - Returns (string) - file name + Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + Port - Returns (string) - port name + + Events: + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + """ + + Host = None + Port = '' + File = '' + Offline = None + Online = None + + def __init__(self, Host, Port, File): + """ IRInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g., 'IRS1') + - File (string) - IR file name (e.g. 'someDevice.eir') + """ + + self.Host = Host + self.Port = Port + self.File = File + + def Initialize(self, File=None): + """ Initializes IR Port to given file. None leaves property unmodified. + + Arguments: + - (optional) File (string) - IR file name (e.g. 'someDevice.eir') + """ + pass + + def PlayContinuous(self, irFunction): + """ Begin playback of an IR function. Function will play continuously until stopped. Will complete at least one header, one body, and the current body. + + Arguments: + - irFunction (string) - function within the driver to play + + Note: PlayContinuous is interruptable by subsequent Play function calls (PlayCount(), PlayTime()) and Stop(). + """ + pass + + def PlayCount(self, irFunction, repeatCount=None): + """ Play an IR function Count times. Function will play the header once and the body 1 + the specified number of repeat times. + + Arguments: + - irFunction (string) - function within the driver to play + - (optional) repeatCount (int) - number of times to repeat the body (0-15) + + Note: + - PlayCount is uninterruptible, except by Stop(). + - repeatCount of None means play the number defined in the driver. + """ + pass + + def PlayTime(self, irFunction, duration): + """ Play an IR function for the specified length of time. Function will play the header once and the body as many times as it can. Playback will stop when the time runs out. Current body will be completed. + + Arguments: + - irFunction (string) - function within the driver to play + - duration (float) - time in seconds to play the function + + Note: PlayTime is uninterruptible, except by Stop(). + """ + pass + + def Stop(self): + """ Stop the current playback. Will complete the current body. + """ + pass diff --git a/interface/PoEInterface.py b/interface/PoEInterface.py new file mode 100644 index 0000000..9a80152 --- /dev/null +++ b/interface/PoEInterface.py @@ -0,0 +1,51 @@ +class PoEInterface(): + """ This is the interface class for the Power over Ethernet ports on Extron devices (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g., 'POE1') + + Parameters: + CurrentLoad - Returns (float) - the current load of PoE port in watts + Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + Port - Returns (string) - port name + PowerStatus - Returns (string) - State of power transmission on the port ('Active', 'Inactive'). 'Active' if there is a device being powered by the port. + State - Returns (string) - current state of IO port ('On', 'Off') + + Events: + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + PowerStatusChanged - (Event) Triggers when the state of power transmission on the port changes (e.g. a PoE device is plugged into the port). The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Active' or 'Inactive'). + """ + + Host = None + Port = '' + CurrentLoad = 0.0 + Offline = None + Online = None + PowerStatus = '' + PowerStatusChanged = None + State = '' + + def __init__(self, Host, Port): + """ PoEInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g., 'POE1') + """ + + self.Host = Host + self.Port = Port + + def SetState(self, State): + """ + Arguments: + - State (int, string) - output state to be set ('On' or 1, 'Off' or 0) + """ + pass + + def Toggle(self, State): + """ Changes the state to the logical opposite of the current state. + """ + pass diff --git a/interface/RelayInterface.py b/interface/RelayInterface.py new file mode 100644 index 0000000..55e2548 --- /dev/null +++ b/interface/RelayInterface.py @@ -0,0 +1,51 @@ +class RelayInterface(): + """ This class provides a common interface for controlling relays on Extron devices (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g. 'RLY1') + + Parameters: + Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + Port - Returns (string) - port name + State - Returns (string) - current state of Relay port ('Close', 'Open') + + Events: + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + """ + Host = None + Port = '' + Offline = None + Online = None + + def __init__(self, Host, Port): + """ RelayInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'RLY1') + """ + self.Host = Host + self.Port = Port + + def Pulse(self, duration): + """ Turns the port on for the specified time in seconds with 10ms accuracy and a 100ms minimum value. + + Arguments: + - duration (float) - pulse duration + """ + pass + + def SetState(self, State): + """ Sets output state to be set ('Close' or 1, 'Open' or 0) + + Arguments: + - State (int, string) - output state to be set ('Close' or 1, 'Open' or 0) + """ + pass + + def Toggle(self): + """ Changes the state of the IO Object to the logical opposite of the current state. + """ + pass diff --git a/interface/SPInterface.py b/interface/SPInterface.py new file mode 100644 index 0000000..f87f5c1 --- /dev/null +++ b/interface/SPInterface.py @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/interface/SWACReceptacleInterface.py b/interface/SWACReceptacleInterface.py new file mode 100644 index 0000000..9e3c175 --- /dev/null +++ b/interface/SWACReceptacleInterface.py @@ -0,0 +1,49 @@ +class SWACReceptacleInterface(): + """ This class provides a common interface to a switched AC power receptacle on an Extron product (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g. 'SAC1') + + Parameters: + CurrentChanged - Returns (float) - instantaneous current draw in Amperes + Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + Port - Returns (string) - port name + State - Returns (string) - current state of receptacle ('On', 'Off') + + Events: + CurrentChanged - (Event) triggers when the current draw changes. The callback takes two arguments. The first one is the SWACReceptacleInterface instance triggering the event, and the second is the current. + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + + """ + Current = 0.0 + Host = None + Port = '' + Offline = None + Online = None + State = '' + StateChanged = None + + def __init__(self, Host, Port): + """ SWACReceptacleInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'SAC1') + """ + self.Host = Host + self.Port = Port + + def SetState(self, State): + """ Sets output state to be set ('On' or 1, 'Off' or 0) + + Arguments: + - State (int, string) - output state to be set ('On' or 1, 'Off' or 0) + """ + pass + + def Toggle(self): + """ Changes the state of the receptacle to the logical opposite of the current state. + """ + pass diff --git a/interface/SWPowerInterface.py b/interface/SWPowerInterface.py new file mode 100644 index 0000000..e4121e2 --- /dev/null +++ b/interface/SWPowerInterface.py @@ -0,0 +1,53 @@ +class SWPowerInterface(): + """ This is the interface class for the Switched Power ports on Extron devices (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g. 'SPI1') + + Parameters: + Host - Returns (extronlib.device) - handle to Extron device class that instantiated this interface class + Port - Returns (string) - port name + State - Returns (string) - current state of IO port ('On', 'Off') + + Events: + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + + """ + Host = None + Port = '' + Offline = None + Online = None + State = '' + + def __init__(self, Host, Port): + """ SWPowerInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'SPI1') + """ + self.Host = Host + self.Port = Port + + def Pulse(self, duration): + """ Turns the port on for the specified time in seconds with 10ms accuracy and a 100ms minimum value. + + Arguments: + - duration (float) - pulse duration + """ + pass + + def SetState(self, State): + """ Sets output state to be set ('On' or 1, 'Off' or 0) + + Arguments: + - State (int, string) - output state to be set ('On' or 1, 'Off' or 0) + """ + pass + + def Toggle(self): + """ Changes the state of the IO Object to the logical opposite of the current state. + """ + pass diff --git a/interface/SerialInterface.py b/interface/SerialInterface.py new file mode 100644 index 0000000..d46b0f5 --- /dev/null +++ b/interface/SerialInterface.py @@ -0,0 +1,133 @@ +class SerialInterface(): + """ This class provides an interface to a serial port. This class allows the user to send data over the serial port in a synchronous or asynchronous manner. This class is used for all ports capable of serial communication (e.g., Serial Ports, IR Serial Ports). + + >Note: + > In synchronous mode, the user will use SendAndWait() to wait for the response. + > In asynchronous mode, the user will assign a handler function to ReceiveData to handle responses. + > If an IR/Serial port is passed in and it has already been instantiated as an IRInterface, an exception will be raised. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g. 'COM1', 'IRS1') + (optional) Baud (int) - baudrate + (optional) Data (int) - number of data bits + (optional) Parity (string) - 'None', 'Odd' or 'Even' + (optional) Stop (int) - number of stop bits + (optional) FlowControl (string) - 'HW', 'SW', or 'Off' + (optional) CharDelay (float) - time between each character sent to the connected device + (optional) Mode (string) - mode of the port, 'RS232', 'RS422' or 'RS485' + + Parameters: + Baud - Returns (int) - the baud rate + CharDelay - Returns (float) - inter-character delay + Data - Returns (int) - the number of data bits + FlowControl - Returns (string) - flow control + Host - Returns (extronlib.device) - the host device + Mode - Returns (string) - the current Mode + Parity - Returns (string) - parity + Port - Returns (string) - the port name this interface is attached to + Stop - Returns (int) - number of stop bits + + Events: + Offline - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Offline'). + Online - (Event) Triggers when port goes offline. The callback takes two arguments. The first one is the extronlib.interface instance triggering the event and the second one is a string ('Online'). + ReceiveData - (Event) Receive Data event handler used for asynchronous transactions. The callback takes two arguments. The first one is the SerialInterface instance triggering the event and the second one is a bytes string. + """ + Host = None + Port = '' + Baud = 0 + Data = 0 + Parity = '' + Stop = 0 + FlowControl = '' + CharDelay = 0.0 + Mode = '' + Offline = None + Online = None + ReceiveData = None + + def __init__(self, Host, Port, Baud=9600, Data=8, Parity='None', Stop=1, FlowControl='Off', CharDelay=0, Mode='RS232'): + """ SerialInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'COM1', 'IRS1') + - (optional) Baud (int) - baudrate + - (optional) Data (int) - number of data bits + - (optional) Parity (string) - 'None', 'Odd' or 'Even' + - (optional) Stop (int) - number of stop bits + - (optional) FlowControl (string) - 'HW', 'SW', or 'Off' + - (optional) CharDelay (float) - time between each character sent to the connected device + - (optional) Mode (string) - mode of the port, 'RS232', 'RS422' or 'RS485' + """ + self.Host = Host + self.Port = Port + self.Baud = Baud + self.Data = Data + self.Parity = Parity + self.Stop = Stop + self.FlowControl = FlowControl + self.CharDelay = CharDelay + self.Mode = Mode + + def Initialize(self, Baud=None, Data=None, Parity=None, Stop=None, FlowControl=None, CharDelay=None, Mode=None): + """ Initializes Serial Port to given values. User may provide any or all of the parameters. None leaves property unmodified. + + Arguments: + - (optional) Baud (int) - baudrate + - (optional) Data (int) - number of data bits + - (optional) Parity (string) - 'None', 'Odd' or 'Even' + - (optional) Stop (int) - number of stop bits + - (optional) FlowControl (string) - 'HW', 'SW', or 'Off' + - (optional) CharDelay (float) - time between each character sent to the connected device + - (optional) Mode (string) - mode of the port, 'RS232', 'RS422' or 'RS485' + """ + pass + + def Send(self, data): + """ Send string over serial port if it’s open + + Arguments: + - data (bytes, string) - data to send + + Raises: + - TypeError + - IOError + """ + pass + + def SendAndWait(self, data, timeout, delimiter): + """ Send data to the controlled device and wait (blocking) for response + + Note In addition to data and timeout, the method accepts an optional delimiter, which is used to compare against the received response. It supports any one of the following conditions: + - > deliLen (int) - length of the response + - > deliTag (byte) - suffix of the response + - > deliRex (regular expression object) - regular expression + + It returns after timeout seconds expires, or returns immediately if the optional condition is satisfied. + + Note: The function will return an empty byte array if timeout expires and nothing is received, or the condition (if provided) is not met. + + Arguments: + - data (bytes, string) - data to send. + - timeout (float) - amount of time to wait for response. + - delimiter (see above) - optional conditions to look for in response. + + Returns + - Response received data (may be empty) (bytes) + """ + pass + + def StartKeepAlive(self, interval, data): + """ Repeatedly sends data at the given interval + + Arguments: + - interval (float) - Time in seconds between transmissions + - data (bytes) - data bytes to send + """ + pass + + def StopKeepAlive(self): + """ Stop the currently running keep alive routine + """ + pass diff --git a/interface/TallyInterface.py b/interface/TallyInterface.py new file mode 100644 index 0000000..503fa1d --- /dev/null +++ b/interface/TallyInterface.py @@ -0,0 +1 @@ +#TODO \ No newline at end of file diff --git a/interface/VolumeInterface.py b/interface/VolumeInterface.py new file mode 100644 index 0000000..374b37d --- /dev/null +++ b/interface/VolumeInterface.py @@ -0,0 +1,71 @@ +class VolumeInterface(): + """ This class will provide a common interface for controlling and collecting data from Volume Ports on Extron devices (extronlib.device). The user can instantiate the class directly or create a subclass to add, remove, or alter behavior for different types of devices. + + Arguments: + Host (extronlib.device) - handle to Extron device class that instantiated this interface class + Port (string) - port name (e.g. 'VOL1') + + Host - Returns (extronlib.device) - the host device + Level - Returns (int) - Current volume level (percentage). + Max - Returns (float) - Maximum level (0.0 V < Max <= 10.0 V). + Min - Returns (float) - Minimum level (0.0 V <= Min < 10.0 V). + Mute - Returns (string) - Current state of volume port mute. ('On', 'Off') + Port - Returns (string) - the port name this interface is attached to + SoftStart - Returns (string) - Current state of Soft Start. ('Enabled', 'Disabled') + """ + Host = None + Port = '' + Level = 0 + Max = 0.0 + Min = 0.0 + Mute = '' + SoftStart = '' + + + def __init__(self, Host, Port): + """ VolumeInterface class constructor. + + Arguments: + - Host (extronlib.device) - handle to Extron device class that instantiated this interface class + - Port (string) - port name (e.g. 'VOL1') + """ + self.Host = Host + self.Port = Port + self.Level = 0 + self.Max = 0.0 + self.Min = 0.0 + self.SoftStart = '' + + def SetLevel(self, Level): + """ Sets Level of volume control port + + Arguments: + - Level (int) - Level (0 % <= Value <= 100 %). + """ + pass + + def SetMute(self, Mute): + """ Sets the mute state. + + Arguments: + - Mute (string) - mute state ('On', 'Off'). + """ + pass + + def SetRange(self, Min, Max): + """ Set volume control object’s range. + + Arguments: + - Min (float) - minimum voltage + - Max (float) - maximum voltage + """ + pass + + def SetSoftStart(self, SoftStart): + """ Enable or Disable Soft Start. + + Arguments: + - SoftStart (string) - Soft Start state ('Enabled', 'Disabled'). + """ + pass + \ No newline at end of file diff --git a/interface/__init__.py b/interface/__init__.py new file mode 100644 index 0000000..798e215 --- /dev/null +++ b/interface/__init__.py @@ -0,0 +1,17 @@ +from CircuitBreakerInterface import CircuitBreakerInterface +from ClientObject import ClientObject +from ContactInterface import ContactInterface +from DigitalInputInterface import DigitalInputInterface +from DigitalIOInterface import DigitalIOInterface +from EthernetClientInterface import EthernetClientInterface +from EthernetServerInterface import EthernetServerInterface +from EthernetServerInterfaceEx import EthernetServerInterfaceEx +from FlexIOInterface import FlexIOInterface +from IRInterface import IRInterface +from PoEInterface import PoEInterface +from RelayInterface import RelayInterface +from SerialInterface import SerialInterface +# from SPInterface +from SWACReceptacleInterface import SWACReceptacleInterface +# from TallyInterface +from VolumeInterface import VolumeInterface \ No newline at end of file diff --git a/software/SummitConnect.py b/software/SummitConnect.py new file mode 100644 index 0000000..b5aff6b --- /dev/null +++ b/software/SummitConnect.py @@ -0,0 +1,115 @@ +from typing import Union + + +class SummitConnect(): + """ This class provides an interface to Extron Unified Communications solutions. + + Note: + - System limits 15 SummitConnect clients per system. + + Arguments: + - Hostname (string) - Hostname of the host computer. Can be IP Address. + - IPPort (int) - IP Port the software is listening on (default is 5000) + + Note: + - Only one object can be instantiated for a given Hostname or IP Address. + + Parameters: + - Hostname - Returns (string) - Hostname of the host computer `Note: If unavailable, returns the IP Address.` + - IPAddress - Returns (string) - IP Address of the host computer + - IPPort - Returns (int) - IP Port the software is listening on (default is 5000) + - ListeningPort - Returns (int) - IP Port this SummitConnect instance is listening on for received data + + Events: + - Connected (Event) Triggers when communication is established. The callback takes two arguments. The first one is the SummitConnect instance triggering the event and the second one is a string ('Connected'). + - Disconnected (Event) Triggers when the communication is broken. The callback takes two arguments. The first one is the SummitConnect instance triggering the event and the second one is a string ('Disconnected'). + - ReceiveData (Event) Receive Data event handler used for asynchronous transactions. The callback takes two arguments. The first one is the SummitConnect instance triggering the event and the second one is a bytes string. + + --- + + Example: + ``` + from extronlib.software import SummitConnect + ConferencePC = SummitConnect('192.168.1.110') + ``` + """ + + def __init__(self, Hostname: str, IPPort: int=None) -> None: + """ SummitConnect class constructor. + + Arguments: + - Hostname (string) - Hostname of the host computer. Can be IP Address. + - IPPort (int) - IP Port the software is listening on (default is 5000) + """ + self.Hostname = Hostname + self.IPPort = IPPort + self.IPAddress = None + self.ListeningPort = None + + def Connect(self, timeout: float=None) -> str: + """ Connect to the software. + + Arguments: + - timeout (float) - time in seconds to attempt connection before giving up. + + Returns + - 'Connected' or reason for failure ('TimedOut', 'HostError', 'PortUnavailable:, ...'). (string) + + --- + + Example: + ``` + def ConnectToSoftware(): + - result = ConferencePC.Connect(5) + - if result in ['TimedOut', 'HostError']: + - Wait(30, ConnectToSoftware) + - else: + - GetStatus(ConferencePC) # GetStatus() is a user function + + ConnectToSoftware() + ``` + """ + ... + + def Disconnect(self) -> None: + """ Disconnect the socket + + >>> ConferencePC.Disconnect() + """ + ... + + def Send(self, data: Union[bytes, str]) -> None: + """ Send string to licensed software + + Arguments: + - - data (bytes, string) - string to send out + + >>> ConferencePC.Send(A_MESSAGE) + """ + ... + + @classmethod + def SetListeningPorts(cls, portList: list[int]=None) -> str: + """ Set the ports to listen for received data. + + Arguments: + - (optional) portList (list of ints) - list of ports (e.g. [10000, 10001, 10002]). None will set to default range. + + Returns: + - 'Listening' or a reason for failure (e.g. 'PortUnavailable:, ...') + + Note: + - - A maximum of 15 ports can be specified. + - - Default port range is 5001 - 5008 + + --- + + Example: + ``` + # Listen on ports 10000, 10001, and 10002 + SummitConnect.SetListeningPorts(range(10000, 10003)) + ... + SummitConnect.SetListeningPorts() # Reset to default. + ``` + """ + ... diff --git a/software/__init__.py b/software/__init__.py new file mode 100644 index 0000000..5fcc6cb --- /dev/null +++ b/software/__init__.py @@ -0,0 +1 @@ +from SummitConnect import SummitConnect \ No newline at end of file diff --git a/standard/__init__.py b/standard/__init__.py new file mode 100644 index 0000000..4e5dc54 --- /dev/null +++ b/standard/__init__.py @@ -0,0 +1 @@ +import exml \ No newline at end of file diff --git a/standard/exml.py b/standard/exml.py new file mode 100644 index 0000000..1398789 --- /dev/null +++ b/standard/exml.py @@ -0,0 +1,43 @@ +exml = {} +""" + This is a restricted version of standard Python xml modules. It provides the same classes and functions. + + --- + + Adapting the example from [docs.python.org](docs.python.org): + + ``` + + import extronlib.standard.exml.etree.ElementTree as ET + + country_data_as_string = \"\"\" + + + + - 1 + - 2008 + - 141100 + - + - + + + - 4 + - 2011 + - 59900 + - + + + - 68 + - 2011 + - 13600 + - + - + + + \"\"\" + + root = ET.fromstring(country_data_as_string) + print(root.tag) + ``` + """ + diff --git a/system/Clock.py b/system/Clock.py new file mode 100644 index 0000000..f1a62df --- /dev/null +++ b/system/Clock.py @@ -0,0 +1,70 @@ +from typing import Optional + + +class Clock(): + """ The clock is used to create timed events. It will allow the user to schedule programmed actions to occur based on calendar time. + + Note: + - When DST causes the clock to spring forward one hour, events scheduled within the skipped hour do not fire. + - When DST causes the clock to fall back an hour, events scheduled within the repeated hour fire twice. + + Arguments: + - Times (list of strings) - list of times (e.g. 'HH:MM:SS') of day to call Function + - Days (list of strings) - list of weekdays to set alarm. If Days is omitted, the alarm is set for every weekday + - Function (function) - function to execute when alarm time is up + + Parameters: + - Days - Returns (list of strings) - list of days to execute + > Note: list will be empty if it was not provided to the constructor (i.e. the Clock is set for every day). + - Function - Returns (function) - Code to execute at given Times. + > Note: Function must accept two parameters: the Clock object and datetime object. + - State - Returns (string) - State of the clock device. ('Enabled', 'Disabled') + - Times - Returns (list of strings) - list of times to execute. + - WEEKDAYS - (dict) - days of the week dictionary {'Monday' ::: 0, 'Tuesday'::: 1, 'Wednesday'::: 2, 'Thursday'::: 3, 'Friday'::: 4, 'Saturday'::: 5, 'Sunday'::: 6} + """ + Times: list = [] + Days: list = [] + Function: callable = None + State: str = '' + WEEKDAYS: dict[str, int] = {'Monday': 0, + - 'Tuesday': 1, + - 'Wednesday': 2, + - 'Thursday': 3, + - 'Friday': 4, + - 'Saturday': 5, + - 'Sunday': 6} + + def __init__(self, Times: list[str], Days: Optional[list[str]]=None, Function: Optional[callable]=None) -> None: + """ Clock class constructor. + + Arguments: + - Times (list of strings) - list of times (e.g. 'HH:MM:SS') of day to call Function + - Days (list of strings) - list of weekdays to set alarm. If Days is omitted, the alarm is set for every weekday + - Function (function) - function to execute when alarm time is up + """ + ... + + def Disable(self) -> None: + """ Disable alarm """ + ... + + def Enable(self) -> None: + """ Enable alarm """ + ... + + def SetDays(self, Days: list[str]) -> None: + """ Send string to licensed software + + Arguments: + - Days (list of strings) - a list of Calendar days, as listed in WEEKDAYS + """ + ... + + def SetTimes(self, Times: list[str]) -> None: + """ Set new alarm times + + Arguments: + - Times (list of strings) - list of times (e.g. 'HH:MM:SS') of day to call Function + """ + ... + diff --git a/system/Email.py b/system/Email.py new file mode 100644 index 0000000..943ba5e --- /dev/null +++ b/system/Email.py @@ -0,0 +1,70 @@ +from typing import Optional + + +class Email(): + """ Class to send email using the configured mail settings. The confiured settings can be over ridden during instantiation. + + Note: default sender will be login username@unit-name or hostname@unit-name if there is no authentication. To override, call Sender() + + Arguments: + - smtpServer (string) - ip address or hostname of SMTP server + - port (int) - port number + - username (string) - login username for SMTP authentication + - password (string) - login password for SMTP authentication + - sslEnabled (bool) - Enable (True) or Disable (False) SSL for the connection + """ + smtpServer: str = '' + port: int = 0 + username: str = '' + password: str = '' + sslEnabled: bool = False + + def __init__(self, smtpServer: str=None, port: int=None, username: str=None, password: str=None, sslEnabled: bool=None): + """ Email class constructor. + + Arguments: + - smtpServer (string) - ip address or hostname of SMTP server + - port (int) - port number + - username (string) - login username for SMTP authentication + - password (string) - login password for SMTP authentication + - sslEnabled (bool) - Enable (True) or Disable (False) SSL for the connection + """ + ... + + def Receiver(self, receiver: list[str]=None, cc: bool=False) -> None: + """ Set receiver’s email address(es) by passing in a list of strings. For example, ['abc@extron.com‘,’xyz@extron.com‘] It will appear in the field of the email. If cc is set to True, it will appear in the field of the email. + + Arguments: + - receiver (list of strings) - receiver’s email address(es) + - (optional) cc (bool) - Set True to put the receiver address(es) in the cc list + + Note: Receiver() must be called each time the list changes. + + """ + ... + + def SendMessage(self, msg:str) -> None: + """ Create main body of the email and send out. Message string will be sent out as plain text. + + Arguments: + - msg (string) - message to send + """ + ... + + def Sender(self, sender: str) -> None: + """ Set sender’s email address. It will appear in the field of the email. + + Arguments: + - sender (string) - sender email address + + Note: Overrides default sender. + """ + ... + + def Subject(self, subject: str) -> None: + """ Set email’s subject. It will appear in the field of the email. + + Arguments: + - subject (string) - subject of the email + """ + ... diff --git a/system/File.py b/system/File.py new file mode 100644 index 0000000..7e52660 --- /dev/null +++ b/system/File.py @@ -0,0 +1,173 @@ +from typing import Union + + +class File(): + """ Access to files located in user area. These files are stored in a location that can be accessed using 3rd party SFTP clients. + + Note: File class accesses user area with ‘admin’ privileges. + + Arguments: + - Filename (string) - Name of file to open + - mode (string) - the mode in which the files is opened. + - encoding (string) - the name of the encoding used to decode/encode the file. + - newline (string) - controls how universal newlines mode works + + Note: + - mode, encoding, and newline have the same meanings as those passed to the built-in function open(). See the documentation at python.org. + - ChangeDir(), DeleteDir(), DeleteFile(), Exists(), GetCurrentDir(), ListDir(), MakeDir(), and RenameFile() are all classmethods. + + Note: For restricted file access, substitute File with RFile in the examples above and below. + + Parameters: + - Filename - Returns (string) - name of file + """ + Filename: str = '' + mode: str = '' + encoding: str = '' + newline: str = '' + + def __init__(self, Filename: str, mode: str='r', encoding: str=None, newline: str=None) -> None: + """ File class constructor. + + Arguments: + - Filename (string) - Name of file to open + - mode (string) - the mode in which the files is opened. + - encoding (string) - the name of the encoding used to decode/encode the file. + - newline (string) - controls how universal newlines mode works + """ + ... + + def ChangeDir(self, path: str) -> None: + """ Change the current working directory to path + + Arguments: + - path (string) - path to directory + """ + ... + + def DeleteDir(self, path: str) -> None: + """ Remove a directory + + Arguments: + - path (string) - path to directory + """ + ... + + def DeleteFile(self, filename: str) -> None: + """ Delete a file + + Arguments: + - filename (string) - the name of the file to be deleted (path to file) + """ + ... + + def Exists(self, path: str) -> bool: + """ Return True if path exists + + Arguments: + - path (string) - path to directory + + Returns + - true if exists else false (bool) + """ + ... + + def GetCurrentDir(self) -> str: + """ Get the current path. + + Returns + - the current working directory (string) + """ + ... + + def ListDir(self, path: str=None) -> str: + """ List directory contents + + Arguments: + - path (string) - if provided, path to directory to list, else list current directory + + Returns + - directory listing (string) + """ + ... + + def MakeDir(self, path: str) -> None: + """ Make a new directory + + Arguments: + - path (string) - path to directory + """ + ... + + def RenameFile(self, oldname: str, newname: str) -> None: + """ Rename a file from oldname to newname + + Arguments: + - oldname (string) - the original filename + - newname (string) - the filename to rename to + """ + ... + + def close(self) -> None: + """ Close an already opened file """ + ... + + def read(self, size:int=-1) -> bytes: + """ Read data from opened file + + Arguments: + - size (int) - max number of char/bytes to read + + Returns + - data (bytes) + """ + ... + + def readline(self) -> bytes: + """ Read from opened file until newline or EOF occurs + + Returns + - data (bytes) + """ + ... + + def seek(self, offset: int, whence: int=0) -> None: + """ Change the stream position + + Arguments: + - offset (int) - offset from the start of the file + - (optional) whence (int) - + - 0 = absolute file positioning + - 1 = seek relative to the current position + - 2 = seek relative to the file’s end. + + Note: Files opened in text mode (i.e. not using 'b'), only seeks relative to the beginning of the file are allowed – the exception being a seek to the very file end with seek(0,2). + """ + ... + + def tell(self) -> int: + """ Returns the current cursor position + + Returns + - the current cursor position (int) + """ + ... + + def write(self, data: Union[str, bytes]) -> None: + """ Write string or bytes to file + + Arguments: + - data (string, bytes) - data to be written to file + """ + ... + + def writelines(self, seq: list[str]) -> None: + """ Write iterable object such as a list of strings + + Arguments: + - seq (e.g. list of strings) - iterable sequence + + Raises: + - FileNotOpenError + """ + ... diff --git a/system/MESet.py b/system/MESet.py new file mode 100644 index 0000000..24ee3a5 --- /dev/null +++ b/system/MESet.py @@ -0,0 +1,79 @@ +from typing import Union + + +class MESet(): + """ The Mutually Exclusive set allows for the grouping of objects to allow easy selection of related items. For instance, a group of buttons could be grouped so that selecting one button deselects the others in the group. + + Compatible extronlib classes: + - IOInterface (and any children): + - extronlib.interface.RelayInterface + - extronlib.interface.FlexIOInterface (Output only) + - extronlib.interface.DigitalIOInterface (Output only) + - extronlib.interface.SWPowerInterface + - Button: + + Arguments: + - Objects (list) - list of compatible objects + + Note: + - Each object must have a method SetState. + - SetState must take an integer argument. + - Any object with a SetState function that takes an integer object is compatible with this class. + - A programmer can create their own class and use it with MESet. + + Parameters: + - Objects - Returns (list) - the list of objects to track + """ + Objects: list[object] = [] + + def __init__(self, Objects: list[object]) -> none: + """ MESet class constructor. + + Arguments: + - Objects (list) - list of compatible objects + """ + ... + + def Append(self, obj: object) -> None: + """ Add an object to the list + + Arguments: + - obj (any) - any compatible object to add + """ + ... + + def GetCurrent(self) -> object: + """ Gets the currently selected object in the group. + + Returns + - the currently selected object in the group. + """ + ... + + def Remove(self, obj: Union[int, object]) -> None: + """ Remove an object from the list + + Arguments: + - obj (int or compatible object) - the object or the index of the object + """ + ... + + def SetCurrent(self, obj: Union[int, object]) -> None: + """ Selects the current object in the group + + Arguments: + - obj (int or compatible object) - the object or the index of the object + + Note: When None is passed in, all objects will be deselected. + """ + ... + + def SetStates(self, obj: Union[int, object], offState: int, onState: int) -> None: + """ Selects the off and on states for the object (i.e. use states other than the default 0 and 1, respectively). + + Arguments: + - obj (int or object) - the object or the index of the object + - offState (int) - the ID of the deselected state + - onState (int) - the ID of the selected state + """ + ... diff --git a/system/RFile.py b/system/RFile.py new file mode 100644 index 0000000..3a7fd1d --- /dev/null +++ b/system/RFile.py @@ -0,0 +1,172 @@ +from typing import Union + + +class RFile(): + """ Access to restricted files. These files can only be created and accessed within the program. Files can be uploaded to provide initial values via the Global Scripter® project. + + Arguments: + - Filename (string) - Name of file to open + - mode (string) - the mode in which the files is opened. + - encoding (string) - the name of the encoding used to decode/encode the file. + - newline (string) - controls how universal newlines mode works + + Note: + - mode, encoding, and newline have the same meanings as those passed to the built-in function open(). See the documentation at python.org. + - ChangeDir(), DeleteDir(), DeleteFile(), Exists(), GetCurrentDir(), ListDir(), MakeDir(), and RenameFile() are all classmethods. + + Note: For restricted file access, substitute File with RFile in the examples above and below. + + Parameters: + - Filename - Returns (string) - name of file + """ + Filename: str = '' + mode: str = '' + encoding: str = '' + newline: str = '' + + def __init__(self, Filename: str, mode: str='r', encoding: str=None, newline: str=None) -> None: + """ RFile class constructor. + + Arguments: + - Filename (string) - Name of file to open + - mode (string) - the mode in which the files is opened. + - encoding (string) - the name of the encoding used to decode/encode the file. + - newline (string) - controls how universal newlines mode works + """ + ... + + def ChangeDir(self, path: str) -> None: + """ Change the current working directory to path + + Arguments: + - path (string) - path to directory + """ + ... + + def DeleteDir(self, path: str) -> None: + """ Remove a directory + + Arguments: + - path (string) - path to directory + """ + ... + + def DeleteFile(self, filename: str) -> None: + """ Delete a file + + Arguments: + - filename (string) - the name of the file to be deleted (path to file) + """ + ... + + def Exists(self, path: str) -> bool: + """ Return True if path exists + + Arguments: + - path (string) - path to directory + + Returns + - true if exists else false (bool) + """ + ... + + def GetCurrentDir(self) -> str: + """ Get the current path. + + Returns + - the current working directory (string) + """ + ... + + def ListDir(self, path: str=None) -> str: + """ List directory contents + + Arguments: + - path (string) - if provided, path to directory to list, else list current directory + + Returns + - directory listing (string) + """ + ... + + def MakeDir(self, path: str) -> None: + """ Make a new directory + + Arguments: + - path (string) - path to directory + """ + ... + + def RenameFile(self, oldname: str, newname: str) -> None: + """ Rename a file from oldname to newname + + Arguments: + - oldname (string) - the original filename + - newname (string) - the filename to rename to + """ + ... + + def close(self) -> None: + """ Close an already opened file + """ + ... + + def read(self, size: int=-1) -> bytes: + """ Read data from opened file + + Arguments: + - size (int) - max number of char/bytes to read + + Returns + - data (bytes) + """ + ... + + def readline(self) -> bytes: + """ Read from opened file until newline or EOF occurs + + Returns + - data (bytes) + """ + ... + + def seek(self, offset: int, whence: int=0) -> None: + """ Change the stream position + + Arguments: + - offset (int) - offset from the start of the file + - (optional) whence (int) - + - 0 = absolute file positioning + - 1 = seek relative to the current position + - 2 = seek relative to the file’s end. + + Note: Files opened in text mode (i.e. not using 'b'), only seeks relative to the beginning of the file are allowed – the exception being a seek to the very file end with seek(0,2). + """ + ... + + def tell(self) -> int: + """ Returns the current cursor position + + Returns + - the current cursor position (int) + """ + ... + + def write(self, data: Union[str, bytes]) -> None: + """ Write string or bytes to file + + Arguments: + - data (string, bytes) - data to be written to file + """ + ... + + def writelines(self, seq: list[str]) -> None: + """ Write iterable object such as a list of strings + + Arguments: + - seq (e.g. list of strings) - iterable sequence + + Raises: + - FileNotOpenError + """ + ... diff --git a/system/Timer.py b/system/Timer.py new file mode 100644 index 0000000..c4b27d0 --- /dev/null +++ b/system/Timer.py @@ -0,0 +1,67 @@ +class Timer(): + """ The Timer class allows the user to execute programmed actions on a regular time differential schedule. + + Note: + - The handler (Function) must accept exactly two parameters, which are the Timer that called it and the Count. + - If the handler (Function) has not finished by the time the Interval has expired, Function will not be called and Count will not be incremented (i.e. that interval will be skipped). + + In addition to being used as a decorator, Timer can be named and modified. + + Arguments: + - Interval (float) - How often to call the handler in seconds (minimum interval is 0.1s). + - Function (function) - Handler function to execute each Interval. + + Parameters: + - Count - Returns (int) - Number of events triggered by this timer. + - Function - Returns (function) - Handler function to execute each Interval. Function must accept exactly two parameters, which are the Timer that called it and the Count. + - Interval - Returns (float) - How often to call the handler in seconds. + - State - Returns (string) - Current state of Timer ('Running', 'Paused', 'Stopped') + + Events: + - StateChanged - (Event) Triggers when the timer state changes. The callback takes two arguments. The first is the Timer instance triggering the event and the second is a string ('Running', 'Paused', 'Stopped'). + """ + + Interval = 0.0 + Function = None + + def __init__(self, Interval: float, Function: callable=None) -> None: + """ Timer class constructor. + + Arguments: + - Interval (float) - How often to call the handler in seconds (minimum interval is 0.1s). + - Function (function) - Handler function to execute each Interval. + """ + ... + + def Change(self, Interval: float) -> None: + """ Set a new Interval value for future events in this instance. + + Arguments: + - Interval (float) - How often to call the handler in seconds. + + """ + ... + + def Pause(self) -> None: + """ Pause the timer (i.e. stop calling the Function). + + Note: Does not reset the timer or the Count. + """ + ... + + def Resume(self) -> None: + """ Resume the timer after being paused or stopped. + """ + ... + + def Restart(self) -> None: + """Restarts the timer – resets the Count and executes the Function in Interval seconds.""" + ... + + def Stop(self) -> None: + """ Stop the timer. + + Note: Resets the timer and the Count. + """ + ... + diff --git a/system/Wait.py b/system/Wait.py new file mode 100644 index 0000000..c5acd42 --- /dev/null +++ b/system/Wait.py @@ -0,0 +1,41 @@ +class Wait(): + """ The wait class allows the user to execute programmed actions after a desired delay without blocking other processor activity. + + In addition to being used as a one-shot (decorator), Wait can be named and reusable. + + Arguments: + - Time (float) - Expiration time of the wait in seconds + - Function (function) - Code to execute when Time expires + + Parameters: + - Function - Returns (function) - Code to execute when Time expires. + - Time - Returns (float) - Expiration time of the wait in seconds with 10ms precision. + """ + Time: float = 0.0 + Function: callable = None + + def __init__(self, Time: float, Function: callable=None) -> None: + """ File class constructor. + + Arguments: + - Time (float) - Expiration time of the wait in seconds + - Function (function) - Code to execute when Time expires + """ + ... + + def Add(self, Time: float) -> None: + """ Add time to current timer. """ + pass + + def Cancel(self) -> None: + """ Stop wait Function from executing when the timer expires. """ + pass + + def Change(self) -> None: + """ Set a new Time value for current and future timers in this instance. """ + pass + + def Restart(self) -> None: + """ Restarts the timer – executes the Function in Time seconds. If the a timer is active, cancels that timer before starting the new timer. + """ + pass diff --git a/system/__init__.py b/system/__init__.py new file mode 100644 index 0000000..94efccb --- /dev/null +++ b/system/__init__.py @@ -0,0 +1,57 @@ +from typing import Optional +from Clock import Clock +from Email import Email +from File import File +from MESet import MESet +from RFile import RFile +from Timer import Timer +from Wait import Wait + +# ------ SSL METHODS -------- +#TODO + +# ------ TIME METHODS -------- +#TODO + +# ------ NETWORK METHODS -------- +def WakeOnLan(macAddress: str, port: Optional[int]=9) -> None: + """ Wake-on-LAN is an computer networking standard that allows a computer to be awakened by a network message. The network message, ‘Magic Packet’, is sent out through UDP broadcast, port 9. + + Arguments: + - macAddress (string) - Target device’s MAC address. The format is six groups of two hex digits, separated by hyphens ('01-23-45-67-ab-cd', e.g.). + - (optional) port (int) - Port on which target device is listening. + + Note: Typical ports for WakeOnLan are 0, 7 and 9. + """ + pass + +def Ping(hostname: Optional[str]='localhost', count: Optional[int]=5) -> tuple[int, int, float]: + """ Ping a host and return the result in a tuple: (# of success ping, # of failure ping , avg time) + + Arguments: + - (optional) hostname (string) - IP address to ping. + - (optional) count (int) - how many times to ping. + + Returns + - tuple (# of success, # of fail, avg time ) (int, int, float) + """ + return () + + +# ------ OTHER METHODS -------- +def GetSystemUpTime() -> int: + """ Returns system up time in seconds. + + Returns + - system up time in seconds (int) + """ + ... + +def ProgramLog(Entry: str, Severity: Optional[str]='error') -> None: + """ Write entry to program log file. + + Arguments: + - Entry (string) - the message to enter into the log + - (optional) Severity (string) - indicates the severity to the log viewer. ('info', 'warning', or 'error') + """ + ... diff --git a/ui_wrapper/Button.py b/ui_wrapper/Button.py new file mode 100644 index 0000000..65d52a3 --- /dev/null +++ b/ui_wrapper/Button.py @@ -0,0 +1,132 @@ +from typing import Union +import ui_wrapper, device + + +class Button(): + """ Representation of Hard/Soft buttons + + A button may trigger several events depending on the configuration; however, Touch Panels only issue Pressed and Released messages to the controller. Other events (e.g., Held, Repeated) are timer driven within the Button instance. + + Arguments: + UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + ID (int,string) - ID or Name of the UIObject + (optional) holdTime (float) - Time for Held event. Held event is triggered only once if the button is pressed and held beyond this time. If holdTime is given, it must be a floating point number specifying period of time in seconds of button being pressed and held to trigger Held event. + (optional) repeatTime (float) - Time for Repeated event. After holdTime expires, the Repeated event is triggered for every additional repeatTime of button being held. If repeatTime is given, it must be a floating point number specifying time in seconds of button being held. + + Note: If button is released before holdTime expires, a Tapped event is triggered instead of a Released event. If the button is released after holdTime expires, there will be no Tapped event. + + Parameters: + BlinkState - Returns (string) - the current blink state ('Not blinking' or 'Blinking') + Enabled - Returns (bool) - True if the control object is enabled else False + Host - Returns (extronlib.device.UIDevice) - UIDevice object that hosts this control object + ID - Returns (int) - the object ID + Name - Returns (string) - the object Name + PressedState - Returns (bool) - True if the button is pressed, else False + State - Returns (int) - the current visual state number + > Note: It does not return the current state if the button is blinking. + Visible - Returns (bool) - True if the control object is visible else False + + + Events: + Held - (Event) Get/Set the callback when hold expire event is triggered. The callback function must accept exactly two parameters, which are the Button that triggers the event and the state (e.g. ‘Held’). + Pressed - (Event) Get/Set the callback when the button is pressed. The callback function must accept exactly two parameters, which are the Button that triggers the event and the state (e.g. ‘Pressed’). + Released - (Event) Get/Set the callback when the button is released. The callback function must accept exactly two parameters, which are the Button that triggers the event and the state (e.g. ‘Held’). + Repeated - (Event) Get/Set the callback when repeat event is triggered. The callback function must accept exactly two parameters, which are the Button that triggers the event and the state (e.g. ‘Repeated’). + Tapped - (Event) Get/Set the callback when tap event is triggered. The callback function must accept exactly two parameters, which are the Button that triggers the event and the state (e.g. ‘Tapped’). + """ + UIHost = None + ID = 0 + holdTime = 0.0 + repeatTime = 0.0 + BlinkState = '' + Enabled = True + Held = None + Name = '' + Pressed = None + PressedState = True + Released = None + Repeated = None + State = 0 + Tapped = None + Visible = True + + def __init__(self, UIHost: device.UIDevice, ID: Union[int, str], holdTime: float=None, repeatTime: float=None) -> None: + """ Button class constructor. + + Arguments: + - UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + - ID (int,string) - ID or Name of the UIObject + - (optional) holdTime (float) - Time for Held event. Held event is triggered only once if the button is pressed and held beyond this time. If holdTime is given, it must be a floating point number specifying period of time in seconds of button being pressed and held to trigger Held event. + - (optional) repeatTime (float) - Time for Repeated event. After holdTime expires, the Repeated event is triggered for every additional repeatTime of button being held. If repeatTime is given, it must be a floating point number specifying time in seconds of button being held. + """ + ... + + def CustomBlink(self, rate: float, stateList: list[int]) -> None: + """ Make the button cycle through each of the states provided. + + Arguments: + - rate (float) - duration of time in seconds for one visual state to stay until replaced by the next visual state. + - stateList (list of ints) - list of visual states that this button blinks among. + """ + ... + + def SetBlinking(self, rate: str, stateList: list[int]) -> None: + """ Make the button cycle, at ADA compliant rates, through each of the states provided. + + ``` + +-----------+-------------+ + | Rate | Frequency | + +===========+=============+ + | Slow | 0.5 Hz | + +-----------+-------------+ + | Medium | 1 Hz | + +-----------+-------------+ + | Fast | 2 Hz | + +-----------+-------------+ + ``` + + Note: Using this function will blink in unison with other buttons. + + Arguments: + - rate (string) - ADA compliant blink rate. ('Slow', 'Medium', 'Fast') + - stateList (list of ints) - list of visual states that this button blinks among. + + """ + ... + + def SetEnable(self, enable: bool) -> None: + """ Enable or disable an UI control object. + + Arguments: + - enable (bool) - True to enable the object or False to disable it. + """ + ... + + def SetState(self, State: int) -> None: + """ Set the current visual state + + Arguments: + - State (int) - visual state number + + Note: Setting the current state stops button from blinking, if it is running. (SetBlinking()) + """ + ... + + def SetText(self, text: str) -> None: + """ Specify text to display on the UIObject + + Arguments: + - text (string) - text to display + + Raises: + - TypeError + """ + ... + + def SetVisible(self, visible: bool) -> None: + """ Change the visibility of an UI control object. + + Arguments: + - visible (bool) - True to make the object visible or False to hide it. + """ + ... diff --git a/ui_wrapper/Knob.py b/ui_wrapper/Knob.py new file mode 100644 index 0000000..8d51e6e --- /dev/null +++ b/ui_wrapper/Knob.py @@ -0,0 +1,26 @@ +class Knob(): + """ Knob is a rotary control that has 36 steps for a full revolution + + Arguments: + - UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + - ID (int) - ID of the UIObject + + Parameters: + - Host - Returns (extronlib.device.UIDevice) - UIDevice object that hosts this control object + - ID - Returns (int) - the object ID + + Events: + - Turned - (Event) Get/Set callback when knob is turned. The callback takes two parameters. The first one is the Knob itself and the second one is a signed integer indicating steps that was turned. Positive values indicate clockwise rotation. + """ + UIHost = None + ID = 0 + Turned = None + + def __init__(self, UIHost, ID): + """ Knob class constructor. + + Arguments: + - UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + - ID (int) - ID of the UIObject + """ + ... diff --git a/ui_wrapper/Label.py b/ui_wrapper/Label.py new file mode 100644 index 0000000..a9ff0a8 --- /dev/null +++ b/ui_wrapper/Label.py @@ -0,0 +1,48 @@ +from typing import Union +import device + +class Label(): + """ Label object displays text string on the screen + + Arguments: + - UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + - ID (int,string) - ID or Name of the UIObject + + Parameters: + - Host - Returns (extronlib.device.UIDevice) - UIDevice object that hosts this control object + - ID - Returns (int) - the object ID + - Name - Returns (string) - the object Name + - Visible - Returns (bool) - True if the control object is visible else False + """ + UIHost = None + ID = 0 + Name = '' + Visible = True + + def __init__(self, UIHost: device.UIDevice, ID: Union[int, str]) -> None: + """ Label class constructor. + + Arguments: + - UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + - ID (int,string) - ID or Name of the UIObject + """ + ... + + def SetText(self, text: str) -> None: + """ Specify text to display on the UIObject + + Arguments: + - text (string) - text to display + + Raises: + - TypeError + """ + ... + + def SetVisible(self, visible: bool) -> None: + """ Change the visibility of an UI control object. + + Arguments: + - visible (bool) - True to make the object visible or False to hide it. + """ + ... diff --git a/ui_wrapper/Level.py b/ui_wrapper/Level.py new file mode 100644 index 0000000..f468462 --- /dev/null +++ b/ui_wrapper/Level.py @@ -0,0 +1,70 @@ +from typing import Optional +import device + + +class Level(): + """ This module defines interfaces of Level UI. + + Arguments: + - UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + - ID (int) - ID of the UIObject + + Parameters: + - Host - Returns (extronlib.device.UIDevice) - UIDevice object that hosts this control object + - ID - Returns (int) - the object ID + - Level - Returns (int) - the current level + - Max - Returns (int) - the upper bound of the level object + - Min - Returns (int) - the lower bound of the level object + - Name - Returns (string) - the object Name + - Visible - Returns (bool) - True if the control object is visible else False + """ + UIHost = None + ID = 0 + Name = '' + Visible = True + Level = 0 + Max = 0 + Min = 0 + + def __init__(self, UIHost: device.UIDevice, ID: int) -> None: + """ Level class constructor. + + Arguments: + - UIHost (extronlib.device.UIDevice) - Device object hosting this UIObject + - ID (int) - ID of the UIObject + """ + ... + + def Dec(self) -> None: + """ Nudge the level down a step """ + ... + + def Inc(self) -> None: + """ Nudge the level up a step """ + ... + + def SetLevel(self, Level: int) -> None: + """ Set the current level + + Arguments: + - Level (int) - Discrete value of the level object + """ + ... + + def SetRange(self, Min: int, Max: int, Step: Optional[int]=1) -> None: + """ Set level object’s allowed range and the step size + + Arguments: + - Min (int) - Minimum level + - Max (int) - Maximum level + - (optional) Step (int) - Optional step size for Inc() and Dec(). + """ + ... + + def SetVisible(self, visible: bool) -> None: + """ Change the visibility of an UI control object. + + Arguments: + - visible (bool) - True to make the object visible or False to hide it. + """ + ... \ No newline at end of file diff --git a/ui_wrapper/Slider.py b/ui_wrapper/Slider.py new file mode 100644 index 0000000..dd9656a --- /dev/null +++ b/ui_wrapper/Slider.py @@ -0,0 +1,2 @@ +class Slider(): + pass \ No newline at end of file diff --git a/ui_wrapper/__init__.py b/ui_wrapper/__init__.py new file mode 100644 index 0000000..eec2630 --- /dev/null +++ b/ui_wrapper/__init__.py @@ -0,0 +1,5 @@ +from Button import Button +from Knob import Knob +from Label import Label +from Level import Level +from Slider import Slider \ No newline at end of file