Jindi,as an excellent supplier of SMS modems, the outstanding advantage is that it provides perfect solutions of secondary development. C# API is the R&D essence of Jindi SMS in recent years, which has been tested by thousands of clients, and becomes the very mature and stable API of modems.
This API can realize these functions, such as sending SMS, receiving SMS automatically, testing the connection status, reading messages from SIM cards, deleting messages from SIM cards and so on.
It can support more than one GSM modem at the same time, whether different models or the same one, and it can also provide automatic load balancing among these modems when sending SMS.
Step 1:Prepare the development environment
JDSMS.NET API is mainly used for giving a demonstration about how to achieve SMS function of GSM modems via C# on .NET.
SharpDevelop is a convenient and easy development tool of .net with open source, and the C# API is compiled based on it. Please install the simplified Chinese language pack of Microsoft .NET Framework 2.0 before starting.
1、Install langpack.exe
2、Install SharpDevelop2.2
3、If you have installed compilers like Microsoft Visual Studio?2005 or 2008, it’s not needed to install this SharpDevelop.
Step 2: Prepare the GSM modem
1、JDSMS.NET applies to Wavecom GSM series .
2、Before installing the GSM modem, check if it is a serial modem or an USB modem first. If serial, you can use it directly without any driver as long as accessories are connected well. If USB, firstly, please install the USB driver from the software CD, and then you can view the port from My computer - Property - Hardware - Device manager - Port as shown in the figure.
If serial, it’s OK to use COM1 directly.
3、In the following demo of this API, we take the port COM1 and the baud rate 115200 for example.
Noted that modify the parameters if there are differences in your actual use.
The default port of this demo is COM1 and the default baud rate is 115200.
If your modem is USB interface, choose the COM port as long as it is available. // Specify the sending port.
srv.AddGateway(new ModemGateway("modem.com1", "COM1", 115200, "Nokia", "6310i", srv.Logger));
You need just change the port number. As above, the virtual port of my USB modem is COM3, so I need just replace COM1 with COM3.
The baud rate of our modems is 9600 or 115200. If there is an error when running, please set the baud rate to 9600 or 115200. The serial modem is as the above case.
Noted that there are two kinds of baud rates of the modem: one is 9600, and the other is 115200.
Then replace the target phone number with the number you want to send to. For example, if you want to send to +8613811110000, just replace it.
// Send a message. If you want to send more than one message, you can set a circle here.
OutboundMessage msg = new OutboundMessage("+8613601019694", "Welcome to use Jindi SMS C# API. www.sendsms.cn");?
Step 3: View the document introduction of this API
After unzipped it, there will be two files under the JDSMS.NET directory:
1、 Modem:mainly realize the receiving and sending of SMS.
a) ReadMessages: read and display messages received by the GSM modem.
b) SendMessage: send SMS
2、 Test:realize simulation receiving and sending SMS test. If you haven’t purchase GSM modems yet, you can test the platform compatibility via test.exe.
Step 4: Compile SMS receiving and sending program
1、Simulation receiving and sending test: open the project file via development tool like SharpDevelop or vs2005.
Run
2、 Send SMS:open the project file SendMessage.csproj via development tool like SharpDevelop or vs2005. Check the COM port and baud rate, then compile and run the program:
3、 Receive SMS:open the project file ReadMessages.csproj via development tool like SharpDevelop or vs2005. Check the COM port and baud rate, then compile and run the program:
winxp/ win2000/ 32-bit win2003/ 64-bit win2003/ 32-bit win2008/ 64-bit win2008/ win7