@@ -147,7 +147,8 @@ def get_ascii(hexpart: str) -> str:
147147
148148
149149def parse_notification (
150- sender : Any , data : bytes ,
150+ sender : Any ,
151+ data : bytes ,
151152) -> (
152153 LiveModeEvent
153154 | VolumeEvent
@@ -172,8 +173,8 @@ def parse_notification(
172173 hexstr = data .hex ().upper ()
173174
174175 if hexstr .startswith (const .RESP_KEEP_ALIVE ):
175- # Keep alive message - strip the FEDC prefix and return the payload
176- payload = data [2 :] # Skip first 2 bytes (FEDC)
176+ # Keep alive message - strip frame markers ( FEDC prefix, EF suffix)
177+ payload = data [2 :- 1 ] # Skip first 2 bytes (FEDC) and last byte (EF )
177178 return KeepAliveEvent (payload = payload )
178179
179180 if hexstr .startswith (const .RESP_LIVE_MODE ):
@@ -271,7 +272,9 @@ def parse_notification(
271272 playing = int (hexstr [8 :10 ], 16 )
272273 duration = int (hexstr [10 :14 ], 16 )
273274 return PlaybackEvent (
274- file_index = file_index , playing = bool (playing ), duration = duration ,
275+ file_index = file_index ,
276+ playing = bool (playing ),
277+ duration = duration ,
275278 )
276279
277280 if hexstr .startswith (const .RESP_DELETE_FILE ):
@@ -288,7 +291,9 @@ def parse_notification(
288291 action_mode = int (hexstr [14 :16 ], 16 )
289292 mode_str = "Set Action" if action_mode else "Transfer Mode"
290293 return CapacityEvent (
291- capacity_kb = capacity , file_count = file_count , mode_str = mode_str ,
294+ capacity_kb = capacity ,
295+ file_count = file_count ,
296+ mode_str = mode_str ,
292297 )
293298
294299 if hexstr .startswith (const .RESP_FILE_ORDER ):
0 commit comments