I'm trying to communicate with an Iridium Modem. One of the commands requires to be sent in two steps.
See 5.170 on documentation
As can be seen in the documentation, there's two way to write a message on the device. The "one step" version has no problems and works as intended. The two step version behaves as follows.
expected result for two step command
Send: "AT+SBDWT"
Response: READY (Indicating that I must send the message now)
Send: "message"
Response: "0" // Indicating the message has been stored on the device
Unexpected result
Send: "AT+SBDWT"
Response: READY (Indicating that I must send the message now)
Response: 0 // Indicating the message has been stored on the device
Software and methods I used
When I use Minicom to communicate with the device, the two step command works as intended, but when I try to use the FileStream class in C# to send that specific command I get the unexpected behavior. (The rest of the commands have no problems)
Here's a really small part of c# code I use to send those "one step" messages that work
fs = new FileStream(_portName, FileMode.Open, FileAccess.Write, FileShare.ReadWrite
byte[] bytes = Encoding.ASCII.GetBytes(command); // has \r
fs.Write(bytes, 0, bytes.Length); // Fs = FileStream
fs.Flush();
Note that the command has "\r"
I'm guessing all this is related with "\r" or "\n" sent as part of the command. But if I try to send the "two step" command without it, the command will not be sent and therefore I don't get the "ready" response.