Personal tools
Document Actions

Help needed with tux.monitoring object & methods

Up to Scripts

Help needed with tux.monitoring object & methods

Posted by Pascal M. at February 18. 2008

Please,


Can someone right a simple python script using events & tux.monitoring ?


It will be very helpfull for me, after several tests I failed writing something correct ;)


Re: Help needed with tux.monitoring object & methods

Posted by ks156 at March 23. 2008
To use the events, you've to link the tux.event.xxx to your own function.
For example, if you want to execute a function when the head button is pushed :

tux.event.on_head_bt_pushed = my_funct
def my_funct():
    print 'The head button has been pushed !'

# When you quit your script :
tux.event.on_head_bt_pushed = None

You can have the list of the events with the command : tux.misc.doc(tux.event)

The monitoring function works like the events functions. If you want to monitor the light level, you have to insert your own function :

monitoring_id = tux.monitoring.insert(0x1B, my_function)
# 0x1B if for the light level. You can find all the OPCODE on the file /opt/tuxdroid/api/python/tuxapi_const.py
# in the 'status datas' section. (line 123)
def my_funct (self, args):
    light_level = (args[0] * 256) + args[1]
    print 'ight_level

# When you quit your script :
tux.monitoring.remove(monitoring_id)

You can also find the reference manual here : doc.tuxisalive.com/api or with the command help(tux).

I hope this will help you for your developments.

Re: Help needed with tux.monitoring object & methods

Posted by Pascal M. at March 28. 2008

Thanks :D


I'll try this asap.


I must say that I'm waiting until the new firmware is out to continue my developments, I'm a bit frustrated by the tux-crash after some hours running.



Pascal


Powered by Ploneboard
You are here: Home Forum Scripts Help needed with tux.monitoring object & methods

Powered by Plone CMS, the Open Source Content Management System