Active Topics

 


Reply
Thread Tools
Posts: 290 | Thanked: 385 times | Joined on Jan 2012 @ Madrid, Spain
#1621
Hi.
I think I have found something following your links:
https://github.com/ajalkane/profilem...ctionalarm.cpp
https://github.com/ajalkane/profilem...eactionalarm.h
The problem is that I can't figure out how to change an already set alarm... I'll give it another chance tomorrow...

Regards.
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1622
Sorry, I'm not here too often these days. Leave me a private message if you need to get in touch. I get an email from those.

If I understand you correctly you're trying to modify an existing alarm with a script?

You can't. At least not directly. IIRC, you have to get the attributes of the alarm you want to change with its cookie from the timed daemon, change those attributes to your liking, set a new alarm with them and delete the original.

Or are you trying to trigger something when an alarm goes off? If that's the case have a look at this.

I think I have the list of meanings for the actions_struct indices stored somewhere, but couldn't find them on this computer. I'll look for them if you still need them.

Edit: Found the list in my N9 (which came alive after spending 4 hours on the charger)

Edit2: ...aaannnd I just realised it isn't valid anymore because it's for an older version of ProfileMatic

0=Profile 'general' 'meeting' 'silent'
2=ringing percentage
3=Flightmode 0=off 1=on
5=PSM 0=off 1=on
7=Bluetooth 0=off 1=on 2=on and visible
9=Gsm mode 0=dual 1=GSM 2=3G
11=Standbyscreen 0=off 1=on
15='command line on activate'
16='command line on deactivate'
17=Array(list(im_provider))*X
18='Status message'
21=[{[path/to/.desktop]}]
22=[alarm title,seconds,snooze,sound]

Last edited by slarti; 2015-02-22 at 15:41.
 

The Following User Says Thank You to slarti For This Useful Post:
Posts: 290 | Thanked: 385 times | Joined on Jan 2012 @ Madrid, Spain
#1623
Hi.

Thank you very much for the answer.
You're right about what I want to do: change the alarm trigger time. I also thought about your suggestion to add a new alarm and delete the old one... but hadn't figured out yet how to do it.
Regarding the changes in PM I can only say that using PM's interface I can set alarms without problems. However the struct position is 24, not 22. I'm not at home now, but I'll try to gather more information later.
It would be interesting also to try to find out how the actions_struct and PM's interface interacts with dbus, right?

Regards.
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1624
You can query the timed daemon easily with python using its dbus methods.

You can get the methods with:
Code:
qdbus --system com.nokia.time /com/nokia/time
Example (This will get you all the cookies for alarms with the attribute 'APPLICATION':'clock' and will print out the cookie for each alarm/event and all of its attributes):

Code:
#!/usr/bin/python

import dbus

bus = dbus.SystemBus()

time_obj = bus.get_object('com.nokia.time', '/com/nokia/time')
time_intf = dbus.Interface(time_obj, 'com.nokia.time')

cookies = time_intf.get_cookies_by_attributes({'APPLICATION': 'clock'})

for cookie in cookies:
        attributes = time_intf.query_attributes(cookie)
        print cookie
        for key,value in attributes.items():
                print '   '+key,value
To cancel/delete alarm/event:

Code:
time_intf.cancel(cookie)
Setting an alarm directly through dbus to the timed daemon is something I never figured out. That's why I pestered ajalkane to include setting an alarm as a ProfileMatic action. Thanks to the brilliant and simple-to-use dbus service in ProfileMatic we're able to set alarms from the command line using a script like the one you quoted originally.

No other aspect of alarms can be manipulated through ProfileMatic except for setting one with [title, time, snooze_period, sound]. The rest have to be done through the the stock clock application UI, the dbus methods described above or using Qt (which I can't)
 

The Following User Says Thank You to slarti For This Useful Post:
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1625
As for the actions_struct and how I gathered the information on it:

I used this script running in terminal while I went through every possible action in ProfileMatic.

Code:
#!/usr/bin/env python

def my_func(struct):
        for index, item in enumerate(struct[5]):
                print index, item

import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()

bus.add_signal_receiver(my_func,signal_name="ruleUpdated",dbus_interface="org.ajalkane.profilematic")

loop = gobject.MainLoop()
loop.run()
Every time you save a rule in PM a 'ruleUpdated' -signal is sent out with the whole structure for the rule. The script catches it and prints out the 'actions'-part of the structure chopped to individual actions. You can see the datatype a single action accepts and the index number.

Create an empty rule and give it one action and after saving it you can see which index number has changed. Go through all the actions saving after each change and you can create a fresh list of actions_struct indeces. Simple and tedious but works.
 

The Following User Says Thank You to slarti For This Useful Post:
Posts: 290 | Thanked: 385 times | Joined on Jan 2012 @ Madrid, Spain
#1626
Hi.
This explains why all the non-relevant elements in the struct where set with empty/default values.
From what I have tried and you say, I think I will go through the 'delete-and-reset' way. I will probably use the 'get_cookies_by_attribute' method to know which one to cancel and set a new one again.
As for the regular 'add_event' method I couldn't either figure out how to set the values according to the signature....

Thank you again for the explanations, I'll check-in back with my results.

Regards.
 

The Following 2 Users Say Thank You to pasko For This Useful Post:
Posts: 290 | Thanked: 385 times | Joined on Jan 2012 @ Madrid, Spain
#1627
Hi.

I just want to confirm that, after a few days testing this procedure (i.e: delete & reset alarm) everything works as expected.

Regards.
 

The Following User Says Thank You to pasko For This Useful Post:
Posts: 278 | Thanked: 114 times | Joined on Jan 2010 @ SD, CA
#1628
Originally Posted by Sorrow View Post
It's a silly line in perl, I put it into .sh script:
perl -ne 'print if (rand() < .02)' /home/user/music.list > /home/user/playlist.m3u

Change .02 value for more songs in output.

And music.list was generated via something like 'find /home/user/MyDocs/Music/ -name *.mp3 -print0'
Couple of issue with this
1. "find /home/user/MyDocs/Music/ -name *.mp3 -print0" -print0 is not acceptable use "find /home/user/MyDocs/Music/ -name *.mp3 >/home/user/music.list"
2. added a space behind playlist.m3u, removed that.

then the m3u opens but then it say "Cant open server"
On the other hand any m3u opened this way doesnt work. it has to be somehow opened in music and "added to queue"
xdg-open ...playlist.m3u does not work either

What i am trying to do is automatically queue up and play music automatically using profilematic.

mplayer method is kind of crude.
__________________
Present: 950, N1
Past: 1520, Nexus 7, Lumia 720, 928, ICON AKA 929b, Asus Transformer, Nokia N9, Nokia n97, Nokia N810 Nokia E71 Nokia E62 Nokia 6102 Sanyo Ericsson Sony

Last edited by balisingh; 2016-07-13 at 01:31.
 

The Following User Says Thank You to balisingh For This Useful Post:
www.rzr.online.fr's Avatar
Posts: 1,348 | Thanked: 1,863 times | Joined on Jan 2009 @ fr/35/rennes
#1629
Is this app still maintained ?

can you please update where to get it and also edit this page :

https://wiki.maemo.org/Apps
__________________
Current obsession:

https://purl.org/rzr/abandonware

Please help to list all maemo existing apps :

https://github.com/abandonware/aband...ment-578143760

https://wiki.maemo.org/Apps#

I am looking for " 4 inch TFT LCD display screen " for Nokia n950 HandSet

http://rzr.online.fr/q/lcd


Also, I need online storage to archive files :

http://db.tt/gn5Qffd6#

https://my.pcloud.com/#page=register...e=g8ikZmcfEJy#
 
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#1630
Originally Posted by www.rzr.online.fr View Post
Is this app still maintained ?

can you please update where to get it and also edit this page :

https://wiki.maemo.org/Apps
Maintained? Do not think so (it works flawlessly).
https://openrepos.net/content/ajalkane/profilematic
__________________
SIM-Switcher, automated SIM switching with a Double (Dual) SIM adapter
--
Thank you all for voting me into the Community Council 2014-2016!

Please consider your membership / supporting Maemo e.V. and help to spread this by following/copying this link to your TMO signature:
[MC eV] Maemo Community eV membership application, http://talk.maemo.org/showthread.php?t=94257

editsignature, http://talk.maemo.org/profile.php?do=editsignature
 
Reply


 
Forum Jump


All times are GMT. The time now is 07:13.