locked
Sending SMS through mobile RRS feed

  • General discussion

  •  Dear friends,

    I am trying to send SMS using following code;

    nHandle = fopen("COM3:300,N,8,1",12)
    IF nhandle<0
    MESSAGEBOX("Can not open port.")
    RETURN
    ENDIF
    nRet = fputs(nHandle,"AT"+CHR(13))
    nRet = fputs(nHandle,"AT+CMGF=1"+CHR(13))
    *!* nRet = fputs(nHandle,'AT+CMGS="919637710827"'+CHR(13)+"Hi, I can Send SMS."+CHR(26)+CHR(13))
    *!* fflush(nhandle,.t.)
    *!* =fclose(nHandle)

    This code supposed to send messageas follows;

    Hi, I can Send SMS.

    But actually all the lnes are sent to the recepient as follows;

    AT

    AT+CMGF=1

    AT+CMGS="919637710827" Hi, I can Send SMS.

    FURTHER, I tried inserting fflush() after each fputs ()

    biut the result was the same.

    One more thing is that the above code works sometimes and somtimes not.

    Thanks for reading,

    Ravi

    Sunday, November 10, 2013 4:00 PM
    Answerer

All replies

  • Does it work same way if you enter the code line by line in Command Window?

    Does it work same way if you use HyperTerminal in your Windows?

    If both answers are Yes then you are asking at the wrong forum.

    Sunday, November 10, 2013 4:56 PM
  • Dear Pavel sir,
    The result from hyper terminal are ok (as per requirement).
    But From command Window it gives result the same way the prg does.

    My further question is that ;

    Can I execute a script through hyper terminal?

    Is there any other third party program like hyper terminal, that is capable of running user defined scripts?

    I knew such a program that was shipped with my old 56kbps dial up fax modem. But the CD is damaged. I googled for it. But did not find it. The software was 'SUPER TERMINAL'.  Bundled with SUPER VOICE' A FAX SOFTWARE.
    -RAVINDRA 

    Monday, November 11, 2013 4:30 AM
    Answerer
  • Somehow I managed it. 

    It is working as per requirement.

    I think modem was not initialising properly. When I provided initialsation string, it worked properly.

    I Changed the first fputs as follows   ;

    nRet = fputs(nHandle,"AT b2 = 5 & q6n0s37"+CHR(13))

    "AT b2 = 5 & q6n0s37" is the iinit string for heys tye of modems.

    I thank you  for providing assistance.

    Thursday, November 14, 2013 8:10 AM
    Answerer
  • Great! This is good to know.
    Thursday, November 14, 2013 5:46 PM