基于android平臺(tái)的串口通信實(shí)現(xiàn).doc
約5頁DOC格式手機(jī)打開展開
基于android平臺(tái)的串口通信實(shí)現(xiàn),摘要:串口在數(shù)據(jù)通信中應(yīng)用廣泛,但android sdk指定使用java作為第三方應(yīng)用開發(fā)語言,這給c語言實(shí)現(xiàn)串口應(yīng)用帶來了困難。雖然google android已經(jīng)發(fā)布了ndk(native development kit,原生態(tài)開發(fā)包),支持開發(fā)者用c/c++語言開發(fā)android程序,但目前官方提供的技術(shù)指導(dǎo)比較...


內(nèi)容介紹
此文檔由會(huì)員 leany168 發(fā)布
摘要:串口在數(shù)據(jù)通信中應(yīng)用廣泛,但Android SDK指定使用Java作為第三方應(yīng)用開發(fā)語言,這給C語言實(shí)現(xiàn)串口應(yīng)用帶來了困難。雖然Google Android已經(jīng)發(fā)布了NDK(Native Development Kit,原生態(tài)開發(fā)包),支持開發(fā)者用C/C++語言開發(fā)Android程序,但目前官方提供的技術(shù)指導(dǎo)比較簡(jiǎn)略。通過開發(fā)一個(gè)Android下串口通信應(yīng)用實(shí)例,詳細(xì)介紹了Android NDK的開發(fā)流程,幫助開發(fā)人員快速的完成平臺(tái)搭建。
關(guān)鍵詞:Android;NDK;JNI;SDK;串口
Serial Communication Based Android Platform
JIN Zhi-yi, ZHANG Ji
(Vehicle College, Tongji University, Shanghai 201804, China)
Abstract: Serial communication is widely used in data communication, but the Android SDK uses the Java language as a designated third-party application development, which makes it difficult to achieve serial applications with C language. Although Google Android has released NDK (Native Development Kit)which supports the developer to develop Android program with C/C++ language,but the official technical guidance has been relatively brief. Through the development of serial communication under an Android platform as an application example, article gives a thoroughly description of the Android NDK development process that can help developers quickly build platforms.
Key words: Android; NDK; JNI; SDK; serial
Android是Google推出的基于Linux的開源手機(jī)操作系統(tǒng),是一個(gè)專門針對(duì)移動(dòng)設(shè)備設(shè)計(jì)的軟件平臺(tái),包括操作系統(tǒng)、中間件和一些關(guān)鍵應(yīng)用。它的軟件架構(gòu)包含四個(gè)層次,從高到低分別為應(yīng)用層、應(yīng)用框架層、系統(tǒng)運(yùn)行層和linux內(nèi)核層,如圖1所示。每一個(gè)Android應(yīng)用程序都在它自己的進(jìn)程中運(yùn)行,都擁有一個(gè)獨(dú)立的Dalvik虛擬機(jī)實(shí)例。Android發(fā)布初期,Google就表示其虛擬機(jī)Dalvik支持JNI編程方式,也就是第三方應(yīng)用完全可以使用JNI調(diào)用自己的C動(dòng)態(tài)庫,但Google官方并沒有明確表示支持開發(fā)者使用這種方法。終于在2009年6月,Google Android發(fā)布了NDK,它支持開發(fā)者使用C/C++語言開發(fā)Android程序。作為Android SDK的一個(gè)附加組件提供,開發(fā)者必須先安裝Android SDK方可使用NDK。NDK的目的是為了增加代碼的重用性及加快程序的運(yùn)行速度,這有利于開發(fā)者從其他系統(tǒng)上移植軟件到Android平臺(tái)。
1 Android NDK簡(jiǎn)介
在Android上應(yīng)用程序的開發(fā)大部分基于Java語言來實(shí)現(xiàn)。要使用C或是C++的程序或庫,就需要使用NDK來實(shí)現(xiàn)。NDK是Native Development Kit的簡(jiǎn)稱。它是一個(gè)工具集,集成了Android的交叉編譯環(huán)境,并提供了一套比較方便的Makefile,可以幫助開發(fā)者快速開發(fā)C或是
關(guān)鍵詞:Android;NDK;JNI;SDK;串口
Serial Communication Based Android Platform
JIN Zhi-yi, ZHANG Ji
(Vehicle College, Tongji University, Shanghai 201804, China)
Abstract: Serial communication is widely used in data communication, but the Android SDK uses the Java language as a designated third-party application development, which makes it difficult to achieve serial applications with C language. Although Google Android has released NDK (Native Development Kit)which supports the developer to develop Android program with C/C++ language,but the official technical guidance has been relatively brief. Through the development of serial communication under an Android platform as an application example, article gives a thoroughly description of the Android NDK development process that can help developers quickly build platforms.
Key words: Android; NDK; JNI; SDK; serial
Android是Google推出的基于Linux的開源手機(jī)操作系統(tǒng),是一個(gè)專門針對(duì)移動(dòng)設(shè)備設(shè)計(jì)的軟件平臺(tái),包括操作系統(tǒng)、中間件和一些關(guān)鍵應(yīng)用。它的軟件架構(gòu)包含四個(gè)層次,從高到低分別為應(yīng)用層、應(yīng)用框架層、系統(tǒng)運(yùn)行層和linux內(nèi)核層,如圖1所示。每一個(gè)Android應(yīng)用程序都在它自己的進(jìn)程中運(yùn)行,都擁有一個(gè)獨(dú)立的Dalvik虛擬機(jī)實(shí)例。Android發(fā)布初期,Google就表示其虛擬機(jī)Dalvik支持JNI編程方式,也就是第三方應(yīng)用完全可以使用JNI調(diào)用自己的C動(dòng)態(tài)庫,但Google官方并沒有明確表示支持開發(fā)者使用這種方法。終于在2009年6月,Google Android發(fā)布了NDK,它支持開發(fā)者使用C/C++語言開發(fā)Android程序。作為Android SDK的一個(gè)附加組件提供,開發(fā)者必須先安裝Android SDK方可使用NDK。NDK的目的是為了增加代碼的重用性及加快程序的運(yùn)行速度,這有利于開發(fā)者從其他系統(tǒng)上移植軟件到Android平臺(tái)。
1 Android NDK簡(jiǎn)介
在Android上應(yīng)用程序的開發(fā)大部分基于Java語言來實(shí)現(xiàn)。要使用C或是C++的程序或庫,就需要使用NDK來實(shí)現(xiàn)。NDK是Native Development Kit的簡(jiǎn)稱。它是一個(gè)工具集,集成了Android的交叉編譯環(huán)境,并提供了一套比較方便的Makefile,可以幫助開發(fā)者快速開發(fā)C或是