@@ -31,22 +31,22 @@ class LedPin(IntFlag):
31
31
ALL = 127
32
32
33
33
34
- @dataclass
34
+ @dataclass ( frozen = True )
35
35
class FileEntry :
36
36
"""File stored in the Busy Tag device."""
37
37
name : str
38
38
size : int
39
39
type : FileEntryType = FileEntryType .FILE
40
40
41
41
42
- @dataclass
42
+ @dataclass ( frozen = True )
43
43
class WifiConfig :
44
44
"""Wifi configuration."""
45
45
ssid : str
46
46
password : str
47
47
48
48
49
- @dataclass
49
+ @dataclass ( frozen = True )
50
50
class LedConfig :
51
51
pins : LedPin
52
52
color : str
@@ -55,7 +55,7 @@ def __post_init__(self):
55
55
assert rgb_re .match (self .color )
56
56
57
57
58
- @dataclass
58
+ @dataclass ( frozen = True )
59
59
class LedPatternEntry :
60
60
pins : LedPin
61
61
color : str
@@ -67,7 +67,7 @@ def __post_init__(self):
67
67
assert self .speed >= 0
68
68
assert self .delay >= 0
69
69
70
- def __str__ (self ):
70
+ def __str__ (self ) -> str :
71
71
return f'{ int (self .pins )} ,{ self .color } ,{ self .speed } ,{ self .delay } '
72
72
73
73
@@ -122,6 +122,7 @@ def __init__(self, port_path: Optional[str] = None,
122
122
self .__capacity = int (self .__get_readonly_attribute ('TSS' ))
123
123
self .__device_id = self .__get_readonly_attribute ('ID' )
124
124
self .__firmware_version = self .__get_readonly_attribute ('FV' )
125
+ self .__hostname = self .__get_readonly_attribute ('LHA' ).removeprefix ('http://' )
125
126
self .__manufacturer = self .__get_readonly_attribute ('MN' )
126
127
self .__name = self .__get_readonly_attribute ('DN' )
127
128
@@ -274,6 +275,10 @@ def capacity(self) -> int:
274
275
def device_id (self ) -> str :
275
276
return self .__device_id
276
277
278
+ @property
279
+ def hostname (self ) -> str :
280
+ return self .__hostname
281
+
277
282
@property
278
283
def firmware_version (self ) -> str :
279
284
return self .__firmware_version
0 commit comments