嵌入式系统系统应用及论文.docx
《嵌入式系统系统应用及论文.docx》由会员分享,可在线阅读,更多相关《嵌入式系统系统应用及论文.docx(27页珍藏版)》请在冰豆网上搜索。
嵌入式系统系统应用及论文
《嵌入式系统及应用》论文(设计)
题目:
基于Android的手机查看助手
姓名:
学院:
理学院
专业:
网络工程
班级:
09级一班
学号:
目录
摘要……………………………………………………………………………………………1
关键词…………………………………………………………………………………………1
1系统功能……………………………………………………………………………······1
1.1判断显示信息……………………………………………………………………··1
1.2查看系统信息……………………………………………………………………···3
1.2.1操作系统版本………………………………………………………………5
1.2.2系统信息……………………………………………………………………·6
1.2.3手机网络的运营商信息………………………………………………………6
1.3查看硬件信息……………………………………………………………………····7
1.3.1CPU信息……………………………………………………………………9
1.3.2内存信息……………………………………………………………………10
1.3.3硬盘信息……………………………………………………………………10
1.3.4网络信息……………………………………………………………………10
1.3.5屏幕信息……………………………………………………………………11
1.4查看软件信息……………………………………………………………………·····11
1.5查看进程信息……………………………………………………………………······12
1.6查看文件内容……………………………………………………………………····16
2硬件平台……………………………………………………………………············19
3软件平台……………………………………………………………………············19
4系统测试……………………………………………………………………············19
4.1系统整体测试……………………………………………………………………···19
基于Android的手机查看助手
网络工程专业学生学生姓名:
葛启标
摘要:
基于Android的手机查看助手是一款工具性的应用软件,使用搭建好Android环境的eclipse进行程序的编写,在Android模拟器上进行测试,最终能下载到Android的手机上进行使用。
其主要功能是查看系统信息硬件信息软件信息进程信息和文件内容。
硬件平台主要是Android2.2系统的智能手机和个人计算机。
软件平台主要是eclipse和Android-sdk.
关键词:
eclipse;Android;手机查看助手;应用软件。
1系统功能
1.1判断显示信息代码如下:
packageorg.android;
importjava.io.File;
importjava.io.InputStream;
importjava.util.Scanner;
publicclassCMDExecute{
publicsynchronizedStringBufferrun(String[]cmd,Stringworkdirectory)
throwsException{
StringBufferresult=newStringBuffer();
try{
ProcessBuilderbuilder=newProcessBuilder(cmd);
if(workdirectory!
=null)
builder.directory(newFile(workdirectory));
builder.redirectErrorStream(true);
Processprocess=builder.start();
InputStreamin=process.getInputStream();
Scannerscan=newScanner(in);
while(scan.hasNext()){
result.append(scan.next()).append("\t");
}
in.close();
}catch(Exceptione){
}
returnresult;
}
}
privatevoidsetInfo(){
if(_id==Preferencesutil.VER_INFO){
ShowInfo.this.setTitle("系统信息");
title.setText(_name);
info.setText(fetch_version_info());
}elseif(_id==Preferencesutil.SystemProperty){
ShowInfo.this.setTitle("系统信息");
title.setText(_name);
info.setText(getSystemProperty());
}elseif(_id==Preferencesutil.TEL_STATUS){
ShowInfo.this.setTitle("系统信息");
title.setText(_name);
info.setText(fetch_tel_status(this));
}elseif(_id==Preferencesutil.CPU_INFO){
ShowInfo.this.setTitle("硬件信息");
title.setText(_name);
info.setText(fetch_cpu_info());
}elseif(_id==Preferencesutil.MEMORY_INFO){
ShowInfo.this.setTitle("硬件信息");
title.setText(_name);
info.setText(getMemoryInfo(this));
}elseif(_id==Preferencesutil.DISK_INFO){
ShowInfo.this.setTitle("硬件信息");
title.setText(_name);
info.setText(fetch_disk_info());
}elseif(_id==Preferencesutil.NET_INFO){
ShowInfo.this.setTitle("硬件信息");
title.setText(_name);
info.setText(fetch_netcfg_info());
}elseif(_id==Preferencesutil.SHOW_INFO){
ShowInfo.this.setTitle("硬件信息");
title.setText(_name);
info.setText(getDisplayMetrics(this));
}elseif(_id==Preferencesutil.RUNING_SERVICES){
ShowInfo.this.setTitle("运行信息");
title.setText(_name);
info.setText(getRunningServicesInfo(this));
}elseif(_id==Preferencesutil.RUNING_TASK){
ShowInfo.this.setTitle("运行信息");
title.setText(_name);
info.setText(getRunningTaskInfo(this));
}elseif(_id==Preferencesutil.RUNING_PROGRESS_INFO){
ShowInfo.this.setTitle("运行信息");
title.setText(_name);
info.setText(fetch_process_info());
}
}
1.2查看系统信息
查看设备系统的版本,运营商及其系统的信息!
packageorg.android;
importjava.util.ArrayList;
importjava.util.HashMap;
importjava.util.List;
importjava.util.Map;
importandroid.app.Activity;
importandroid.content.Intent;
importandroid.os.Bundle;
importandroid.view.View;
importandroid.widget.AdapterView;
importandroid.widget.AdapterView.OnItemClickListener;
importandroid.widget.ListView;
importandroid.widget.SimpleAdapter;
publicclassSystemUtilextendsActivity{
privateListViewsystemList=null;
privateList
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.system);
setTitle("系统信息");
systemList=(ListView)findViewById(R.id.systemlist);
refreshListItems();
}
privatevoidrefreshListItems(){
list=buildListForSimpleAdapter();
SimpleAdapternotes=newSimpleAdapter(this,list,
R.layout.system_row,newString[]{"name","desc"},
newint[]{R.id.name,R.id.desc});
systemList.setAdapter(notes);
systemList.setOnItemClickListener(newOnItemClickListenerImpl());
systemList.setSelection(0);
}
privateclassOnItemClickListenerImplimplementsOnItemClickListener{
@Override
publicvoidonItemClick(AdapterView
>parent,Viewv,intposition,
longid){
Intentintent=newIntent();
Bundleinfo=newBundle();
Mapmap=list.get(position);
info.putInt("id",(Integer)map.get("id"));
info.putString("name",(String)map.get("name"));
info.putString("desc",(String)map.get("desc"));
info.putInt("position",position);
intent.putExtra("android.intent.extra.info",info);
intent.setClass(SystemUtil.this,ShowInfo.class);
startActivityForResult(intent,0);
}
}
privateList
List
3);
Mapmap=newHashMap();
map.put("id",Preferencesutil.VER_INFO);
map.put("name","操作系统版本");map.put("desc","读取/proc/version信息");
allList.add(map);
map=newHashMap();
map.put("id",Preferencesutil.SystemProperty);
map.put("name","系统信息");map.put("desc","查看设备的系统信息");
allList.add(map);
map=newHashMap();
map.put("id",Preferencesutil.TEL_STATUS);
map.put("name","运营商信息");
map.put("desc","手机网络的运营商信息");
allList.add(map);
returnallList;
}
}
1.2.1操作系统版本
读取文件夹proc下的version文件信息。
代码如下:
publicstaticStringfetch_version_info()//操作系统版本信息
{StringBufferresult=null;
CMDExecutecmdexe=newCMDExecute();
try{
String[]args={"/system/bin/cat","/proc/version"};
result=cmdexe.run(args,"/system/bin/");
}catch(Exceptione){
}
returnresult.toString();
}
1.2.2系统信息
通过系统方法获取系统信息,保存到buffer,在将其返回到显示方法里显示。
privatestaticStringinitProperty(Stringdescription,StringpropertyStr){
if(buffer==null){
buffer=newStringBuffer();
}
buffer.append(description).append(":
");
buffer.append(System.getProperty(propertyStr)).append("\n");
returnbuffer.toString();
}
publicstaticStringgetSystemProperty(){//系统信息
buffer=newStringBuffer();
initProperty("java.vendor.url","java.vendor.url");
initProperty("java.class.path","java.class.path");
initProperty("user.home","user.home");
initProperty("java.class.version","java.class.version");
initProperty("os.version","os.version");
initProperty("java.vendor","java.vendor");
initProperty("user.dir","user.dir");
initProperty("user.timezone","user.timezone");
initProperty("path.separator","path.separator");
initProperty("os.name","os.name");
initProperty("os.arch","os.arch");
initProperty("line.separator","line.separator");
initProperty("file.separator","file.separator");
initProperty("user.name","user.name");
initProperty("java.version","java.version");
initProperty("java.home","java.home");
returnbuffer.toString();
}
1.2.3手机网络的运营商信息
publicstaticStringfetch_tel_status(Contextcontext){//运营商信息
StringBufferresult=newStringBuffer();
finalTelephonyManagertm=(TelephonyManager)context
.getSystemService(Context.TELEPHONY_SERVICE);
Stringstr="";
str+="DeviceId(IMEI)="+tm.getDeviceId()+"\n";
str+="DeviceSoftwareVersion="+tm.getDeviceSoftwareVersion()
+"\n";
str+="LineNumber="+tm.getLine1Number()+"\n";
str+="NetworkCountryIso="+tm.getNetworkCountryIso()+"\n";
str+="NetworkOpreator="+tm.getNetworkOperator()+"\n";
str+="NetworkOpreatorName="+tm.getNetworkOperatorName()+"\n";
str+="NetworkType="+tm.getNetworkType()+"\n";
str+="PhoneTyp="+tm.getPhoneType()+"\n";
str+="SimCountryIso="+tm.getSimCountryIso()+"\n";
str+="SimOpreatorName="+tm.getSimOperatorName()+"\n";
str+="SimSerialNumber="+tm.getSimSerialNumber()+"\n";
str+="SimState="+tm.getSimState()+"\n";
str+="SubscriberId(IMSI)="+tm.getSubscriberId()+"\n";
str+="VoiceMailNumber="+tm.getVoiceMailNumber()+"\n";
intmcc=context.getResources().getConfiguration().mcc;
intmnc=context.getResources().getConfiguration().mnc;
str+="IMSIMCC(MobileCountryCode):
"+String.valueOf(mcc)+"\n";
str+="IMSIMNC(MobileCountryCode):
"+String.valueOf(mnc)+"\n";
result.append(str);
returnresult.toString();
}
1.3查看硬件信息
packageorg.android;
importjava.util.ArrayList;
importjava.util.HashMap;
importjava.util.List;
importjava.util.Map;
importandroid.app.Activity;
importandroid.content.Intent;
importandroid.os.Bundle;
importandroid.view.View;
importandroid.widget.AdapterView;
importandroid.widget.ListView;
importandroid.widget.SimpleAdapter;
importandroid.widget.AdapterView.OnItemClickListener;
publicclassHardwareextendsActivity{
privateListViewhardList=null;
privateList>list=null;
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCre