On Thu, 30 Oct 2008 13:15:02 +0430 "amin abbasi" <[EMAIL PROTECTED]> wrote:
> I want to write a java program to communicate with my modem using > apache-mina-serial package. > these are my runngin environment properties: > > mina version: 2.0.0 M3 > Os: win xp service pack 2 > JVM: Java(TM) SE Runtime Environment (build 1.6.0_04-b12) > > the sample source code is attached to the email. > > i can send at command to the modem, and i can received the answer, for > example i write "AT" and the sample code sends the command to my > modem, then my modem answer the command with "OK" response. but, there > is a problem with mina serial package, when i want to dial a phone > number using at command : 'ATDT<a_phone_number>'. > the problem is that the modem responds 'ok' immediately, without > completely running the command. i think there may be other commands > which returns before they runs completely such as the dial command (i > do this later, using java comm api, and it works well). > > > probable cause: > > i test the command using hyperterminal( in window xp) and i see that > hyperterminal first trys to detect carrier singnal and if it was > detected, trys to dial the phone number, and after successful dialing, > it responds 'ok'. if I press a key (such as Enter) just when the > 'atdt' command is running, hyperterminal stops dialing (stops running > atdt command), and return 'ok'. > > so i think <mina serial> sends a '\r\n' or '\n' character to my modem, > before atdt is completely run and this is why i receive 'ok' response, > immediately after sending atdt command without any dial trys. > > please help me, what is the problem if i am wrong? Hi Amin, look like you use the TextLineCodec, so you are supposed to write directly String to your sessions (ex : cf.getSession().write(rawcmd); ) no need to add \n or \r\n, it's the TextLineCodec who will add it, depending how you constructed it. Julien
signature.asc
Description: PGP signature
