Notices


Reply
Thread Tools
Posts: 1,086 | Thanked: 2,964 times | Joined on Jan 2010
#11
I must admit, I actually thought prolog was some ancient programming language that I wouldnt be interested in learning again (I think I might have mixed it up with Pascal in my head). However, reading your examples it does seem like something that would interest me to learn more about, so Im glad I clicked on the link and I'll definitely check out your project over the weekend

Just thinking about it now, I think I did do a module in Prolog back in University (15-20 years ago) maybe in AI. Is that the one filled with predicates? Predicates and pointers, the two 'p's in programming I try to stay well clear of :P
 
Posts: 4 | Thanked: 0 times | Joined on Apr 2010
#12
Originally Posted by KiberGus View Post
P.P.S. I'm a little bit scared by absence of posts in this thread. Is this project useless or just not so easy to understand?
Just for feedback: your idea is brilliant. I've made some simple automation scripts in Python and there's a lot of messy boilerplate with callbacks, state management and so on.

The declarative style of Prolog makes the code much leaner as seen in your example scripts. (ET-Prolog is nicely documented for an early release I must add).

As for the "easy to understand"-part: I guess Prolog may be off-putting for some, but I bet there are more than enough computer geeks using the N900 to form a user base.

As for myself, I just hadn't had the chance to try it out yet, but weekend is coming soon
 
Posts: 254 | Thanked: 122 times | Joined on Nov 2009
#13
Originally Posted by DaSilva View Post
Will this be available in extras-devel and is there a GUI for it?
Currently it is available on home site. I don't think that autobuilder (which builds packages for extras-devel) would be able to build it because SDK misses SWI-Prolog package (which is strange, because n900 has) and I can't add it to repositories because it is prohibited to add packages already included in n900's baseroot. And I don't have time to rule this situation right now.
There is no GUI and I think that there would never be GUI for ET-Prolog itself because it is programming language. But there could be simple GUI which generate scripts for ET-Prolog. For example silencer could be turned to GUI, which generates needed script and ET-Prolog runs it.
It is much easier to develop such GUI, than GUI with daemon.
Originally Posted by DaSilva View Post
What is already possible with it?
It can monitor files and DBus. As far as nearly all communication in maemo is done via DBus it is possible to write needed predicates (both triggers and actions) in ET-Prolog. Current version includes:
playAudio(FILE)
phoneProfile(PROFILE)
% 2G or 3G DUAL
setRadioMode(MODE)
% mobile network connection true or false
setCellularRadio(STATE)
% PATTERN can be: PatternIncomingCall
startVibrate(PATTERN)
stopVibrate(PATTERN)
% STATE can be locked and unlocked
locked(STATE)
% PATTERN can be: PatternBatteryLow
startLedPattern(PATTERN)
startLedPattern(PATTERN)

lightSensor(LIGHT, TIME, MEASURES)
proximitySensor(STATE)
headphonesState(STATE)
slideState(STATE)
shutterState(STATE)

Some of them could be broken, but most part was tested. Writing new ones is very simple, look at /opt/maemo/usr/lib/et-prolog/n900utils.pl
mostly they are one or two lines.

We also have alarmd support and liblocation support. So you can write actions, that depend on schedule or location.

And look at et-prolog/init.pl. There are examples for most part of terms.
 

The Following 2 Users Say Thank You to KiberGus For This Useful Post:
Posts: 254 | Thanked: 122 times | Joined on Nov 2009
#14
Originally Posted by kojacker View Post
Just thinking about it now, I think I did do a module in Prolog back in University (15-20 years ago) maybe in AI. Is that the one filled with predicates? Predicates and pointers, the two 'p's in programming I try to stay well clear of :P
Yes, this is one filled with predicates. But it is used in a different manner. Usually prolog is used for theorem proving, especially at universities, or for exhaustive search problems.
 
Posts: 729 | Thanked: 155 times | Joined on Dec 2009
#15
I thought a GUI would be nice for selecting/editing make active/disabled the different scripts, not writing them.
The problem with extras could be a real problem for this application but maybe it will be solved with PR1.2!?
Otherwise you could open a bug report.
 
Posts: 254 | Thanked: 122 times | Joined on Nov 2009
#16
One more version released. Fixed addHint, 29 days in alarmTerm, DBus messages that didn't go to system bus, when needed, made GPS logger a library.
Originally Posted by DaSilva View Post
I thought a GUI would be nice for selecting/editing make active/disabled the different scripts, not writing them.
You can edit scripts with your favorite editor. There are GUI editors for maemo. GUI for activating and deactivating scripts? May be, but if you place scripts in separate files and include them from init.pl with consult command you would be able to add and delete them by commenting single line of code.
Originally Posted by DaSilva View Post
The problem with extras could be a real problem for this application but maybe it will be solved with PR1.2!?
Otherwise you could open a bug report.
Yes. But this needs time.

By the way. Another key feature of this project is that events and actions can be dependent. You can use term, that you have defined for other events. If I have written code, hat determines that user sleeps I can then use these events. In other projects you can achieve such functionality only by sending signals to yourself.
 
Posts: 254 | Thanked: 122 times | Joined on Nov 2009
#17
Today I started adding functionality to library and understood that DBus interface should be redesigned a bit to support more types, especially uin32, which is widely used in maemo.
It is not possible to send DBus signals and method calls with uint32 argument now.
 

The Following User Says Thank You to KiberGus For This Useful Post:
Posts: 36 | Thanked: 77 times | Joined on Oct 2010
#18
Thanks KiberGus for the efforts. I was interested in AI in late 90's but it withered away with time. Of late Siri has been making news which got me back here. I'm re-learning Prolog now and hope to make some contribution. Keep up the good work.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 10:47.