TpSession, simplified Maemo5 Messaging API
There has been numerous questions and requests from developers about how to send and receive SMS with Maemo 5. There was even lot of rumours that the API is not public. I decided to do something for issue, find out non documented API’s and write examples how to do SMS. After starting work, i soon noticed that there is nothing secret, everything needed was already documented and it was possible to do with documented API’s but it was just a complicated and time consuming task that needs deep understanding how Telepathy Framework works. Writing just an example code expanded to project write simple to use API that allows SMS sending with just couple of lines code.
Memo Telephony and Messaging API is based on Telepathy framework . Telepathy supports many protocols, for example Cellular, SIP, IRC, GoogleTalk, Skype about you just name it. The good thing in Telepathy is also that it separates client and protocol implementations. New client protocols can be added dynamically to system. For example, in Maemo 5, you can just install IRC, Skype or many other protocols with application installer without needing any change to client applications using these services. Clients and elements implementing protocols, called as connection managers are communicating with Dbus. There is no need to link protocols to applications or no need applicatins to support protocol plugins. Telepathy allown also multiple client applications co-exist simultaneously.
Telepathy supports Python, Glib or Qt API . My decision to go wiith Telepathy-Qt4 was clear, Qt is the toolkit in Maemo that has the future. It should be first choice to anyone starts new Maemo applications today.
After I started my Simplification API project, i got involved QtMobility port for Maemo 5. Qt Mobility is full cross platform framework that covers much more than just SMS and messaging. It supports also as example system information, sensors, location, contacts, configuration variable storage, multimedia etc. QtMobility shoud be mumber one choice to access these system services, it has continuity and it is already fully cross platform. QtMobility early Beta or Technology preview for Maemo 5 will be released very soon but it has very limited functionality in SMS/messaging area and there is not yet telephony API at all. It will have full functionality and API set in the near future. I ended using my TpSession library implementing SMS/IM Functionality for Maemo 5 for QtMobility.
I decided to go on publishing my TpSession as it is, stand alone library because there is immediate need for it and it allows easy to access to full Telepathy-Qt4 feature. TpSession is community supported API, it is not part of official Maemo content. It is available from Extras-dev repository or you can just take source, link it statically to you code or even use it as "copy and paste" example code how to use Telepathy-Qt4. Teletaphy-Qt4 is also in extras-devel and it will be part of Maemo 6.
How simple is TpSesison
If you just want send a SMS, two lines are needed
TpSession* tps =new TpSession("ring",true);
tps->sendMessageToAddress("ring",”+555666777”,”Telepathy session is for you”);
If you should also receive one, you need just connect one Signal-Slot pair and handle signal
connect(tps,SIGNAL(messageReceived(const Tp::ReceivedMessage &,TpSessionAccount *)),
SLOT(onMessageReceived(const Tp::ReceivedMessage &,TpSessionAccount *)));
void TestProg::onMessageReceived(const Tp::ReceivedMessage &msg,TpSessionAccount *acc)
qDebug() << "MessageReceived " << msg.text() << "from " << msg.sender()->id();
With TpSession you can do also many other things like get indication of incoming call, fetch list of your contacts from IM services, check their presence status etc.
TpSession is at the monent early 0.1.2 version, it works but there is work to do. It is Open, Open Source LGPL project. If you wold like to see new fearteres on it, you can join the project and contribute code.