[tuxdroid-svn] r626 - api/python/trunk
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-10-17 09:21:47
|
Author: Paul_R Date: 2007-10-17 11:21:48 +0200 (Wed, 17 Oct 2007) New Revision: 626 Modified: api/python/trunk/tuxapi_class.py api/python/trunk/tuxapi_const.py Log: * Added the flash_status function in the tux.status class Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-10-17 09:20:28 UTC (rev 625) +++ api/python/trunk/tuxapi_class.py 2007-10-17 09:21:48 UTC (rev 626) @@ -2527,6 +2527,7 @@ Functions list for the users: tux.status.charger_state + tux.status.flash_status tux.status.eyes_closed tux.status.eyes_counter tux.status.eyes_motor @@ -3281,6 +3282,35 @@ return 0 #-------------------------------------------------------------------------- + # Get the last state of sound status + #-------------------------------------------------------------------------- + def flash_status(self): + """ + Get the last sound flash status + + Return a tupple with the audio flash status: + (play state, record state, sound number) + play state : Return the sound number or 0 if no sound is played + record state : Return the recording state + sound number : Return the track which is recorded. + + Example: + >>> (play_state, record_state, sound_number) = tux.status.flash_status() + + """ + if not self.parent.daemon.connected: + return 0 + frame = self.get(0x26) + try: + if len(frame) > 0: + return (ord(frame[5]), ord(frame[6]), ord(frame[7])) + else: + return 0 + except: + return 0 + + + #-------------------------------------------------------------------------- # Get the last state of eyes position counter status #-------------------------------------------------------------------------- def get_eyes_position_counter(self): Modified: api/python/trunk/tuxapi_const.py =================================================================== --- api/python/trunk/tuxapi_const.py 2007-10-17 09:20:28 UTC (rev 625) +++ api/python/trunk/tuxapi_const.py 2007-10-17 09:21:48 UTC (rev 626) @@ -157,6 +157,7 @@ DATAS_STATUS_SOUND_COUNT = 0x23 DATAS_STATUS_PONG = 0x24 DATAS_STATUS_BATTERY = 0x25 +DATAS_STATUS_AUDIO = 0x26 STATUS_WINGS_MOTOR_BACKWARD = 0x01 STATUS_SPIN_MOTOR_BACKWARD = 0x02 |