Click here to Skip to main content
15,120,660 members
Articles / Programming Languages / C#
Article
Posted 4 Jul 2007

Stats

376.5K views
4.8K downloads
50 bookmarked

Send Picture Message from PC to Mobile

Rate me:
Please Sign up or sign in to vote.
3.39/5 (21 votes)
4 Jul 2007CPOL5 min read
This article will help you to send a picture + text as SMS from PC to mobile.........using C#

Introduction

Some days ago, I was wondering whether I could send a picture from my PC to mobile? After a lot of thinking, I came to know that I could do so. This article is a sample example for you in order to send a picture to your mobile. Text and picture messages have the same method for sending, but the only difference is the length of the message. You can fit your text into one message like if you just send "hello", but it's difficult to fit a picture in one message because you have a complete format for the picture. I am using OTA format for sending pictures to my mobile phone Sony Ericsson k500i.

Background

To understand this article, you must have knowledge of how to send text SMS.

OTA

Over the Air (OTA) is an image format for mobile phones which has standard size of 72x28, etc. It has only two colors, black and white. Read this article for how to convert an image into OTA format.

Details

First of all, convert your image into OTA format and copy all its data in any file like *.txt, *.doc, etc. Here is an example for the OTA data of image.

66 66 66 66 66 66 66 66 66 99 99 99 99 99 99 99 99 99 80 00 00 00 00 00 00 00 01
40 00 00 00 60 00 E0 00 02 40 00 00 0E 90 03 10 00 02 80 00 00 31 08 0C F3 B8 01
80 00 00 40 04 11 04 44 01 40 00 00 FF FE 2F 8B 12 02 40 00 00 00 00 53 8C AA 02
80 00 00 00 00 62 89 C4 01 80 00 00 00 00 41 41 40 01 40 00 00 00 00 01 42 80 02
40 00 20 00 00 01 42 80 02 80 01 F0 00 00 00 A2 80 01 80 0F FE 00 00 00 A5 00 01
5F FF FF FF FF FE A5 7F FA 40 0A AA 00 00 00 55 00 02 82 01 50 04 40 01 5D 08 A1
88 10 24 80 00 40 FF 02 01 40 41 00 01 00 03 AB E0 02 44 00 00 08 20 0D 55 58 82
80 10 14 40 00 1A AA AC 01 80 00 00 00 00 35 55 56 01 40 01 00 00 80 6A AA AB 02
40 00 00 00 00 55 55 55 02 80 00 00 00 00 00 00 00 01 99 99 99 99 99 99 99 99 99
66 66 66 66 66 66 66 66 66 

As we know, when we send text SMS, we encode our text into PDU. So the same method will be used for the picture SMS.

PDU for Picture SMS (Encoding Picture)

The following example shows how to encode a picture SMS. The example includes a picture and a text "Test". The length of the Picture message is so long that the message must be sent as a concatenated message (in three SMS). Here is the encoded data:

First part: (length =140)

8C0B0504158A00000003010301300000045465737402010000481C0166666666
6666666666999999999999999999800000000000000001400000006000E00002
400000E900310000280000031080CF3B801800000400411044401400000FFFE2
F8B12024000000000538CAA0280000000006289C401800000000041414001400
00000001428002400020000 

Second part: (length =140)

8C0B0504158A00000003010302014280028001F0000000A28001800FFE000000
A500015FFFFFFFFFFEA57FFA400AAA0000005500028201500440015D08A18810
2800040FF0201404100010003ABE00244000008200D55588280101440001AAAA
C0180000000003555560140010000806AAAAB024000000000555555028000000
000000000199999999999999 

Third part: (length =23)

170B0504158A000000030103039999666666666666666666 

Explanation for the First Part

  • 8C length of part 1 (280/2=140(dec) and 8C(hex) because our data is in hex)
  • 0B length of user data header
  • 05 Identifier (IEI; application port addressing scheme, 16-bit port address)
  • 04 Information Element Data Length (IEDL)
  • 158A Information Element Data (destination port)
  • 0000 Information Element Data (originator port)
  • 00 Information Element Identifier (IEI; concatenated short message, 8-bit reference number)
  • 03 Information Element Data Length (IEDL)
  • 01 Information Element Data (concatenated short message reference number)
  • 03 Information Element Data (total number of concatenated messages (0-255))
  • 01 Information Element Data (sequence number of current short message)
  • 30 Identifier for version, current version is (ASCII) zero "0". If it is not "0", stop processing of the message.
  • 00 "00" <Item-length>
  • 00 Text length
  • 04 Text length
  • 54657374 "Test"
  • 02 "02" = <Item length><OTA bitmap>
  • 0100 <Item-length> value 0100(hex) = 256(dec) = 4 octets for header and the rest for OTA bitmap data
  • 00 The first byte of the bitmap must be 00 (hex); i.e., OTA bitmap header field 'number of animated icons' must hold 0, indicating that there is no animation, just a single static image.
  • 48 Width = 48(hex) = 72(dec)
  • 1C Height = 1C(hex) = 28(dec)
  • 01 The depth of the bitmap (number of grey scales)

All the rest is the image data.

Explanation for the Second Part

  • 8C length of part 2 (280/2=140(dec) and 8C(hex) because our data is in hex)
  • 0B length of user data header
  • 05 Identifier (IEI; application port addressing scheme, 16-bit port address)
  • 04 Information Element Data Length (IEDL)
  • 158A Information Element Data (destination port)
  • 0000 Information Element Data (originator port)
  • 00 Information Element Identifier (IEI; concatenated short message, 8-bit reference number)
  • 03 Information Element Data Length (IEDL)
  • 01 Information Element Data (concatenated short message reference number)
  • 03 Information Element Data (total number of concatenated messages (0-255))
  • 02 Information Element Data (sequence number of current short message)

All the rest is the image data.

Explanation for the Third Part

  • 17 length of part 3 ((48-2)/2=23(dec) and 17(hex) because our data is in hex)
  • 0B length of user data header
  • 05 Identifier (IEI; application port addressing scheme, 16-bit port address)
  • 04 Information Element Data Length (IEDL)
  • 158A Information Element Data (destination port).
  • 0000 Information Element Data (originator port)
  • 00 Information Element Identifier (IEI; concatenated short message, 8-bit reference number)
  • 03 Information Element Data Length (IEDL)
  • 01 Information Element Data (concatenated short message reference number)
  • 03 Information Element Data (total number of concatenated messages (0-255))
  • 03 Information Element Data (sequence number of current short message)

All the rest is the image data.

Now we have divided our image into a number of parts. So add the following data in the front of each part.

0051000C91xxxxxxxxxxxx00F5A7 

Explanation

  • 00 always added
  • 5100 not going to explain here
  • 0C length of phone number
  • 91 phone number format (91=international and 81=national)
  • xxxxxxxxxxxx 12 digit phone number (for example my phone number is 23216427434. write it as 292361244743)
  • 00F5 not going to explain here
  • A7 time limit (24 hours in this case)

Complete Example

SMS # 1:
0051000C913012467234F400F5A78C0B0504158A000000030103013000000
45465737402010000481C0166666666666666666699999999999999999980
0000000000000001400000006000E00002400000E90031000028000003108
0CF3B801800000400411044401400000FFFE2F8B12024000000000538CAA0
280000000006289C401800000000041414001400000000014280024000200000

SMS # 2:

0051000C913012467234F400F5A78C0B0504158A000000030103020142800
28001F0000000A28001800FFE000000A500015FFFFFFFFFFEA57FFA400AAA
0000005500028201500440015D08A188102800040FF0201404100010003AB
E00244000008200D55588280101440001AAAAC01800000000035555601400
10000806AAAAB024000000000555555028000000000000000199999999999999

SMS # 3:
0051000C913012467234F400F5A7170B0504158A0000000301030399996666
66666666666666

Send Picture SMS

The code for how to send a simple text SMS is attached with this article. Just paste your SMS PDU and send your cute picture massage. Remember that I am using a serial port for the communication.

Or

You can use Windows hyper terminal for sending your message.

Start->Programs->Accessories->Communications->HyperTerminal

  • And then use the following commands for sending SMS:
  • AT+CMGF=0 (pdu mode, use the command only first time if you have multiple SMS like in our case, three SMS.)
  • AT+CMGW=(length of pdu, for example 153 in SMS # 1)
    > write your pdu, in the end press ctrl+z and then press Enter. If it will display Ok, then succeeded. It will also display the message number.
  • AT+CMSS=(message number)

And now your message has been sent.

Future Work

I am trying to send MMS as well, using C#.

References

  • Nokia Smart_Messaging_FAQ_v2_0

History

  • 5th July, 2007: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shakeel Mumtaz
Web Developer
Pakistan Pakistan
I did BS in Computer Science from Punjab University,Pakistan.

I have developed lot of Softwares and mostly interested in mathematics,image processing,AI,signal processing,mobile technology,database etc.

Currently working at Confiz Solutions as Sr.Software Engineer.

Comments and Discussions

 
GeneralSENT SMS FROM PC TO MOBILE VIA INTERNET Pin
koushik mohajon30-Oct-09 22:43
Memberkoushik mohajon30-Oct-09 22:43 
Generalsend and receive sms from pc through mobile Pin
ramitmass28-Sep-09 20:19
Memberramitmass28-Sep-09 20:19 
Generaltime pass Pin
dragon roy5-Sep-09 21:59
Memberdragon roy5-Sep-09 21:59 
GeneralHi Pin
gandhis198626-Aug-09 1:16
Membergandhis198626-Aug-09 1:16 
Generalhello Pin
Muhammad Aqib13-Jul-09 3:20
MemberMuhammad Aqib13-Jul-09 3:20 
GeneralFOR NIGHT SHIFT JOB REQUIRED (SO I WANT PLEASE) Pin
gheyasuddin12-May-09 3:46
Membergheyasuddin12-May-09 3:46 
Generalpicture Pin
jinuku6-Apr-09 22:14
Memberjinuku6-Apr-09 22:14 
GeneralSending picture message from mobile Pin
windvp26-Mar-09 23:45
Memberwindvp26-Mar-09 23:45 
Hi Shakeel,
I want to send a picture message from a mobile to another mobile.
Can you plz let me know how it can be achieved.
GeneralRe: Sending picture message from mobile Pin
jawaddon3-Apr-09 1:16
Memberjawaddon3-Apr-09 1:16 
Generalhh Pin
jethva_kirti26-Mar-09 22:54
Memberjethva_kirti26-Mar-09 22:54 
Generalaafsa Pin
Rock_Unlockerr25-Mar-09 11:23
MemberRock_Unlockerr25-Mar-09 11:23 
Jokehello Pin
ganesh A12-Mar-09 23:20
Memberganesh A12-Mar-09 23:20 
GeneralRe: hello Pin
shaileshsharma0128-Nov-09 23:10
Membershaileshsharma0128-Nov-09 23:10 
GeneralThank you Pin
amgadhs10-Mar-09 7:38
Memberamgadhs10-Mar-09 7:38 
Generaldftyjutjyu Pin
deadm903-Feb-09 23:33
Memberdeadm903-Feb-09 23:33 
Generalhello Pin
punjabi42019-Nov-08 3:20
Memberpunjabi42019-Nov-08 3:20 
Questionpc to phone? Pin
innocent mwila12-Nov-08 9:06
Memberinnocent mwila12-Nov-08 9:06 
AnswerRe: pc to phone? Pin
Shakeel Mumtaz12-Nov-08 18:27
MemberShakeel Mumtaz12-Nov-08 18:27 
GeneralRe: pc to phone? Pin
innocent mwila12-Nov-08 21:00
Memberinnocent mwila12-Nov-08 21:00 
AnswerRe: pc to phone? Pin
nehajaiswal14-Nov-08 3:59
Membernehajaiswal14-Nov-08 3:59 
Question[Message Deleted] Pin
SHRIDHAR TL6-Nov-08 2:06
MemberSHRIDHAR TL6-Nov-08 2:06 
AnswerRe: Nice Work - Need a Help Pin
Shakeel Mumtaz9-Nov-08 18:49
MemberShakeel Mumtaz9-Nov-08 18:49 
Generalregarding picture message Pin
ksperera13-Oct-08 0:14
Memberksperera13-Oct-08 0:14 
JokeRe: regarding picture message Pin
SHIVEN RAJPUT16-Oct-08 0:18
MemberSHIVEN RAJPUT16-Oct-08 0:18 
GeneralRe: regarding picture message Pin
Shakeel Mumtaz16-Oct-08 18:40
MemberShakeel Mumtaz16-Oct-08 18:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.