Пример #1
0
        public async Task <ConfigurationNtp> GetConfigurationNtp()
        {
            ReponseCommandeAT rep = await EnvoyerCommandeATAvecReponseAT("AT+CNTP?");

            if ((rep != null) && (rep.CodeRetourNumerique == 0))
            {
                return(ConfigurationNtp.CreateFrom(rep.ReponseCommande));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public static ConfigurationNtp CreateFrom(string reponseCommandeAT_CNTP)
        {
            ConfigurationNtp res = null;
            int idxCNTP          = reponseCommandeAT_CNTP.IndexOf("+CNTP: ");

            if (idxCNTP >= 0)
            {
                string[] tabchamps = reponseCommandeAT_CNTP.Substring(idxCNTP + 7).Split(',');
                res = new ConfigurationNtp()
                {
                    UrlServeurNtp = tabchamps[0]
                };
                res.DecalageUtc = TimeSpan.FromMinutes(Convert.ToDouble(tabchamps[1]) * 15);
            }
            return(res);
        }