Ejemplo n.º 1
0
        public bool Connect()
        {
            comm = new GsmCommMain(Comm_Port, Comm_BaudRate, Comm_TimeOut);
            bool connected = false;

            comm.Open();

            if (comm.IsConnected())
            {
                Manufacturer = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                Model        = comm.IdentifyDevice().Model.ToUpper().ToString();
                Revision     = comm.IdentifyDevice().Revision.ToUpper().ToString();
                SerialNumber = comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                connected    = true;
                Debug.Write("Manufacturer " + Manufacturer + Environment.NewLine + "Model " + Model + Environment.NewLine + "Revision " + Revision + Environment.NewLine + "SerialNumber " + SerialNumber + Environment.NewLine + "connected " + connected.ToString());
            }
            return(connected);
        }
Ejemplo n.º 2
0
        public bool CrearConexionCOM()
        {
            bool retry = true;;

            do
            {
                comm = new GsmCommMain("COM" + puertoCOM, 9600, 150);
                try
                {
                    comm.Open();
                    if (comm.IsConnected())
                    {
                        //eventLog.WriteEntry("Conexion de BAM exitosa, señal del dispositivo: " + comm.GetSignalQuality().SignalStrength,EventLogEntryType.Information);
                        string nombreBAM      = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                        string modelBAM       = comm.IdentifyDevice().Model.ToUpper().ToString();
                        string numRevisionBAM = comm.IdentifyDevice().Revision.ToUpper().ToString();
                        string numSerieBAM    = comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                        new LogAplicacion().Info("Conexion de BAM exitosa, señal del dispositivo: " + comm.GetSignalQuality().SignalStrength
                                                 + "\n Datos BAM: \n *" + nombreBAM + "\n *" + modelBAM + "\n *" + numRevisionBAM + "\n *" + numSerieBAM
                                                 );
                        return(true);
                    }
                    else
                    {
                        comm.Close();
                        puertoCOM++;
                    }
                }
                catch (Exception ex)
                {
                    if (puertoCOM >= 50)//recorre hasta el puerto 50
                    {
                        NotificacionCorreo notificacionCorreo = new NotificacionCorreo();
                        Thread             thread             = new Thread(x => notificacionCorreo.EnviarThread("Verifique que la banda ancha (bam) este conectada al equipo..!!<br></br>Se recomienda cerrar la aplicacion e intentar de nuevo <br></br>Error: " + ex));
                        thread.Start();
                        new LogAplicacion().Error(ex.Message);
                        return(false);
                    }
                    puertoCOM++;
                    retry = true;
                }
            }while (retry);
            return(false);
        }
Ejemplo n.º 3
0
        public void connect()
        {
            string cmbCOM = "COM" + comms.Text;

            comm = new GsmCommMain(cmbCOM, 9600, 150);

            try
            {
                if (comm.IsConnected())
                {
                    info.Content    = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Model.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Revision.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.GetCurrentOperator();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSignalQuality();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSmscAddress();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSubscriberNumbers();
                    save.Visibility = Visibility.Visible;


                    Console.WriteLine("comm is already open");
                }
                else
                {
                    Console.WriteLine("comm is not open");
                    comm.Open();

                    info.Content    = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Model.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Revision.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                    save.Visibility = Visibility.Visible;
                }
            }
            catch (Exception r)
            {
                MessageBox.Show(r.Message);
            }
        }
Ejemplo n.º 4
0
        public List <string> modemDetail()
        {
            List <string> list = new List <string>();

            try
            {
                string Phone_Name   = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                string Phone_Model  = comm.IdentifyDevice().Model.ToUpper().ToString();
                string Revision_Num = comm.IdentifyDevice().Revision.ToUpper().ToString();
                string Serial_Num   = comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                string address      = comm.GetSmscAddress().ToString();

                list.Add(Phone_Name);
                list.Add(Phone_Model);
                list.Add(Revision_Num);
                list.Add(Serial_Num);
            }
            catch (Exception e50)
            {
                MessageBox.Show("Error Retriving COM Port Phone Information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(list);
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                IdentificationInfo info = comm.IdentifyDevice();
                Output("Manufacturer: ", info.Manufacturer);
                Output("Model: ", info.Model);
                Output("Revision: ", info.Revision);
                Output("Serial number: ", info.SerialNumber);
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }

            Cursor.Current = Cursors.Default;
        }