This is a little project I’m working on, when it is done I think to release it via github.
Since I’m with Mac OS X, I love the built-in command “say” which converts text to audible speech, text that you can type or just getting a plain text file (a.k.a TXT).
Other thing that I love is Java, because I’ve done many things that I’m satisfied and proud with it.
So, what’s the point?: “Sometimes I’m a lazy men, lol, I’m not kidding you“, e.g.: when it comes up a SMS message to my mobile’s inbox I leave it several hours untouched it until I check the inbox (that’s why I answer to you too late friends… lol). So, I thought: “If <say> command can speech TXT files or text strings, why not develop a program to read the incoming SMS from my mobile phone and it can be talked by my mac?. So I’ve begun the chore of looking for opensource projects that implements the CPMS protocol in order to read the SMS’s storage system. After that, pass the string to “say” it and voilà.
I have a GSM phone (Nokia 6300), it supports bluetooth technology, so I can get the messages (SMS) via bluetooth using a virtual serial port.
It seems pretty easy but indeed it’s more complex I got to think (sure, over Mac OS X). First: googling for SMS opensource libs I’ve found SMSlib, which it is a porting of SMSlib .NET (C#) to Java, it what is a library to read SMSs from GSM and CDMA modems and mobile phones, mostly Nokia, Motorola, Siemens devices. Second: over unix based OSs you need a serial port reader for Java, like the Sun’s CommAPI or RXTX it which implements several libraries for serial and parallel I/O.
As well as, all the related project you need to get working SMSlib and RXTX. After such process (which takes up to 2 hours just reading the docs) I got the platform to start with my weekend Project (well, not as weekend project at all because I’m working yet).
Outlining the steps:
- Install Fink or Macports because you will need opensources libraries into your OS X, if you use GNU/Linux you don’t need this, with just to know how to install packages with any package manager is enough, if you’re a linux user, you quite understand what I’m talking about.
- Read all the SMSlib documentation
- Compile the SMSlib with Mac OS X support (Developers tools must be installed), I prefer the SVN version from the svn repository at Google Code (if you use GNU/Linux it is pretty easy, shell experience is required, MS-Windows there is .exe installers)
- Paste the content of the “dist” folder in /Library/Java/Extensions/ (GNU/Linux instructions inside documentation)
- Install RXTX package for Leopard, thanks to Java Model Railroad Interface project (Tiger and minor releases can use the pre-compiled package inside the MAC_OS_X/ForPackageMaker folder of RXTX.pkg), this will copy the rxtx.jar to /Library/Java/Extensions and it will add the current user to the UUDP groups. (GNU/Linux just copy the rxtx.jar container to your Java Extensions folder). I have to say that this part is complex with OS X if you don’t anything about Mac OS X commands beacause since 10.5.X there is a lot of changes in the commands, e.g.: niutil is not longer available in 10.5.X, it was replace by dscl command in order to setup permissions to users into the groups.
- Setup your mobile phone with a serial port for communication, in my case I’ve used the Bluetooth Serial Port (COM1) listed as a Service under Bluetooth Options at System Preferences, if you need to know which serials ports you have type “ls /dev/cu.*” from a Terminal. (GNU/Linux users can use Gnokii or opensource mobile managers)
- Setup an Eclipse project with the examples in /java/ReadMessage under smsLibrary folder.
- Make your changes and compile it, run it (of course you need turn on as much Bluetooth’s machine as the phone’s).
- Have fun!
Results: So far, I’m just getting only the phone status because CPMS protocol it’s blocked on this model (I guess because I’ve tested with minicom AT serial emulator), so I’ll be trying with other devices).
I’ll keep working on this and I will let you know the good news.
UPDATE: Trying this, if any success I will update this post.