Using C # to send SMS via Nokia mobile phone (using Nokia SDK3.0)

Source: Internet
Author: User
Tags documentation tostring trim ustring
I found a network with the oxygen control to send SMS C # source code, try to debug a bit, found really good, and easy to use. But the drawback is that in the text message will automatically add control company information, registration will cancel this information, but the registration needs a small amount of money.
I downloaded the free PC connectivity SDK3.0 directly on Nokia's website and found that it could achieve the same function after debugging. The following program is successful in sending a text message under Nokia8310 with infrared connection computer.
After installing SDK3.0, add COM components to the reference in the Nokia Setting Adapter for PC Suite 3.7 and nokiacl messaging.
To add a reference:
Using Sttngs3a_slib;
Using Nokiaclmessaging;
Using System.Text;

public void Send_sms (string sms_number, String sms_content)?//parameter is data number and send content
{
Try
{
Sttngs3a_slib.phoneinfo_suite3 phonestatus = new Sttngs3a_slib.phoneinfo_suite3 ();
Sttngs3a_slib.devnotifyopt Devstatus;
Phonestatus.get_devicestatus (out devstatus);? Determine if the phone is connected to a PC
if (devstatus.tostring () = = "attached")
{
Nokiaclmessaging.shortmsgadapter smsobj = new Nokiaclmessaging.shortmsgadapterclass ();
Nokiaclmessaging.shortmessageitem smsentry = new Nokiaclmessaging.shortmessageitemclass ();
Smsentry.type = NokiaCLMessaging.ShortMessageType.SHORTMESSAGE_TYPE_GSM_SUBMIT;
Igsmsubmit submitobj = (igsmsubmit) smsentry.typeproperties;

Conversion encoding
UnicodeEncoding ustring = new UnicodeEncoding ();
byte[] input = Ustring.getbytes (sms_content. Trim ());

Sms_content = System.Text.Encoding.Unicode.GetString (input);

Submitobj.message = sms_content;
Submitobj.destinationaddress = Sms_number. Trim ();
Submitobj.servicecenteraddress = Sms_center. Text.trim ();? SMS Center Number
Submitobj.datacodingscheme = 8;? Using Unicode encoding
submitobj.validityperiodrelative = 255;
Submitobj.protocolid = 0;

Smsobj.sendsms (shortmessageroutetype.shortmessage_route_type_any,submitobj);? Send SMS
MessageBox.Show ("SMS Send success!") ");
}
Else
{
MessageBox.Show ("Not Found connected phone!") ");
}
}
catch (Exception x)
{
MessageBox.Show ("Error:" + x.tostring (), "system hint:");
}
}

SDK3.0 support for most of the current popular mobile phones, if it is more old-fashioned mobile phones, please download SDK2.1 on the Nokia website, supporting some of the mobile phone in the SDK3.0 of another component of Nokia SMS Adapter (PC Suite 3.7), Specific models of mobile phones see the SDK's documentation. If the database is used, then the company's computers can send text messages through a mobile phone, is also a good choice of communication. Of course, SDK3.0 can also implement many other functions, carefully study the SDK documentation, you can receive SMS, mobile phone settings and other functions.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.