Cov txheej txheem:

Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API: 3 Cov Kauj Ruam
Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API: 3 Cov Kauj Ruam

Video: Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API: 3 Cov Kauj Ruam

Video: Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API: 3 Cov Kauj Ruam
Video: 7 txoj kev khwv nyiaj, yuav tau paub los mus hloov yus lub neej 2024, Hlis ntuj nqeg
Anonim
Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API
Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API
Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API
Yuav Ua Li Cas Txuas Android Daim Ntawv Thov Nrog AWS IOT thiab Nkag Siab Lub Suab Pom Zoo API

Cov ntawv qhia no qhia tus neeg siv yuav ua li cas txuas rau Android Application rau AWS IOT server thiab nkag siab lub suab lees paub API uas tswj hwm Lub Tshuab Kas Fes.

Daim ntawv thov tswj hwm Lub Tshuab Kas Fes los ntawm Alexa Lub Suab Pabcuam, txhua App cov khoom siv thiab cov lus txib ua rau muaj peev xwm sib txawv tsim los ntawm AWS los ntawm kev tshaj tawm ntawm AWS IOT cov ncauj lus.

Yuav tsum:

  • Kev paub yooj yim ntawm Android kev txhim kho txiav txim siab tias cov lej hauv paus tau txuas rau qhov kev qhia no, tab sis nws yog qhov tsim nyog los hloov qee qhov hloov pauv kom haum rau tus neeg siv tus lej thiab qee yam tsis.
  • Active AWS account.

Txoj haujlwm no tau muab faib ua 2 kauj ruam: Npaj ib puag ncig nrog Android Studio Daim Ntawv Thov thiab kev sib txuas lus nrog AWS IOT server thiab nkag siab lub suab paub ua haujlwm.

Kauj Ruam 1: Npaj Ib puag ncig nrog Android Studio Daim Ntawv Thov thiab Kev Sib Txuas Nrog AWS IOT Server

Cov kauj ruam no siv ib qho Android Application code twb tau teeb tsa txuas nrog cov lus qhia no, tab sis nws yog qhov tsim nyog yuav tsum tau teeb tsa thiab teeb tsa Android Studio cuab yeej. Txhawm rau rub nws, nyem rau kab ntawv no thiab ua raws cov lus qhia los ntawm cov ntaub ntawv raug cai.

Txhawm rau tsim Android Studio Daim Ntawv Thov los ntawm koj tus kheej thiab txuas nrog AWS IOT server, thov txheeb xyuas Cov Lus Qhia no.

Tam sim no, txhawm rau siv cov peev txheej muaj nyob ntawm no thov ua raws cov theem no:

  1. Rub tawm lub tshuab kas fes chaws muaj nyob rau ntawm qhov kawg ntawm cov kauj ruam no.
  2. Qhib Android Studio Tool.
  3. Nyem rau ntawm "Import project (Eclipse ADT, Gradle, etc.)".
  4. Xaiv cov cai rub tawm los ntawm thawj lub ncauj lus.

Txhawm rau hloov daim ntawv thov thiab pab kom AWS IOT sib txuas lus:

  1. Xaiv Android ntawm kev xaiv qauv ntawm sab laug sab saud ntawm lub qhov rais.
  2. Qhib "AWS Kev Sib Txuas" cov ntaub ntawv muaj nyob ntawm txoj kev no: app/java/cafeteira.com.cafeteira/Controller.
  3. Saib rau qhov hloov pauv hauv qab no: CUSTOMER_SPECIFIC_ENDPOINT, COGNITO_POOL_ID, AWS_IOT_POLICY_NAME thiab MY_REGION.
  4. Teeb lawv raws li koj tus as khauj AWS tom qab teeb tsa tus kheej nrog Amazon Cognito.

Kev sib txuas lus ntawm daim ntawv thov nrog AWS IOT server tau ua tiav los ntawm cov ncauj lus, uas ua haujlwm raws li kev sib txuas lus. Ntawm cov ncauj lus no tshwm sim kev tso npe thiab tshaj tawm uas yog lub luag haujlwm tswj hwm thiab saib xyuas lub xeev ntawm ntau hom IOT khoom siv. Ntawm qhov piv txwv no daim ntawv thov sau npe thiab tshaj tawm rau cov ncauj lus hauv qab no uas nyob hauv "Cov ntaub ntawv tsis tu ncua" (app/java/cafeteira.com.cafeteira/Controller): TOPIC_ END_TURN_ON_OFF, TOPIC_SHORT_COFFE, TOPIC_LONG_COFFE, TOPIC_LEVEL_COFFEE, TOPIC_LEDELPORP, TOPIC_LEVELP, TOPIC_LEVELP, TOPIC_LEVEL_WORP,.

Ntawm qhov piv txwv no cov ncauj lus tswj hwm thiab saib xyuas lub tshuab kas fes.

Kauj Ruam 2: Nkag Siab Txog Lub Luag Haujlwm Kev Paub Lub Suab

Nkag Siab Txog Lub Luag Haujlwm Kev Paub Lub Suab
Nkag Siab Txog Lub Luag Haujlwm Kev Paub Lub Suab

Lub suab paub ua haujlwm yog hais txog kev hloov cov neeg siv lub suab txib ua cov ntawv thiab xa nws mus rau AWS IOT server. Qhov hloov pauv kev ua haujlwm no yog muab los ntawm Google API npe SpeechRecognizer. Txhawm rau siv nws nws yuav tsum tau ntshuam SpeechRecognizer chav kawm (cov ntaub ntawv ntawm no). Chav kawm no twb tau nkag los ntawm qhov chaws los ntawm Kauj Ruam 1.

Kev lees paub lub suab tau qhib los ntawm nias lub pob hais lus (duab microphone), hais los ntawm lub pob mSpeechButton

Qhov kev hais kom ua kev kho mob yog nyob ntawm qhov xwm txheej onActivityResult, uas tau txais tus neeg siv lub suab, hloov pauv mus rau hauv cov ntawv thiab tom qab ntawd xaiv qhov kev tiv thaiv twg yuav raug qhib. Ntawm qhov piv txwv no: thaum tus neeg siv hais tias "Qhib lub tshuab kas fes", daim ntawv thov tso cai hloov pauv uas tswj hwm lub tshuab kas fes lub zog, los ntawm kev ua kom nws, daim ntawv thov tshaj tawm rau hauv AWS IOT lub ncauj lus ("1") qhia tias tshuab kas fes yuav tsum nyob ntawm.

Kauj Ruam 3: Xaus

Tom qab cov kauj ruam no daim ntawv thov tau npaj los txuas rau AWS IOT, tshaj tawm thiab sau npe yuav cov ncauj lus los ntawm kev hais lus lub suab thiab cov khoom siv UI.

Yog tias koj muaj kev ua xyem xyav txog daim ntawv pov thawj lossis daim ntawv thov, thov txheeb xyuas qhov txuas hauv qab no:

  • AWS IOT Android SDK
  • AWS IOT Certificates

Pom zoo: