Launching the project I get the following exception from the Open:
Failed to receive answer from the modem. Check serial port.
As you can see in the following trace, the modem responds correctly but the Terminal does not intercept it:
Cl_OnTrace: Opening
Cl_OnMediaStateChange: Opening
Cl_OnTrace: Settings: Port: /dev/ttyUSB0 Baud Rate: 9600 Data Bits: 8 Parity: None Stop Bits: One Eop: None
Cl_OnTrace: AT
Cl_OnTrace: AT
OK
Cl_OnTrace: AT
Cl_OnTrace: A
Cl_OnTrace: T
Cl_OnTrace:
OK
Cl_OnTrace: Closing
Cl_OnMediaStateChange: Closing
Cl_OnTrace: Closed
Cl_OnMediaStateChange: Closed
Failed to receive answer from the modem. Check serial port.
I believe that the reason is that data is handled asynchronously and data is received from Cl_OnReceived method.
If you want to do this synchronously, you can do it like this:
ReceiveParameters<byte[]> p = new ReceiveParameters<byte[]>()
{
Eop = 0x7E, //End of packet.
Count = 5, //Minimum byte count.
AllData = true, //Is all data read from the serial port.
WaitTime = 1000, //How long the reply is waited.
};
lock (TerminalMedia.Synchronous)
{
TerminalMedia.Send(data, null);
if (!TerminalMedia.Receive(p))
{
//No reply. Thrown an exception or read again.
}
//Received data
byte[] tmp = p.Reply;
}
Hi Mikko,
sorry but I do not understand.
This exception is thrown by the Open method of the GXTerminal library.
Going to see the sources, this function already executes the AT command in Synchronous mode:
GXTerninal.cs, Row 1157:
lock (Synchronous)
If I launch the same project on Win32 architecture everything works fine!
Some trobleshuting: If I set off the ECHO with ATE0 everything also works on linux.
OK. Now I get it. I believe that you are right and the ECHO might cause the problem.
Can you live with this if you set echo off for now? This can be fixed, but it takes some time to get a modem for testing. Our customers do not use them on a daily basis anymore. :-)
Hi Mikko,
you're very lucky if you don't use these damn modems anymore. In Italy, even for installations in new systems, the authorities still demand gsm modems !!! :p
Anyway, yes, I don't have any major problems.
However I created a pool request on the Terminal GitHub where I publicly expose the InitializeCommands property which was currently only accessible via the Settings method.
Then I would not see particular problems also in exposing the SendCommand method as public that sometimes it could be useful to have available to do some checks on the modem.
Hi Christian,
Hi Christian,
I believe that the reason is that data is handled asynchronously and data is received from Cl_OnReceived method.
If you want to do this synchronously, you can do it like this:
ReceiveParameters<byte[]> p = new ReceiveParameters<byte[]>()
{
Eop = 0x7E, //End of packet.
Count = 5, //Minimum byte count.
AllData = true, //Is all data read from the serial port.
WaitTime = 1000, //How long the reply is waited.
};
lock (TerminalMedia.Synchronous)
{
TerminalMedia.Send(data, null);
if (!TerminalMedia.Receive(p))
{
//No reply. Thrown an exception or read again.
}
//Received data
byte[] tmp = p.Reply;
}
BR,
Mikko
Hi Mikko,
Hi Mikko,
sorry but I do not understand.
This exception is thrown by the Open method of the GXTerminal library.
Going to see the sources, this function already executes the AT command in Synchronous mode:
GXTerninal.cs, Row 1157:
lock (Synchronous)
If I launch the same project on Win32 architecture everything works fine!
Some trobleshuting: If I set off the ECHO with ATE0 everything also works on linux.
BR
Christian
Hi Christian,
Hi Christian,
OK. Now I get it. I believe that you are right and the ECHO might cause the problem.
Can you live with this if you set echo off for now? This can be fixed, but it takes some time to get a modem for testing. Our customers do not use them on a daily basis anymore. :-)
BR,
Mikko
Hi Mikko,
Hi Mikko,
you're very lucky if you don't use these damn modems anymore. In Italy, even for installations in new systems, the authorities still demand gsm modems !!! :p
Anyway, yes, I don't have any major problems.
However I created a pool request on the Terminal GitHub where I publicly expose the InitializeCommands property which was currently only accessible via the Settings method.
Then I would not see particular problems also in exposing the SendCommand method as public that sometimes it could be useful to have available to do some checks on the modem.
BR
Christian