answered
2014-07-07 13:58:56 +0200
Hello everybody,
I started to write some code (GitHub), to do something like profilematic, but with a much more modern architecture. It's still in the early days of prototyping, and there is nothing interesting to show yet. I didn't know until today that there were already quite a lot of nice preparation work done on TJC, so I will share what I did too, so that we can do it together (c)
I'm at Step 2 of this answer. I'm open to discuss my architecture and will edit the answer if you agree.
Overview
I'm trying to write a library for having a bot reacting to events and executing actions, the phonebot library. Phonebot have
- libphonebot, a static library that provides the engine to read and execute rules
- plugins to have more capabilities
- phonebotd, the daemon that execute these rules
- jolla-settings-phonebot, a settings plugin to configure phonebot
- harbour-phonebot, a selfcontained daemon + app to pass harbour
Since most of the stuff is done inside libphonebot, I can create several packages that share the same basis, one for harbour, others for openrepos etc. Note that phonebotd and harbour-phonebot might be incompatible, so you would run either phonebotd + settings-phonebot or harbour-phonebot.
Architecture
phonebot isn't trying to reinvent the wheel and takes inspiration from both profilematic, IFTTT and on{X}. The idea is simple: you build rules, either à-la profilematic-IFTTT, with if -> then conditions, or by writing scripts.
Since we are with Qt, we can take advantage of QML and JS to write rules. Actually phonebot is just reading QML files that contains rules. It uses the powerful QQmlEngine to do all the hard work of parsing, interpreting etc.
A Rule
in phonebot is a QML component that have 3 properties
trigger
: something that triggers the rule condition
: a condition (or conditions) to respect for the rule to be active actions
: a series of actions to execute when the rule is triggered, and when conditions are respected
The Trigger
is in charge of emitting signals to run the Rule
. Trigger
s could be: when it's 10pm, when you enter in the home wifi zone, when Battery reached a certain level etc.
The Condition
do not provide any signal, and represent more a state. A Condition
could be "when driving", "when at home" etc. (even if implementing this kind of condition is rather tricky).
An Action
is what to run: execute a program, turn on / off some settings, change an ambience, or use DBus to do stuff.
Here is an example of scripted rule. You will also be able to configure rule with a friendly UI (using default Triggers, Conditions and Actions).
import org.SfietKonstantin.phonebot 1.0
Rule {
name: "SimpleRule"
trigger: TimeTrigger { hour: 22; minute: 0 }
actions: ActionSilent { silent: true }
}
Technologies
I need to check if the QtMobility modues got ported to Qt 5. It's unsure if QSystem*
are available. However, a lot of APIs are actually open-source, and, even if they are forbidden in harbour, they can be integrated (statically) in phonebot.
Here is a non-exaustive list of libraries I plan to use
Testing versions
Initial POC is done, and I have some testing versions, that allows you to play with time and profile. Have a look at TMO and test them !
it is a "must have" feature. Including Cell/WLAN based location triggers.
ortylp ( 2013-12-25 21:37:34 +0200 )editi suppose this is the most relevant answer at the moment: ajalkane, the creator of profilematic, intends to port profilematic to sailfish, if it's feasible. at the moment he is waiting for a jolla device. i don't know if that perhaps means donations would speed up the process :
edgar ( 2013-12-26 18:25:07 +0200 )editHmm, don't you need possibility to run headless daemons for it (and start them during bootup)? Or possibility for running your app on schedule? Both things are possible, both won't let you get through Harbour criteria at the moment.
Artem ( 2013-12-30 00:58:55 +0200 )editProfilematic would be fantastic, I hope ajalkane could start working with the port, sooner the better. Anyway I think Jolla could add a simple automated silent feature similar to iOS "Do not disturb" feature. This is something we had already in Symbian devices.
shertell ( 2014-01-01 22:22:40 +0200 )editActually, I think it would be a good idea to integrate the profilematic functionality with the Ambience idea. Currently, when you are marking as fav an ambience, you can set the ringtone volume and tones for that ambience. The idea would be to include WLAN/bluetooth/IM status/etc and trigger action
Jorge ( 2014-01-02 15:27:50 +0200 )edit