GSM modem library - c#

I'm looking for SMS library that is written in c#, anyone the best library for it and it's free ? I can find more than 1 in Linux, but I'm can't found anything that is written in c# and free

Most GSM modem will come with a library of it's own. You don't really need the library to be written in C#. Generally it will be in dll or exe. If it's a dll written using C++, you can still call it's function via p/invoke. You just need to know the function signature in order to send and retrieve data from it properly. Check the documentation. If it's an exe, most likely it commandline based, then you can call it by using Process.Start() and putting in what ever you want to send via the argument.

Check out GSMComm.
http://www.scampers.org/steve/sms/index.htm

Related

Can PHP Extensions be written using C#

Is it possible to create a PHP Extension using C#?
We have a need to connect PHP to in house libraries we have written in C#.NET 4.6 targeting Windows and would like to be as close as possible to PHP without needing to have a serivce we can call external to php, thus the idea of making an extension in house.
I've looked at a couple options:
Use PHP DOTNET extension to call C# assembly.
As far as I can tell this extension does not work with .NET 4+ and the C# code requires 4.6 sadly.
Write a PHP extension.
So far I have only seen examples for Windows using Win32 and C++, idealy it would be nice if the extension could be written in C#. I have thoughts on making a lib using the C# code we need, then utilizing that inside the Win32/C++ extension and trying that if I absolutly have to.
Call the C# code as an external service.
As a very last option this would be viable and I can see this being more flexible for other sources to use (i.e. PHP, Java, C#, etc)
It would be interesting to be able to write a PHP Extension using C# assuming this is possible. I can see how this may not be the "best" option if it is possible though.
Thanks for reading and advice!!!
Coming off of #SevaAlekseyev idea I was able to get PHP to call C# using COM.
<?php
$object = new COM('ComClassExample.ComClassExample');
echo '1 and 1 added: ' . $object->AddTheseUp(1,1);
?>
Using the following site I was able to make a C# dll that exposed itself like a COM object. https://whoisburiedhere.wordpress.com/2011/07/12/creating-a-com-object-from-scratch-with-c/
And with a little tweak to the Post-build event I was able to get the new version to load for PHP (had to copy because PHP was getting an access denied message)
iisreset /stop
copy /Y "$(TargetPath)" C:\com\$(TargetFileName)
$(frameworkdir)\$(frameworkversion)\regasm.exe C:\com\$(TargetFileName) /codebase /tlb /nologo
iisreset /start
#JuanDelaCruz Peachpie looks like an interesting tool to keep in mind but it looks like it is meant to be compiled before deployment which wont work in our shop for the moment.
Thanks all!

sending data from python to c#

i have a chart pattern recognition program using neural networks written in python .instead of porting the whole code to C# ,i decided it was better to only send certain bits indicating the following :
Buy=1,Sell=-1,Do nothing=0
once they are in C-sharp ,i could relay them to a third party program (multicharts) which would continuously call the C# dll function and receive these values after a certain time interval .
my question is ,is there a way to relay these bit's to C# and pack all of this in a dll ,which gets read by the 3rd party program ?
the whole reason i want to port to C# is because multicharts only reads in dll's and i dont think python has them.
sorry for being naive ,i don't have very good grip on C# .
Your options are as follow,
Use a TCP socket, bind it to a port and listen for data in C# while the python application sends all data to it. C# has some great features for sockets such as System.Net.TcpClient
and
System.Net.TcpServer.
Your other option is that if the C# application only needs to be run once it receives information from the python program and then it can die, you could have the python program start the C# one and pass it parameters containing the information that you need transmitted.
By the looks of it your question only asked if there was a way to communicate, these are probably the best two. Please let me know if I can help anymore.

Linux/OSX equivalent of windows PlaySound

Due to the lack of a managed .NET api for playing MP3 files, I'm using the PlaySound(byte[]) as P/Invoke and it is now playing the MP3 file successfully.
I can't use any third party libraries due to license restrictions.
Now, I want to port the application to Linux and OS X using Mono but I'm unsure which P/Invokes should be used on those platforms.
An answer to a similar question said
You can just open("/dev/dsp") and write to it. That's as "native syscall" as you can get, I believe.
but I don't know how to do that in C#
Thanks.
You'll need to use the SDL_Mixer library with the SMPEG library for mp3 support. The code should be reusable across all OS's.

How to create a .lib file from a C# DLL?

I need to create a .lib file from a C# DLL (I think it is C# becuase of this code which calls to the dll https://code.google.com/p/thunder-missile-api/downloads/detail?name=MissileLauncher.cs&can=2&q=) In other word's I need to create a .lib for DreamCheeky Thunder Missile Launcher DLL, which comes with their software .
Now, what I need to do? I need to operate this device using C++. Easiest way is using their own DLL. The above linked code does it in C#.
I tried importing the DLL file into the project C++, but it seems like some methods are missing, specially methods like moveMissileLauncher() which are called in the C# code.
And the best thing is, I might want to move to QT (most probably) so you know, having a .lib is a good idea.
Crating a lib from a managed dll will do no good. You need to use interop
http://msdn.microsoft.com/en-us/library/ms973872.aspx
In your specific case, I would write a C++ lib that exposes the methods you need/want to call and forwards them to the managed C# dll using interop
I would do that in C++/CLI, personally.
A good, more recent article on the options you have is here http://msdn.microsoft.com/en-us/magazine/dd315414.aspx, or look here on SO for COM/.NET interop and you will find plenty of answers.
You want to call managed C# code from your c++ application. Here is tutorial to make someway to call c# code from your c++ application, i have used this method before, and works fine for me.

How can I install a printer using .NET?

I have an .INF for a virtual printer that I need to install from a .NET Application. I have done this before using batch scripts, but I am looking for a snippet of code to do this in the .NET Framework.
There's nothing particular about the printer .INF, so any code that installs a printer from an INF in C# or VB.NET will work.
I believe this is possible via interop to native win32 APIs, but I've found its much, much easier just to use a System.Diagnostics.Process() to call into printui.dll via:
rundll32.exe printui.dll,PrintUIEntry /?
Perhaps you're already using that in the mentioned batch script, but if not the parameters are documented here: PrintUI.DLL User's Guide and Reference
Just be sure to test it against all operation systems you need to support. Some options either do not exist in all Windows releases or have been renamed (although I think they're the more esoteric options - installing an .INF will likely work across the board).
You are going to want to look at the WMI objects available. These give you a finer control of the local machine settings. Take a look at the WMI code creator from Microsoft, I believe this will generate some example code you can leverage to solve your problem.
Administering Printer Settings in C# for Flexible Printing
see this article, it uses an MS Platform SDK DLL called PRNADMIN to manage printers, printer-drivers, printer-ports, ...etc.
I personally use it in a commercial project to install a printer driver and change the printer port to local port to intercept the Postscript. and it works like a Charm.
Alternatively you can use some pre-installed vbscripts that come with windows in C:\Windows\system32\Printing_Admin_Scripts and here is a an articles for them:
http://technet.microsoft.com/en-us/library/cc771846.aspx
This is not the ideal solution, but if nobody else answers, you can create a temp batch file and invoke that through C#/VB.NET.
Someone else will probably know a more natural way to do this.
You will need to wrap the setup APIs using PINVOKE or a native COM object.

Categories

Resources