Encapsulate SMS cat, Dell class library generation, create a class library project in vs2008, and create a pulbic type GMS class in mobilesp.

Source: Internet
Author: User

Using system;

Using system. Collections. Generic;

Using system. text;

Using system. runtime. interopservices;


Namespace mobilesp

{

Public class GMS

{

// Codego.net initializes the GSM Modem and connects to the GSM Modem

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodeminitnew ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern bool gsmmodeminitnew (

String device,

String baudrate,

String initstring,

String charset,

Bool swhandshake,

String Sn );


// Obtain the new ID number of the SMS cat

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodemgetsninfonew ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern string gsmmodemgetsninfonew (string device, string baudrate );


// Obtain the current communication port

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodemgetdevice ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern string gsmmodemgetdevice ();


// Get the current communication baud rate

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodemgetbaudrate ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern string gsmmodemgetbaudrate ();


// Disconnect and release memory space

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodemrelease ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern void gsmmodemrelease ();


// Get error message

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodemgeterrormsg ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern string gsmmodemgeterrormsg ();


// Send Short Message

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodemsmssend ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern bool gsmmodemsmssend (

String servicecenteraddress,

Int encodeval,

String text,

Int textlen,

String phonenumber,

Bool requeststatusreport );


// The returned string for receiving short messages is in the following format: Mobile Phone Number | SMS content | mobile phone number | SMS content | codego.net/tags/11/1/

// Rd_opt is 1 and will not be processed after receiving the short message. 0 indicates that the received message will be deleted.

[Dllimport ("dllforvc. dll ",

Entrypoint = "gsmmodemsmsreadall ",

Charset = charset. ANSI,

Callingconvention = callingconvention. stdcall)]

Public static extern string gsmmodemsmsreadall (INT rd_opt );

}

}


This article from the baboons literature baboons blog, please be sure to keep this http://9521583.blog.51cto.com/9511583/1570638

Encapsulate SMS cat, Dell class library generation, create a class library project in vs2008, and create a pulbic type GMS class in mobilesp.

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.