Read from serial port using RComm and RCommServer
| Thu, 2005-04-07 11:43 | |
|
Hello
I'm having serious problems using the serial port of a smartphone for AT-commands. I set up an RCommServer and two RComm, one for writing to the serial port and one for reading from it. Then I write an AT command which is handled correctly. After that I would like to read from the serial port. Here the problems start... Both RComm are in ECommSharedMode. On a Nokia 7610 this works, i.e., I can read from the serial port and display the reply. With a Nokia 6600 or Nokia 6630, however, this fails with Error -14 (Already in use). Trying to track down the error, I checked the receive buffer sizes. They are ok, both 8192. On the Nokia 6600 device the NotifyDataAvailable request completes but when checking how many bytes are in the receive buffer I always get 0 and trying to read them causes error -14 again. On Nokia 7610, after NotifyDataAvailable completes, the number of bytes in the buffer is correct... Why does the NotifyDataAvailable request complete when the number of bytes in the buffer is zero immediately afterwards? I have also tried other approaches: a) one port for writing and reading => works for 7610 but not for 6600. b) use OpenWhenAvailable to open ports => opening second port (for reading) blocks. c) use other roles => only ECommRoleDTE or none work. d) update firmware => did not resolve the issue. Code: // send request User::LeaveIfError(commServer.Connect()); TBufC<12> port(_L("DATAPORT::0")); User::LeaveIfError(commWrite.Open(commServer, port, ECommShared, ECommRoleDTE)); commWrite.Write(writeStatus, requestString); User::WaitForRequest(writeStatus); User::LeaveIfError(writeStatus.Int()); commWrite.Close(); User::LeaveIfError(commRead.Open(commServer, port, ECommShared, ECommRoleDTE)); // get reply commRead.NotifyDataAvailable(dataAvailStatus); User::WaitForRequest(dataAvailStatus); User::LeaveIfError(dataAvailStatus.Int()); commRead.ReadOneOrMore(readStatus, replyBuf); User::WaitForRequest(readStatus); User::LeaveIfError(readStatus.Int()); extractUSSDString(&replyBuf, &message); User::After(4000000); showInformationNote(&message, &dlgReplyText, dlgReply); // close ports commRead.Close(); commServer.Close(); I am very thankful for any hints or pointers, thanks! |
|






Forum posts: 11
Try using DATAPORT::1 instead and in the init sequence turn off the echo,
ie ATE0.
This works fine for me.
cheers
Forum posts: 44
I am developing a similar function.
Gruber, you said that your code is doing fine in 7610, right?
well, could you please share your code with me? because I am using 6670 and 6670&7610 should have the same characteristic because they share the same OS, but I can not get the response using your code.
In dataport 0, it still give error -14, and in dataport 1 it returns the command itself, not the response from server.
What is it mean bu turn off the echo? I don;'t understand at all.
Please, this is quite an emergency task for me, so I must find out the answer asap.
best regards,
Irma