0% found this document useful (0 votes)
33 views

Gsmcomm Comm Sendmessage: Smssubmitpdu Pdu Smssubmitpdu (TXT - Message - Text, TXT - Destination - Numbers - Text,)

To send an SMS message, you need to provide the destination phone number and text. There are two ways to create a PDU (protocol data unit) object for sending - a straightforward version that does not support Unicode, and an extended version that allows sending messages in Unicode or setting alert properties and data coding. The extended version uses a data coding scheme byte to determine how the message is sent.

Uploaded by

Omnes Gentes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Gsmcomm Comm Sendmessage: Smssubmitpdu Pdu Smssubmitpdu (TXT - Message - Text, TXT - Destination - Numbers - Text,)

To send an SMS message, you need to provide the destination phone number and text. There are two ways to create a PDU (protocol data unit) object for sending - a straightforward version that does not support Unicode, and an extended version that allows sending messages in Unicode or setting alert properties and data coding. The extended version uses a data coding scheme byte to determine how the message is sent.

Uploaded by

Omnes Gentes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

You can send an SMS by keying in the destination phone number and text message.

If you want to send a message in your native language (Unicode), you need to check in
Send as Unicode(UCS2). GSMComm object comm has a SendMessage method which will
be used for sending SMS to any phone. Create a PDU for sending messages. We can
create a PDU in straight forward version as:

Hide Copy Code


SmsSubmitPdu pdu = new SmsSubmitPdu 
        (txt_message.Text,txt_destination_numbers.Text,""); 

An extended version of PDU is used when you are sending a message in Unicode.

Hide Shrink Copy Code


 try 

    // Send an SMS message 
    SmsSubmitPdu pdu; 
    bool alert = chkAlert.Checked; 
    bool unicode = chkUnicode.Checked; 
 
    if (!alert && !unicode) 
    { 
        // The straightforward version 
        pdu = new SmsSubmitPdu 
        (txt_message.Text, txt_destination_numbers.Text,""); 
    } 
    else 
    { 
        // The extended version with dcs 
        byte dcs; 
        if (!alert && unicode) 
            dcs = DataCodingScheme.NoClass_16Bit; 
        else 
        if (alert && !unicode) 
            dcs = DataCodingScheme.Class0_7Bit; 
        else 
        if (alert && unicode) 
            dcs = DataCodingScheme.Class0_16Bit; 
        else 
            dcs = DataCodingScheme.NoClass_7Bit; 
 
        pdu = new SmsSubmitPdu 
        (txt_message.Text, txt_destination_numbers.Text, "", dcs); 
    } 
 
    // Send the same message multiple times if this is set 
        int times = chkMultipleTimes.Checked ? 
                int.Parse(txtSendTimes.Text) : 1; 
 
    // Send the message the specified number of times 
    for (int i=0;i<times;i++) 
    { 
        CommSetting.comm.SendMessage(pdu); 
        Output("Message {0} of {1} sent.", i+1, times); 
        Output(""); 
    } 

catch(Exception ex) 

    MessageBox.Show(ex.Message); 

 
Cursor.Current = Cursors.Default; 

You might also like