GSM_SMS
| From: | Mika Tuupola | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | GSM_SMS | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-1321@lists.php.net to get a copy of this message | ||
Earlier I mentioned about pearifying some PHP classes I have
made for converting and sending operator logos, ringintones,
textmessages etc. via kannel.
I think the code for converting and sending the messages should
be separated and atleast the latter abstracted for different
bearers. The bearer code should allways have just one send()
method which works with both binary and ascii messages without
giving any other parameters than the message itself. The send
method is different with every bearer because atleast binary
messages are handled very different ways between the bearers.
This might cause some bloating in the bearer code since it
has to figure out what it is sending, but it will result
as a simpler API.
Below is some thoughs about the structure and usage (the
original code was written before I found PEAR so it
must be restructured). Comments and ideas are welcome.
SmartMessaging/
or
GSM_SMS/
or
GSM/
SMS.php
SMS/
OTA.php
OTA/
Bitmap.php
Icon.php
OperatorLogo.php
RingingTone.php
...
Bearer.php
Bearer/
Kannel.php
SoneraCGW.php
...
Usage would be something like (dsn would be nice way to pass
parameters to constructor even though it isn't a "data" source):
$sms = new GSM_SMS("kannel://foo:bar@sms.example.com:1313/cgi-bin/sendsms");
$message = new GSM_SMS_OTA_OperatorLogo("/tmp/file.gif");
$message2 = "This is a test message."
$number = "+358501234567";
if PEAR::isError($sms->send($message,$number)) {
print "ERROR!";
}
if PEAR::isError($sms->send($message2,$number)) {
print "ERROR!";
}
--
Mika Tuupola http://www.appelsiini.net/~tuupola/