|
SMSLib_dotNET
SMSLib - .NET Framework port
SMSLib for .NETIntroductionSMSLib for .NET is a port of the Java SMSLib library for the Microsoft .NET Framework platform. Its an attempt to create a binary distribution for the same java sources that the normal SMSLib is build from. The binary conversion is possible with the help of IKVM tools. Please note that SMSLib for .NET is experimental! Please read carefully the following document in order to understand the port and know what to expect. A bit of a history...Looking a couple of years back, there was a seperate SMSLib for .NET codebase. So, I had to maintain and enhance two seperate versions, a C# version and a Java version. Supporting and synchronizing two platforms was found to be a tremendous load for me. Sadly, I've decided to drop one of the two. I like Java very much - I also like C# a lot, but I decided to go with Java since it was the most established version. Needless to say that I've received numerous complaints since then... Some time ago I got to know a bit more about some conversion tools, mainly IKVM. My problem was that SMSLib is not an 100% pure Java library - there are binary dependencies, namely the JavaComm / RxTx serial communications' libraries. My first attempts to port SMSLib to the .NET platform failed misserably, as I couldn't make the comm library work. At the end, I decided to take a different approach. The result of this work is that now I can create .NET projects, use SMSLib as a DLL and having the full SMSLib functionality available on the .NET Framework platform, by keeping the same sources for Java as well as for .NET. ConversionI decided to go with IKVM. IKVM is licensed with a business friendly license, like SMSLib is. It also appeared to me as a more mature product. I won't bother you with the exact conversion details - if you are reading this you are probably a .NET developer, so I assume that you don't give a damn about how this is done. What you should really remember is that SMSLib is packaged as a .NET Framework DLL, ready to be downloaded and used in your project. InstallationEnough with the theory! Below you will find the installation instructions for SMSLib for .NET. Its a pretty simple process.
Get the packagesIn order to use SMSLib, you should download: SetupUnpack the SMSLib for .NET package in a directory of its own. The package contains the ready-to-use .NET SMSLib library (smslib-3.4.2.dll) plus two sample projects to get you started. Unpack the IKVM package at a temporary location. Grap all the files named bin/IKVM.*.dll and copy them in the Libraries subdirectory of the SMSLib for .NET directory. That's it! Sample CodeThere are two sample projects for your initial tests. The ReadMessages project which reads messages from a serial modem or phone and the SendMessage project which sends a message via a serial modem or phone. ReadMessages sample
What is Comm2IP?Since the java comm libraries (JavaComm and/or RxTx) could not be converted and used by the .NET application, I decided to solve the problem differently. The Comm2IP is a .NET native application which acts as an interface between a COM port and a socket. Traffic received from the one is pushed to the other and vice versa. Why I did this? Because, by doing this, I would be able to connect to a serial modem in the same way as I connect to an IP modem: I don't use a COM port, I use a network connection. Bye bye javacomm libraries! The Comm2IP is build as a .DLL in order to be easy for you to include it in your SMSLib projects. The Comm2IP is a vital component and I am sure it will be the subject of most support questions. If you don't set it up correctly, you will not be able to communicate with your modem. Examine the relevant code in the ReadMessages.cs source file: Comm2IP.Comm2IP com1 = new Comm2IP.Comm2IP(new byte[] { 127, 0, 0, 1 }, 12000, "com1", 19200);
new Thread(new ThreadStart(com1.Run)).Start();This code:
From now on, all traffic from com1 will be forwarded to the listener which binds on 127.0.0.1:12000 and vice versa. Later on in the code, you create your IP modem gateway: IPModemGateway gateway = new IPModemGateway("modem.com1", "127.0.0.1", 12000, "Nokia", "");which binds to the same host:port that the Comm2IP component is initialized. Remember: One Comm2IP thread is for one modem. For multiple modems you should create a matching number of Comm2IP threads! How to build the .DLL fileIf you would like to build the .dll file from the latest SMSLib distribution, follow these simple steps:
ikvmc -target:library smslib-3.4.2.jar slf4j-api-1.5.6.jar slf4j-log4j12-1.5.6.jar log4j-1.2.15.jar commons-net-2.0.jar You will get some warnings about non-existent referenced classes, but for most cases the .dll build after this command is OK for use. Outstanding issuesHere are some issues that are still outstanding:
Now what?Once more, SMSLib for .NET should be considered experimental until further feedback is given. As a result, the .NET specific documentation is a bit short, but I am working on it. Remember that the SMSLib is actually the same for Java and for .NET. The entire SMSLib functionality is available to you. The Support page will guide you in case you need support. |
Sign in to add a comment
Thanx...i am gonna add this to ma project....nice work
Hello, Can't find the file IKVM.OpenJDK.ClassLibrary?.dll. I have downloaded ikvm-0.40.0.1.zip 15.3MB, ikvmbin-0.40.0.1.zip 11.8MB, and openjdk6-b12-stripped.zip 30.7MB from sourceforge.net but that file is situated nowhere. I have even searched for it online without any success.
Please either update the documentation or give us a reference to it. Thanks a lot in expectation.
@iceslice3000: You are right - IKVM probably switched versions and applied different packaging. Will review later today.
thanks much...things working...great job..