// Written by Joseph Goldburg mobile 61 412 750 765 email joe.g@optusnet.com.au // // Version 0.1 beta only // // // This Program takes a input text file GSM AT commands and send them to the serial port // command line options are // // ConsoleApplication1 COMx INPUT_FILE LOG_FILE PAUSE // Where // COMx is COM1 COM2 COM3 serial port etc // // INPUT_FILE is the input AT text file name file name but be 8.3 dos file format // // LOG_FILE text file for the log output file name must be 8.3 dos file format // // PAUSE if any character then the program will wait until keypress to exit // // Example calling the command line // // ConsoleApplication1 COM1 AT.txt log.txt // // Example of INPUT_FILE AT.txt for sending SMS's // // AT+CMGS="61412750765" // Sending text messages is easy^z // AT+CMGS="61412750765" // Sending another SMS message^z // AT+CMGS="61412750765" // Yet another text message^z // ATZ // // Any AT commands can be sent, jst add them to the text file // // Special consideration is given to ascii characters "^Z" or "^z" these are turned in to ascii control characters // Baud rate fixed at 115200 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO.Ports; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { for (int i = 0; i < args.Length; i++) { System.Console.Write("Arg[{0}] = [{1}] ", i, args[i]); }; Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Written by Joseph Goldburg Phone 0412 750 765 joe.g@optusnet.com.au"); Console.WriteLine(); if (args.Length < 3) { Console.WriteLine("*** Error in command line arguments ***\n"); Console.WriteLine("3 arguments required COMx inputfile logfile [Pause]\n\n"); Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); System.Environment.Exit(1); } // 3 arguments COM1 Input file and output file // files must be in dos compressed formant 8.3 // Arg[0] is the comport selection comport // Arg[1] is INPUT_FILE inputfile // Arg[2] is LOG_File
joey_go
Posts
-
sms using sending and receiving GSM Modem -
funcions in C# Windows formOK... it's not very good C# code but I ended up using the following code in a console application.
//Compare seconds
starttime = DateTime.Now.Second; // Get current recorded seconds from system
while (starttime == DateTime.Now.Second) { }// compare the recorded seconds to the system seconds
// and continue to loop until the seconds are differentRegs Joe
-
funcions in C# Windows formMy application writes some text to a textbox then I will call a 1 second delay (1000 millisecond) then write different data to the textbox. I'm probably lacking the fundamentals on how to call functions (methods) in C# and where to locate it in the files/classes. In C I would create the function prototype and the function and then call this function within main(). Calling the function on the form isn't the issue... it's how do I add this function (method) in to my Visual studio 2008 C# Windows form application. Any clues would be appreciated. Joe
-
AT CommandsPlease tell us more information about the mobile phone you will use. Does the mobile phone have a a serial port or USB connection? General information on GSM/3G AT commandset is available here http://www.developershome.com/sms/howToUseHyperTerminal.asp[^] For Serial port operations in C# look up SerialI/O in MSDN Reg Joe
-
funcions in C# Windows formHi All, I have a very basic windows applications form working. I would like to add this public function so that I can call it in the form code.
public static DateTime PauseForMilliSeconds( int MilliSecondsToPauseFor ) { System.DateTime ThisMoment = System.DateTime.Now ; System.TimeSpan duration = new System.TimeSpan( 0, 0, 0, 0, MilliSecondsToPauseFor ) ; System.DateTime AfterWards = ThisMoment.Add( duration ) ; while ( AfterWards >= ThisMoment ) { System.Windows.Forms.Application.DoEvents() ; ThisMoment = System.DateTime.Now ; } return System.DateTime.Now ; }
Where do I paste this function so I can call it on the windows form. How do I add files with functions to my code.... do I have to encapsulate them in a class? Thanks in advance Joe