INHOUDSOPGAWE:

Espelho Mágico: 6 stappe
Espelho Mágico: 6 stappe

Video: Espelho Mágico: 6 stappe

Video: Espelho Mágico: 6 stappe
Video: НОЧЬЮ САМО ЗЛО ПРИХОДИТ В ЭТОТ ДОМ / AT NIGHT, EVIL ITSELF COMES TO THIS HOUSE 2024, November
Anonim
Image
Image

Neste instruksies kan as 'n lid van die protokol gebruik word om inligting te bekom wat inligting oor die klimaat en kennisgewing moontlik maak.

U kan dit ook gebruik, maar u kan dit ook gebruik om 'n kontrak te maak.

Stap 1: Hardeware

Hardeware
Hardeware

Dragonboard 410c

Audio Mezzanine Board

Stap 2:

Beeld
Beeld

Vir 'n programação foi utilizado van Visual Studio Community 2017, en 'n taal c#. 'N Koppelvlak wat vir die redakteur XAML van Visual Studio gebruik kan word.

Stap 3: Programação - Detecção De Voz

O primeiro passo, foi trabalhar com a detecção de voz. 'N Audio -mezzanine -raam kan ook vir mikrofone geïntegreer word, en dit kan ook gebruik word vir die deteksie. Geen Visual Studio, gebruik Windows en Media. SpeechRecognition vir die dekodering van 'n voz.

Ons kan dit ook gebruik om 'n amptelike inskrywing van die voz, wat die meeste van ons moontlik is, aan te dui.

private async void InicializaVoz () {var idioma = nuwe Windows. Globalization. Language ("en-US"); SpeechRecognizer herkener = nuwe SpeechRecognizer (idioom); Recognizer. StateChanged += RecognizerStateChanged; Recognizer. ContinuousRecognitionSession. ResultGenerated += RecognizerResultGenerated; string fileName = String. Format (SRGS_FILE); StorageFile grammarContentFile = wag Package. Current. InstalledLocation. GetFileAsync (fileName); SpeechRecognitionGrammarFileConstraint grammarConstraint = nuwe SpeechRecognitionGrammarFileConstraint (grammarContentFile); identifier. Constraints. Add (grammarConstraint); SpeechRecognitionCompilationResult compilationResult = wag op identifier. CompileConstraintsAsync (); if (compilationResult. Status == SpeechRecognitionResultStatus. Success) {Debug. WriteLine ("Resultaat:" + compilationResult. ToString ()); wag op erkenning. ContinuousRecognitionSession. StartAsync (); } anders {Debug. WriteLine ("Status:" + compilationResult. Status); }}

Ons kan ook rekonstruksie, of herkenning van resultate genereer, en ons kan dit ook vir ons interpreteer en 'n vergelyking gee met ons hoe ons dit kan installeer in xml wat ons kan oplos en oplos.

As ons 'n moontlike inserir of idioma português het, kan ons ook vir 'n vertoning (mostrar) 'n verberging (esconder) en 'n que deve ser mostrado voorspelling (previsão) en nuus (notícias) gee.

private async void RecognizerResultGenerated (SpeechContinuousRecognitionSession sessie, SpeechContinuousRecognitionResultGeneratedEventArgs args) {

int count = args. Result. SemanticInterpretation. Properties. Count;

// Kyk of daar verskillende merkers is en initialiseer die veranderlikes

String target = args. Result. SemanticInterpretation. Properties. ContainsKey ("target")? args. Result. SemanticInterpretation. Properties ["target"] [0]. ToString (): "";

String cmd = args. Result. SemanticInterpretation. Properties. ContainsKey ("cmd")?

args. Result. SemanticInterpretation. Properties ["cmd"] [0]. ToString (): "";

String device = args. Result. SemanticInterpretation. Properties. ContainsKey ("device")?

args. Result. SemanticInterpretation. Properties ["device"] [0]. ToString (): "";

// Kyk eers na watter toestel die gebruiker verwys

if (cmd. Equals ("wys"))

{

if (device. Equals ("voorspelling")) {Consulta_previsao (); } anders if (device. Equals ("nuus")) {Consulta_noticias (); } anders {//Debug. WriteLine("Unbekende toestel "); }

} anders if (cmd. Equals ("verberg"))

{

if (device. Equals ("voorspelling")) {//Tempo. Text = ""; wag op this. Dispatcher. RunAsync (Windows. UI. Core. CoreDispatcherPriority. High, () => {// Dit werk nou omdat dit op die UI -draad loop: this. Max_tit. Text = ""; this. Min_tit. Text = ""; this. Min. Text = ""; this. Max. Text = ""; this. Img_Tempo. Source = nuwe BitmapImage (nuwe Uri ("ms-appx: ///Images/blank.png"));

});

}

anders as (device. Equals ("nuus")) {wag op hierdie. Dispatcher. RunAsync (Windows. UI. Core. CoreDispatcherPriority. High, () => {// Dit werk nou, want dit loop op die UI -draad: hierdie. News1. Text = ""; this. News2. Text = ""; this. News3. Text = ""; this. News4. Text = ""; this. News5. Text = "";})); } anders {// Debug. WriteLine ("Onbekende toestel"); }} anders {//Debug. WriteLine("Unbekende opdrag "); }

}

Stap 4: Programação - Exibir Previsão Do Tempo

U kan die opsporing van die voorspellings vir die skouvoorspelling sien, of dit is 'n konsultasie van HTTP op die webwerf van CPTEC vir INPE, en dit is moontlik om 'n vorige tempo te gebruik om XML te gebruik. Ons kan ook xml gebruik, en ons kan dit met 'n e -posadres sien en as 'n maksimum temperatuur as 'n maksimum temperatuur.

privaat asynchroniseer leegte Consulta_previsao () {

HttpClient httpcliente = nuwe HttpClient ();

// HttpResponseMessage resp = httpcliente. GetAsync ("https://servicos.cptec.inpe.br/XML/cidade/222/previsao.xml"). Result; var resp = httpcliente. GetAsync ("https://servicos.cptec.inpe.br/XML/cidade/222/previsao.xml"). Result; resp. EnsureSuccessStatusCode (); var respbody = resp. Content. ReadAsStringAsync (); XmlDocument previsao = nuwe XmlDocument ();

previsao. LoadXml (respbody. Result);

XmlElement root = previsao. DocumentElement;

XmlNodeList -nodes = root. GetElementsByTagName ("tempo");

string prevtempo = (nodes. Item (0). InnerText);

string prevtempo1 = (nodes. Item (1). InnerText); string prevtempo2 = (nodes. Item (2). InnerText); string prevtempo3 = (nodes. Item (3). InnerText); nodes = root. GetElementsByTagName ("minima"); string tempmin = (nodes. Item (0). InnerText); nodes = root. GetElementsByTagName ("maxima"); string tempmax = (nodes. Item (0). InnerText);

string rsultado_previsao = "";

skakelaar (vorentoe)

{case "ec": rsultado_previsao = "Chuvas_Isoladas.png"; breek; case "ci": rsultado_previsao = "Chuvas_Isoladas.png"; breek; geval "c": rsultado_previsao = "Chuva.png"; breek; case "in": rsultado_previsao = "Instavel.png"; breek; saak "pp": rsultado_previsao = "Chuva.png"; breek; geval "cm": rsultado_previsao = "Chuva.png"; breek; case "cn": rsultado_previsao = "Chuvas_Isoladas_Noite.png"; breek; case "pt": rsultado_previsao = "Chuva.png"; breek; case "pm": rsultado_previsao = "Chuvas_Isoladas.png"; breek; case "np": rsultado_previsao = "Chuva.png"; breek; case "pc": rsultado_previsao = "Chuva.png"; breek; case "pn": rsultado_previsao = "Nublado.png"; breek; case "cv": rsultado_previsao = "Chuva.png"; breek; case "ch": rsultado_previsao = "Chuva.png"; breek; case "t": rsultado_previsao = "Tempestade.png"; breek; case "ps": rsultado_previsao = "Sol.png"; breek; geval "e": rsultado_previsao = "Sol_Encoberto.png"; breek; case "n": rsultado_previsao = "Nublado.png"; breek; case "cl": rsultado_previsao = "Sol.png"; breek; case "nv": rsultado_previsao = "Nevoeiro.png"; breek; case "g": rsultado_previsao = "Neve.png"; breek; case "ne": rsultado_previsao = "Neve.png"; breek; geval "nd": rsultado_previsao = "na.png"; breek; case "pnt": rsultado_previsao = "Chuvas_Isoladas_Noite.png"; breek; case "psc": rsultado_previsao = "Chuva.png"; breek; case "pcm": rsultado_previsao = "Chuva.png"; breek; saak "pct": rsultado_previsao = "Chuva.png"; breek; case "pcn": rsultado_previsao = "Chuva.png"; breek; case "npt": rsultado_previsao = "Chuva.png"; breek; geval "npn": rsultado_previsao = "Chuva.png"; breek; saak "ncn": rsultado_previsao = "Chuva.png"; breek; case "nct": rsultado_previsao = "Chuva.png"; breek; case "ncm": rsultado_previsao = "Chuva.png"; breek; geval "npm": rsultado_previsao = "Chuva.png"; breek; geval "npp": rsultado_previsao = "Chuva.png"; breek; case "vn": rsultado_previsao = "Instavel.png"; breek; case "ct": rsultado_previsao = "Chuva.png"; breek; case "ppn": rsultado_previsao = "Chuvas_Isoladas_Noite.png"; breek; case "ppt": rsultado_previsao = "Chuva.png"; breek; geval "ppm": rsultado_previsao = "Chuva.png"; breek;

}

wag op hierdie. Dispatcher. RunAsync (Windows. UI. Core. CoreDispatcherPriority. High, () => {// Dit werk nou, want dit werk op die UI -draad: this. Max_tit. Text = "Máxima"; this. Min_tit. Text = "Mínima"; this. Min. Text = tempmin + "°"; this. Max. Text = tempmax + "°"; this. Img_Tempo. Source = new BitmapImage (new Uri ("ms-appx: /// Prente/" + rsultado_previsao));});

}

Stap 5: Programação - Exibir Notícias

Kyk na die opsporingsnuus vir die nuus, of raadpleeg ons om HTTP te versoek om die BBC -kennisgewing te ontvang. Aangesien cinco primeiras nie meer teksblokke kan gebruik nie.

privaat asynchroniseer leegte Consulta_noticias () {

HttpClient httpcliente2 = nuwe HttpClient ();

var resp2 = httpcliente2. GetAsync ("https://feeds.bbci.co.uk/portuguese/rss.xml"). Result;

resp2. EnsureSuccessStatusCode (); var respbody2 = resp2. Content. ReadAsStringAsync (); XmlDocument noticia = nuwe XmlDocument ();

noticia. LoadXml (respbody2. Result);

XmlElement root2 = noticia. DocumentElement;

XmlNodeList nodes2 = root2. GetElementsByTagName (@"title");

wag op hierdie. Dispatcher. RunAsync (Windows. UI. Core. CoreDispatcherPriority. High, () =>

{this. News1. Text = (nodes2. Item (2). InnerText); this. News2. Text = (nodes2. Item (3). InnerText); this. News3. Text = (nodes2. Item (4). InnerText); this. News4. Text = (nodes2. Item (5). InnerText); this. News5. Text = (nodes2. Item (6). InnerText);

});

}

Stap 6: Gevolgtrekking

Ons kan ook instruksies opstel, wat ons in staat kan stel om 'n volledige gebruik van die IOS -kern te installeer. Basta criar of arquivo de grammática com os comandos desejados.

Skrywers: Egon Patrick Marques Silva

Frederico Clark

Aanbeveel: