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;
DebugPrint("SENT: " + atCommand);
will generate an error because it is not an AT command and will not send the data.
To fix this i changed the SendTcpData to
You are correct - the SendTcpData implementation is wrong and will always return InvalidCommand.
If you want to send proper blocks of data, or even receive (the holy grail!) you actually need to put the SIM900 in transparent data mode instead of AT command mode. You need to modify the driver, because as it is written the serial receive thread can only parse AT responses. We set ours up to have a DataMode flag that switches between AT command mode and Modem mode. Note that in Modem mode it is not required to send the (char)26 as data is automatically sent when the serial line is idle for a (configurable) time. If you do send (char)26, it will go in the data stream.
To get out of data mode, you send “+++”. Look at the delays in the sample code. If you don’t use these delays, then the SIM900 will just send the “+++” as data.
@ Byron - thats pretty much what I’m aiming to do, but I’m struggling slightly pulling the code together.
I’ve grabbed your drivers from CodePlex, and the CellularRadioManager extension you posted on the forum. So first off thanks for that.
So I have a test project, which refers to the drivers, and seems pretty happy, can send and recieve txt msgs that kind of thing.
Next I’ve dropped the CellularRadioManager class into the test project, but I can’t figure out where to call it (I’m using the usage code from the forum). I’ve added the ‘usage’ example code to a button pressed event handler, and it successfully retrieves the IMEI, starts up GSM and GPRS, but that’s it.
I’m sorry to be so stupid, but would you be kind enough to provide a bit more context, or a few pointers on how to use the CellularRadioManager?
Initially I’m just trying to hit www.google.com and retrieve data to prove the functionality, then I’ll write a simple webservice.
Would it be a case of making the events in the CellularRadioManager public, and adding handlers in the test project perhaps?
[quote]Your client has issued a malformed or illegal request.
That’s what they tell you. You need to correct that.
To test that, simply use a TELNET app on a PC and telnet to the same address and port 80, and issue the same commands; you should get the same response. When you get the correct response there, put that code into your Fez App.
I tried that, but bizzarely the new command window opened with black text on a black background, so I wasn’t able to see what the responses are doing (I’m running on win2k8 r2). Once I can sort that out i’ll certainly try telnet!