Difference between revisions of "Sms via bluetooth"
(5 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=Windows= | =Windows= | ||
− | It's pretty simple in Windows OS. When you turn your bluetooth on pc on, pair your pc with your phone so you can browse phone's services. Then use serial port service what will connect to your phone. You should also get a message which com port is used as serial port emulation. Then simply start hyperterminal, set | + | It's pretty simple in Windows OS. When you turn your bluetooth on pc on, pair your pc with your phone so you can browse phone's services. Then use serial port service what will connect to your phone. You should also get a message which com port is used as serial port emulation. Then simply start hyperterminal, set 9600bps, 8 bits, none parity, 1 stop bit and hardware flow control. Now enjoy using AT commands ( link at the bottom ) |
− | + | <br /> | |
+ | <br /> | ||
+ | To see actual AT Commands, scroll down for section "Sending AT Commands" | ||
Line 24: | Line 26: | ||
<enscript> | <enscript> | ||
rfcomm0 { | rfcomm0 { | ||
+ | # # Automatically bind the device at startup | ||
bind yes; | bind yes; | ||
− | |||
# # Bluetooth address of the device | # # Bluetooth address of the device | ||
device 00:22:FD:D6:29:77; | device 00:22:FD:D6:29:77; | ||
Line 40: | Line 42: | ||
Now is a good time to start/restart blutooth subsystems/daemons so new rfcommo configuration will take effect. First you need to find out bluetooth address of your phone, use "hcitool scan" to do that. | Now is a good time to start/restart blutooth subsystems/daemons so new rfcommo configuration will take effect. First you need to find out bluetooth address of your phone, use "hcitool scan" to do that. | ||
+ | You may want to start bluez-simple-agent (passkey-agent) which will help you to pair your devices | ||
To create serial link connection use: <br /> | To create serial link connection use: <br /> | ||
rfcomm -i hciX connect <btaddr> | rfcomm -i hciX connect <btaddr> | ||
Line 47: | Line 50: | ||
==Connecting to the phone== | ==Connecting to the phone== | ||
− | To connecto to the phone i used minicom. Just start the program and set | + | To connecto to the phone i used minicom. Just start the program and set 9600bps , 8 bits, no parity and 1 stop bit.and of course device /dev/rfcomm0. |
When connected you can begin using AT Commands. | When connected you can begin using AT Commands. | ||
+ | ==Sending At Commands== | ||
+ | |||
+ | There are basically two modes to work with SMS, i.e.: | ||
+ | |||
+ | * PDU (Protocol Data Unit) | ||
+ | * Text mode. | ||
+ | |||
+ | A mobile phone internally uses PDU format. Developers normally uses text mode because it is easier to use. AT+CMGF is the command to set the mode. | ||
+ | |||
+ | <br /> | ||
+ | |||
+ | AT+CMGF=0 | ||
+ | |||
+ | sets the format to PDU mode. | ||
+ | |||
+ | <br /> | ||
+ | |||
+ | AT+CMGF=1 | ||
+ | |||
+ | sets the format to text mode. | ||
+ | |||
+ | <br /> | ||
+ | |||
+ | AT+CMGF? | ||
+ | |||
+ | queries the current format. | ||
+ | |||
+ | |||
+ | Although you can send SMS in PDU or text mode, it is easier to use text mode to type the message. | ||
+ | |||
+ | The following commands change the message format to text mode and send a text message. | ||
+ | |||
+ | <br /> | ||
+ | AT+CMGF=1 <br /> | ||
+ | OK <br /> | ||
+ | AT+CMGS="7789952010" <br /> | ||
+ | > Hello World <Ctrl>+<Z> <br /> | ||
+ | +CMGS: 44 <br /> | ||
+ | |||
+ | OK | ||
+ | |||
+ | |||
+ | Note that <Ctrl>+<Z> has to be entered at the end of message to send the message. In minicom use <CTRL>+<Q>. | ||
+ | |||
+ | queries the current format. | ||
=Useful Links= | =Useful Links= | ||
Latest revision as of 21:13, 24 December 2009
Contents
Introduction
Well, what you need to do ? First you need to pair your phone with out pc using serial port emulation. Then you have to connect to the phone via hyperterminal or mimicom and by using AT Commands to send a message ;) IT's simple at that ;D
Windows
It's pretty simple in Windows OS. When you turn your bluetooth on pc on, pair your pc with your phone so you can browse phone's services. Then use serial port service what will connect to your phone. You should also get a message which com port is used as serial port emulation. Then simply start hyperterminal, set 9600bps, 8 bits, none parity, 1 stop bit and hardware flow control. Now enjoy using AT commands ( link at the bottom )
To see actual AT Commands, scroll down for section "Sending AT Commands"
Linux
Bluetooth pairing
What would be probably a good idea would be to find out, which channel do your phone uses for serial port emulation. To do that, you need to start bluetooth subsystem/daemons. I do i by running "/etc/rc.d/bluetooth" but what does it do is that it runs these daemons: pand dund rfcomm hidd bluetoothd Of course, don't forget to switch it on :D
To find out the channel we need, use
sdptool browse <bdaddr>
Configuring serial port connection
This is really simple step, all you need to do is to edit /etc/bluetooth/rfcomm.conf: ( now you will use the channel you were looking for at the beginning )
<enscript> rfcomm0 {
- # Automatically bind the device at startup
bind yes;
- # Bluetooth address of the device
device 00:22:FD:D6:29:77;
- # RFCOMM channel for the connection
channel 3;
- # Description of the connection
comment "Serial port emulation";
} </enscript>
Making serial port connection
Now is a good time to start/restart blutooth subsystems/daemons so new rfcommo configuration will take effect. First you need to find out bluetooth address of your phone, use "hcitool scan" to do that.
You may want to start bluez-simple-agent (passkey-agent) which will help you to pair your devices
To create serial link connection use:
rfcomm -i hciX connect <btaddr>
This should create a device /dev/rfcomm0. Also when you run rfcomm -a you should get an information that devices are connected.
Connecting to the phone
To connecto to the phone i used minicom. Just start the program and set 9600bps , 8 bits, no parity and 1 stop bit.and of course device /dev/rfcomm0. When connected you can begin using AT Commands.
Sending At Commands
There are basically two modes to work with SMS, i.e.:
* PDU (Protocol Data Unit) * Text mode.
A mobile phone internally uses PDU format. Developers normally uses text mode because it is easier to use. AT+CMGF is the command to set the mode.
AT+CMGF=0
sets the format to PDU mode.
AT+CMGF=1
sets the format to text mode.
AT+CMGF?
queries the current format.
Although you can send SMS in PDU or text mode, it is easier to use text mode to type the message.
The following commands change the message format to text mode and send a text message.
AT+CMGF=1
OK
AT+CMGS="7789952010"
> Hello World <Ctrl>+<Z>
+CMGS: 44
OK
Note that <Ctrl>+<Z> has to be entered at the end of message to send the message. In minicom use <CTRL>+.
queries the current format.
Useful Links
http://www.spiration.co.uk/post/1307/Ubuntu%20Linux%20-%20Bluetooth%20and%20GPRS%20dialup%20connection
http://wiki.forum.nokia.com/index.php/AT_Commands
http://wiki.forum.nokia.com/index.php/Using_AT_commands_to_send_and_read_SMS