@@ -124,7 +124,9 @@ def _map_volume(self, volume: float) -> int:
124
124
125
125
@property
126
126
def connected (self ) -> bool :
127
- """True if the DFPlayer is connected."""
127
+ """
128
+ :return: True if the DFPlayer is connected.
129
+ """
128
130
return self ._send_command ("" )
129
131
130
132
def set_baud_rate (self , rate : int ) -> bool :
@@ -141,7 +143,9 @@ def set_baud_rate(self, rate: int) -> bool:
141
143
142
144
@property
143
145
def volume (self ) -> float :
144
- """Volume level, as a float between 0 and 1."""
146
+ """
147
+ :return: Volume level, as a float between 0 and 1.
148
+ """
145
149
response = self ._send_query ("VOL" , "?" )
146
150
df_volume = self ._unwrap_int (response [7 :- 1 ])
147
151
if df_volume < 0 :
@@ -339,25 +343,35 @@ def total_files(self) -> int:
339
343
340
344
@property
341
345
def file_number (self ) -> int :
342
- """The file number of the currently playing file."""
346
+ """
347
+ :return: The file number of the currently playing file.
348
+ """
343
349
return self ._unwrap_int (self ._send_query ("QUERY" , 1 ))
344
350
345
351
@property
346
352
def file_name (self ) -> str :
347
- """The file name of the currently playing file."""
353
+ """
354
+ :return: The file name of the currently playing file.
355
+ """
348
356
return self ._send_query ("QUERY" , 5 )
349
357
350
358
@property
351
359
def played_time (self ) -> int :
352
- """The number of seconds the current sound has played."""
360
+ """
361
+ :return: The number of seconds the current sound has played.
362
+ """
353
363
return self ._unwrap_int (self ._send_query ("QUERY" , 3 ))
354
364
355
365
@property
356
366
def total_time (self ) -> int :
357
- """The length of the current sound in seconds."""
367
+ """
368
+ :return: The length of the current sound in seconds.
369
+ """
358
370
return self ._unwrap_int (self ._send_query ("QUERY" , 4 ))
359
371
360
372
@property
361
373
def playing (self ) -> bool :
362
- """True if a sound is currently playing."""
374
+ """
375
+ :return: True if a sound is currently playing.
376
+ """
363
377
return self .played_time < self .total_time
0 commit comments