Exemple #1
0
        public void ConSend(double[] sValues)
        {
            string initMessage = "7EAB";
            string basicVehicleVerification = "ACE9";
            string sensorData   = "";
            string finalMessage = "";
            string checksum     = "";
            int    countSensor  = 0;

            for (int i = 0; i < 6; i++)
            {
                if (sValues[i] > 0)                                                      //Contamos la cantidad de datos a enviar
                {
                    sensorData += Readings.returnCode(i + 1) + convertToHex(sValues[i]); //Devuelve ya la cadena con el codigo F0X y el valor en HEX
                    countSensor++;
                }
            }
            //SHA_2 sha = new SHA_2();
            //checksum = sha.encrypt(sensorData).Substring(0, 6).ToUpper();
            checksum     = "16E196";
            finalMessage = initMessage + countSensor.ToString("D2") + basicVehicleVerification + sensorData + checksum;
            Debug.WriteLine(finalMessage);
            ConReceived(finalMessage);
        }