elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Mensajes
Páginas: [1]
1  Comunicaciones / Hacking Mobile / Re: C# System.IO.Port SerialPort en: 11 Mayo 2006, 19:24 pm
si es muy sencillo

lo que pasa es q cuando ejecutas comandos AT es necesario enviarle al fin de la trama un tab y enter siempre y cuando los comandos no sean +++ (colgar la llamada) o  a\ repetir comando anterior ejecutado.
Te envio un metodo que cree para este fin:

        private void WritePortSerie(string strWrite, bool blnComandoAT)
        {
            objTxModem.ExecCommandAT = blnComandoAT;
            try
            {
                if (objTxModem.ExecCommandAT == true && (strWrite.Trim().Length > 0 && RS232.IsOpen))
                {
                        /*salida*/
                        /*************************/
                        RS232.DtrEnable = true; // DTR data terminal ready
                        RS232.RtsEnable = true; // RTS request to sent
                        /*************************/
                        //ejecuta comandos at
                        if (strWrite.Trim() == "+++")
                         RS232.Write(strWrite);
                        else if (strWrite.Trim() == "A/")
                         RS232.Write(strWrite);
                        else
                         RS232.Write(strWrite + "\r" + "\n");
                        //cadena enviada
                    txtComandoEnviado.AppendText("Cadena enviada: " + strWrite.ToString().Trim() + "\n");                                       
                }
                else if ((strWrite.Trim().Length > 0 && RS232.IsOpen) && objTxModem.ExecCommandAT == false)
                {
                    RS232.DtrEnable = true; // DTR data terminal ready
                    RS232.RtsEnable = true; // RTS request to sent
                    RS232.Write(strWrite);
                }
            }
            catch (Exception ex)
            {
                txtComandoEnviado.AppendText("--- Error--- general Escribiendo en el puerto: " + ex.Message + "\n");
            }
        }
 

Cordialmente,
Omar Acosta
oeac_llll@hotmail.com
www.dyetron.com

Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines