@@ -12,7 +12,7 @@ class TimelineItem(
12
12
itemId : Uuid ,
13
13
parentId : Uuid , timestamp : UInt ,
14
14
duration : UShort , type : Type ,
15
- flags : UShort , layout : UByte ,
15
+ flags : UShort , layout : Layout ,
16
16
attributes : List <Attribute >,
17
17
actions : List <Action >
18
18
) : StructMappable() {
@@ -23,12 +23,29 @@ class TimelineItem(
23
23
24
24
companion object {
25
25
fun fromValue (value : UByte ): Type {
26
- return values() .firstOrNull { it.value == value }
26
+ return entries .firstOrNull { it.value == value }
27
27
? : error(" Unknown timeline item type: $value " )
28
28
}
29
29
}
30
30
}
31
31
32
+ enum class Layout (val value : UByte ) {
33
+ GenericPin (1u ),
34
+ CalendarPin (2u ),
35
+ GenericReminder (3u ),
36
+ GenericNotification (4u ),
37
+ CommNotification (5u ),
38
+ WeatherPin (6u ),
39
+ SportsPin (7u );
40
+
41
+ companion object {
42
+ fun fromValue (value : UByte ): Layout {
43
+ return entries.firstOrNull { it.value == value }
44
+ ? : error(" Unknown timeline item layout: $value " )
45
+ }
46
+ }
47
+ }
48
+
32
49
val itemId = SUUID (m, itemId)
33
50
val parentId = SUUID (m, parentId)
34
51
@@ -52,7 +69,7 @@ class TimelineItem(
52
69
*/
53
70
val flags = SUShort (m, flags, endianness = ' <' )
54
71
55
- val layout = SUByte (m, layout)
72
+ val layout = SUByte (m, layout.value )
56
73
val dataLength = SUShort (m, endianness = ' <' )
57
74
val attrCount = SUByte (m, attributes.size.toUByte())
58
75
val actionCount = SUByte (m, actions.size.toUByte())
0 commit comments