Change instance variables to class variables

This commit is contained in:
Triston Armstrong 2021-09-21 10:55:01 -05:00
parent 01844b188a
commit f7371ce7c4

View File

@ -1,5 +1,5 @@
import ProcessorDevice
from typing import Optional, Union
from typing import Callable, Optional, Union
class eBUSDevice():
@ -34,18 +34,9 @@ class eBUSDevice():
- `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
InactivityChanged = None
"""
Event:
- Triggers at times specified by SetInactivityTime() after state transition of inactivity timer.
@ -68,7 +59,7 @@ class eBUSDevice():
Note:
Applies to EBP models only.
"""
self.SleepChanged: callable = None
SleepChanged = None
"""
Event:
- Triggers when sleep state changes.
@ -81,47 +72,57 @@ class eBUSDevice():
print('{} Sleep State Changed: {}'.format(Panel.DeviceAlias, state))
```
"""
self.LidChanged: callable = None
LidChanged = 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
Offline = 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
Online = 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
SleepTimerEnabled: bool = False
DeviceAlias: str = ''
Host = None
""" Handle to the Extron ProcessorDevice to which the eBUSDevice is connected. """
self.InactivityTime: int = 0
InactivityTime: int = 0
"""Seconds since last activity.
Note:
- 0 = Active, Nonzero = Time of inactivity.
- Applies to EBP models only.
"""
self.SleepState: str = ''
SleepState: str = ''
""" the current sleep state of the device ('Asleep', 'Awake')"""
self.PartNumber: str = ''
self.ModelName: str = ''
self.LidState: str = ''
PartNumber: str = ''
ModelName: str = ''
LidState: str = ''
"""the current lid state ('Opened' or 'Closed')"""
self.SleepTimer: int = 0
SleepTimer: int = 0
""" sleep timer timeout"""
self.ID: int = 0
ID: int = 0
"""devices ID (set by DIP switch)"""
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
"""
def Click(self, count: int=1, interval: int=None) -> None:
""" Play default buzzer sound on applicable device