Page 1 of 1

SMS

Posted: Tue Mar 29, 2005 6:43 am
by akee
Anyone have a code sample that uses only PB and Win32 to send SMS?

I know there a lot of DLLs and ActiveX components out there. They cost $$$.

Posted: Tue Mar 29, 2005 3:06 pm
by Hroudtwolf
You need a phoneprovider to send SMS.

Clearer PIC

Posted: Tue Mar 29, 2005 6:48 pm
by akee
Hroudtwolf, I already have that. What I mean is let's say I have a PC connected to a hand phone and I have valid subscription. I want to be able to send a SMS.

Ex. If you have a Nokia phone, you have the utility Nokia PC Suite which can send SMS. I would like to use PB to write just the SMS part without any SDK or ActiveX objects. I saw some samples with oxygen software but it is a component.

Posted: Tue Mar 29, 2005 6:56 pm
by thefool
well i dont think many users will have any use of this. I dont even have a pc-connector cable to my cellfones. And not all phones are nokia ;)

Posted: Tue Mar 29, 2005 7:03 pm
by Rings
small hint:

use Sysinternals Portmon and listen to
the serial port that is connected to your
hand phone
(formerly known in germany as Handy).

Then let the nokia suite send a sms and
you capture all output from the serial port.

Posted: Tue Mar 29, 2005 7:59 pm
by blueznl
there is no standard brand independent protocol for sending sms messages via directly connected devices

(hey, i've been professionally involved in this business for a while :-))

however, there are some other (low cost) solutions...

the cheapest way is probably an 'option firstfone' or similar pcmcia card, they use an expanded hayes command set that will allow you to send and receive messages (remember the at dt era?)

as an alternative, there are a few external boxes (also using hayes or similar) that take a simcard and become a (sort of) modem

there are several (low cost) sms service providers that offer you an http or tcp/ip interface to send and receive messages, pricing isn't that bad, though it depends on your volume

Posted: Tue Mar 29, 2005 8:42 pm
by thefool
there might be some free Email ones. Then program a small email sender in purebasic and then send.

Posted: Wed Mar 30, 2005 1:06 am
by DoubleDutch
there is no standard brand independent protocol for sending sms messages via directly connected devices

(hey, i've been professionally involved in this business for a while )

blueznl: Are you sure there is no standard? :shock:

I've tried quite a few mobiles with my "MessageGameServer" (written in PureBasic) from the Nokia 402 (early phone) to the latest Philips, etc without any problems!

I found that there is a semi-standard using modem type AT commands that work on most phones with the appropriate modem driver. This is usually bundled with the phone, available for download somewhere or at cost with something like Nokia Data Suite.

Some phones don't need a modem driver - like the Nokia Communicator or some others with infrared ports. Others do, almost all USB connected and really old phones (such as the 402) phones will need a driver - this "driver" will convert the high level AT commands to low level commands for the actual phone. The modem drivers usually set up a virtual COM port that you can send the AT commands to...

I can't give out the complete code (its a working commercial program), but...

I use this to init most phones:

Code: Select all

Procedure InitSMS(Handle)
  NiceOutput(#GamePlay,"Initialising SMS modem")
  SendSerial(Handle,"ATZ","Init phone modem")
  SendSerial(Handle,"AT+IFC=0,0","No flow control")
  SendSerial(Handle,"ATE1","Turn on echo")
  SendSerial(Handle,"AT+CREG","Get network status")
  SendSerial(Handle,"AT+CSQ","Check signal strength")  ; needs to return 12 or better for reliable connection
  SendSerial(Handle,"AT+CRC=1","Extended ring information")
  SendSerial(Handle,"AT+CNMI=1,2","Pass along incoming messages")
  SendSerial(Handle,"AT+CMGF=1","Set text mode")   
EndProcedure
You will have to make your own SendSerial procedure - but you get the idea...

Here are some replies:

Code: Select all

           Case "CSQ"
              NiceOutput(#GamePlay,"SMS modem signal strength:"+SerialParam$+Chr(13)+Chr(10))
            Case "CMGS"
              NiceOutput(#GamePlay,"SMS message sent, reference #:"+SerialParam$+Chr(13)+Chr(10))
            Case "CMT"
              WaitMessage=#TRUE
            Case "CRING"
              NiceOutput(#GamePlay,"SMS modem reports incoming call! Type:"+SerialParam$+Chr(13)+Chr(10))
This is for command replies:

Code: Select all

        If SerialCommand$="OK"
            NiceOutput(#GamePlay,"SMS modem reports the command executed 'okay'"+Chr(13)+Chr(10))
          EndIf
          If serialCommand$="ERROR"
            NiceOutput(#GamePlay,"SMS modem reports 'Error' - command not supported by modem"+Chr(13)+Chr(10))
          EndIf
and finally this will send the actual SMS:

Code: Select all

  SendSerial(Handle,"AT+CMGS="+Chr(34)+TelephoneNo$+Chr(34),"Set telephone number")
  SendSerial(Handle,SmsMessage$+Chr(26),"Send message with CTRL-Z")    
Hopefully there are enough clues here to get you started.... :D

-Anthony

Posted: Wed Mar 30, 2005 8:25 am
by blueznl
doubledutch: yes i am :-) but that has never stopped manufacturers to copy from each other :-)

Posted: Wed Mar 30, 2005 10:19 am
by DoubleDutch
Blueznl: Your right, its a pity they never all got together and agreed. It looks like there is no properly agreed standard - it just seems to have been formed over time, some phones understand some commands, others all... Most however, can get to the stage where they can send an actual SMS :)

Akee: You may need to delete the recieved SMS from the phone using the message id number received... There are clues on the net on how to do this... ;)

There is also another method of using the AT commands to send text messages with pictures - not mms - but a "nokia" standard that seems to have been adopted by some others. This is more complex, but is worth looking into if you have some time to spare.

-Anthony

Posted: Thu Mar 31, 2005 10:41 am
by stbi
There are some mobile phones that can be treated like a modem. You can talk to them via AT-commands. The command set is usually expanded to handle phone commands like send message. I use a Siemens T35i to send and receive SMS. The T35i is afaik a standard S35i mobile phone without display and keypad. There is a command reference available as PDF on the net.

Posted: Thu Mar 31, 2005 1:58 pm
by DoubleDutch
There are some mobile phones that can be treated like a modem. You can talk to them via AT-commands. The command set is usually expanded to handle phone commands like send message.
stbi: checkout the code above, it uses these extra AT commands... ;)

-Anthony

Posted: Thu Mar 31, 2005 2:12 pm
by stbi
DoubleDutch wrote:stbi: checkout the code above, it uses these extra AT commands... ;)
:oops: sorry, has been overlooked by me ... you already mentioned it ... I need some coffee, badly :oops:

Posted: Thu Jun 30, 2005 7:59 am
by akee
DoubleDutch wrote:Akee: You may need to delete the recieved SMS from the phone using the message id number received... There are clues on the net on how to do this... ;)
Thanks DoubleDutch. Will look at it... ;)