And give that a roll. Just place the file in the folder of your project, and remove the reference to the cellular driver in your reference of the project.
Any idea how to get the cellularRadio_SmsReceived event to fire?
(send sms works fine, but I cannot get any events to fire, i,e sms, signal strength, etc.)
@ John - Hmm, I am having some serious problems with it now. It seems that the module busy has been removed from the current driver, and that actually results in a reset of the cellular module because I am using it from two threads. Maybe I just need a complete rewrite of my code.
The modem is working in its own thread, and its easy to force new stuff into the channel. So its kind if unavoidable…? Take a look at these two versions of the same method, to me it seems that some thread safety has been removed and moved elsewhere???
And on top of that, the important debugprint line has been removed…STRANGE!
OLD 2014_R3 version:
public ReturnedState SendATCommand(string atCommand)
{
// Check if module is busy
if (isModuleBusy) return ReturnedState.ModuleBusy;
// Append carriage return
if (atCommand.IndexOf("\r") < 0) atCommand += "\r";
// Check if string is an AT command
if (atCommand.IndexOf("AT") < 0) return ReturnedState.InvalidCommand;
// Check if module is on
if (!isPowerOn) return ReturnedState.ModuleIsOff;
// Check if serial line is open
if (serialLine.IsOpen) serialLine.Write(atCommand);
else return ReturnedState.Error;
Thread.Sleep(100);
DebugPrint("SENT: " + atCommand);
return ReturnedState.OK;
}
Newest MASTER branch:
/// <summary>
/// Sends an AT command to the module. It automatically appends the carriage return.
/// </summary>
/// <param name="atCommand">The AT command. See SIM900_ATC_V1.00 for reference.</param>
/// <returns>The module response to the AT command.</returns>
public void SendATCommand(string atCommand)
{
if (!this.powerOn) throw new InvalidOperationException("The module is off.");
if (atCommand.IndexOf("AT") == -1) throw new ArgumentException("atCommand", "The command must begin with AT.");
if (atCommand.IndexOf("\r") < 0)
atCommand += "\r";
this.WriteLine(atCommand);
Thread.Sleep(100);
}
@ njbuch - The module busy flag was used very inconsistently and was not a good way to manage requests and responses. There is still a lot we want to do with the driver.