示例#1
0
    private void SPO2_lectura()
    {
        Debug.Log("Empezando a leer bloque SPO2...");

        int command_opcode = Lectura.leer(puerto, "Command Opcode: ");

        if (command_opcode == Lectura.POX_MEASUREMENT_COMPLETE_OK)
        {
            int length = Lectura.leer(puerto, "LENGTH: ");

            // leer desde el dato 0 hasta el dato n
            int[] bloque = Lectura.leerBloque(puerto, length);

            Debug.Log("Datos: " + Lectura.ArrayToString(bloque));

            if (length == 2)
            {
                Debug.Log("SPO2: " + bloque[0]);
                Debug.Log("Heart Rate: " + bloque[1]);
                SPO2v          = bloque[0];
                RITMOCARDIACOv = bloque[1];

                estado_puerto = estado.CALCULADO;

                Lectura.cerrarPuerto(puerto);
//                StartCoroutine(SPO2_DB(10, 1, bloque[0]));
//                StartCoroutine(SPO2_DB(10, 2, bloque[1]));
            }
        }
    }
示例#2
0
    private void GLU_lectura()
    {
        Debug.Log("Empezando a leer bloque GLU...");

        int ind     = Lectura.leer(puerto, "IND: ");
        int m_ready = Lectura.leer(puerto, "M READY: ");

        if (ind == Lectura.IND && m_ready == Lectura.GLU_BLOOD_DETECTED)
        {
            int length = Lectura.leer(puerto, "LENGTH: ");

            ind     = Lectura.leer(puerto, "IND: ");
            m_ready = Lectura.leer(puerto, "M READY: ");
            length  = Lectura.leer(puerto, "LENGTH: ");

            // leer desde el dato 0 hasta el dato n
            int[] bloque = Lectura.leerBloque(puerto, length);

            Debug.Log("Datos: " + Lectura.ArrayToString(bloque));

            if (length == 2)
            {
                Debug.Log("GLU: " + bloque[1]);
                GLUv = bloque[1];

                estado_puerto = estado.CALCULADO;

                Lectura.cerrarPuerto(puerto);
            }
        }
    }
示例#3
0
    public bool confirmacion()
    {
        int cfm = Lectura.leer(puerto, "CFM: ");

        if (cfm == Lectura.CFM)
        {
            int request = Lectura.leer(puerto, "Request: ");
            int uno     = Lectura.leer(puerto, "UNO 1: ");

            return(request == Lectura.GLU_START_MEASUREMENT &&
                   uno == 1);
        }
        return(false);
    }
示例#4
0
    public static bool confirmacion(SerialPort puerto)
    {
        int cfm = Lectura.leer(puerto, "CFM: ");

        if (cfm == Lectura.CFM)
        {
            int start  = Lectura.leer(puerto, "START: ");
            int length = Lectura.leer(puerto, "Length: ");
            int error  = Lectura.leer(puerto, "Error: ");

            return(error == Lectura.ERROR_OK);
        }
        return(false);
    }
示例#5
0
    public void GLU_comando()
    {
        byte[] mensaje = new byte[] { Lectura.REQ, Lectura.GLU_START_MEASUREMENT };
        puerto.Write(mensaje, 0, 2);

        Debug.Log("Datos enviados para GLU...");

        if (confirmacion())
        {
            int ok = Lectura.leer(puerto, "OK: ");

            if (ok == Lectura.ERROR_OK)
            {
                GLU_lectura();
            }
        }
    }
示例#6
0
    public void SPO2_comando()
    {
        byte[] mensaje = new byte[] { Lectura.REQ, Lectura.POX_START_MEASUREMENT };
        puerto.Write(mensaje, 0, 2);

        Debug.Log("Datos enviados para SPO2...");

        if (Lectura.confirmacion(puerto))
        {
            int ind = Lectura.leer(puerto, "IND (Packet Type): ");

            if (ind == Lectura.IND)
            {
                SPO2_lectura();
            }
        }
    }
示例#7
0
        protected void consultar_Click(object sender, EventArgs e)
        {
            try
            {
                lbMsg.Text = "";
                if (tbnoOrden.Text.Length != 0)
                {
                    DB.Conectar();
                    DB.CrearComando("select top 1 dirrespaldo, dirorigen from ParametrosSistema");
                    DbDataReader DR1 = DB.EjecutarConsulta();
                    if (DR1.Read())
                    {
                        dirtxt    = DR1[0].ToString();
                        dirorigen = DR1[1].ToString();
                    }
                    DB.Desconectar();

                    nombrearchivo    = System.IO.Directory.GetFiles(dirtxt, "*" + tbnoOrden.Text + "*.xml", SearchOption.AllDirectories);
                    datos            = lectura.leer(nombrearchivo[0]);
                    tbRUC.Text       = datos[0];
                    tbID.Text        = datos[1];
                    tbdireccion.Text = datos[4];
                    tbNombre.Text    = datos[5];
                    tbEmail.Text     = datos[6];
                }
                else
                {
                    lbMsg.Text = "Necesita colocar un número de orden.";
                }
            }
            catch (Exception ex)
            {
                lbMsg.Text  = "No se encontró un archivo con este número de orden.";
                lbMsg.Text += ex.ToString();
            }
        }