Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Send sms form vfp
Message
De
26/05/2006 05:33:39
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01123887
Message ID:
01125184
Vues:
21
>now i am getting message"error sending... After replacement which u write.
>thanks


Khubaid:

I did'nt understand in what moment you got the error: if it was in the moment you connect to the phone, or if it was in the moment the phone received the message.
But read the following message, and if you can follow these steps you can send SMS without problems.

You can read also this technical article: http://www.dreamfabric.com/sms/


But first you can do the following test:

You must be sure of 3 things:

- 1) you have communications with your phone.
To do this you can try to connect to it with Windows "Hyperterminal".
Try to establish a connection to your phone and send some commands to it. Example: "AT"
If you receive an "OK" at the prompt, then all is going well with the communications.
Don't forget to configure your "Hyperterminal" to show "Eco", otherwise you'll don't see nothing and you'll blame the phone (it happened to me).

- 2) you must be sure if your phone reconnects SMS commands (some models are capable of sendind SMS, but don't recognize standard SMS commands)
Once again in Hyperterminal, send the following command to your phone: "AT+CSMS=0"
If you get the prompt "ERROR", you must change phone in order to send SMS programaticaly.

- 3) Now, that you are sure that there is no problems with comms, and no problems with your phone, you must be sure if your PDU message is correct.
Before getting to VFP, you can use once again Hyperterminal (because it is so straightforward, you can send the message and you''l see the answer) to asure of this.
To do that you must send 2 other commands, the first sends the size of the PDU to the phone in order to prepare it for the string it will receive.
So you should know the PDU string before sending that, the second command sends the real PDU (text message).
Example: you want to send the SMS message: "SMS test in VFP" to the Pakistanean number "03336311974".

That text will be converted to "D3E614442FCFE9A0B41B643542412010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010" with the function criar_string_hexadecimal() that i send you in the project.
As you see the len of this string (because it's a string) is 284 characters, but because each pair is a hexadecimal septet we need to count septets instead.
So there are 142 octets (284/2).
In hexa 142 is represented by "8E".
Now we must create the PDU message. The PDU has 7 parts:
1) "001100" fixed string, if you want to know more, read http://www.dreamfabric.com/sms
2) "OB" it means that the telephone number we are sending sms has 11 charac (OB in hexa), in my previous message i've counted 12, but the 12th digit it's to be ignored it was added by us.
3) "81" it means that the telephone number is in national format ("91" for international format)
4) "3033361179F4" it is a special format string for the phone number. The original number was "03336311974" (note that this is the destiny number, not your number)
5) "0000AA" fixed string, if you want to know more, read http://www.dreamfabric.com/sms
6) "8E" the 142 septets ("8E" in hexa)
7) The message itself (the "D3E614442FCFE9A0B41B643...." thing)

Then you must add Ctrl+Z to the message (chr(26) if you're doing this in VFP).
Then Enter (chr(10) + chr(13))

The size of the PDU is now: 156 = ((317 - 3) / 2) - 1; where :
317 is len(pdu);
-3 because we must ignore de chr(26) + chr(10) + chr(13);
/ 2 because we must find hexa pairs
- 1 because we must ignore the first pair "00"

Then, for this example you should send the following commands in Hyperterminal:
"AT+CMGS=156"
wait for the prompt, and then:
"001100OB813033361179F40000AA8ED3E614442FCFE9A0B41B643542412010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010080402814020100804028140201008040281402010" + ctrl+Z

Shortly the phone number 03336311974 should receive "You have mail..."

Joaquim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform