package cn.com.farsight.fp;
import cn.com.farsight.fp.R;
import cn.com.farsight.fp.OnScreenHint;
import com.farsight.service.BeepService;
import com.farsight.service.KeyService;
import com.farsight.service.LedService;
import com.farsight.service.RtcService;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.Intent;
import android.hardware.SensorListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class myActivity extends Activity {
private OnScreenHint mOnScreenHint;
SensorManager mv;
TextView text1;
TextView text2;
ProgressBar bar1;
ProgressBar bar2;
Button timesend;
Toast toast;
TextView date;
TextView timeview;
TextView xx;
TextView yy;
TextView zz;
static RtcService rtc_srv;
opView mvop;
int k =100;
final String tag = "com.New";
ImageButton btn0, btn1, btn2, btn3,btn5;
ImageView btn4;
static LedService led_srv;
static KeyService key_srv;
static BeepService beep_srv;
static boolean beep = true;
boolean[] iflag =new boolean[4];
static int key;
Builder alertDialog;
int[] timeread = new int[6];
int[] msgtran = new int[6];
/*时间处理线程*/
Handler timehander = new Handler(){
public void handleMessage(Message msg){
msgtran = (int[])msg.obj;
String time_data;
if(msgtran[0]<10)
{
date.setText("200"+String.valueOf(msgtran[0])+"年"+String.valueOf(msgtran[1])+"月"+String.valueOf(msgtran[2])+"日");
}
else
{
date.setText("20"+String.valueOf(msgtran[0])+"年"+String.valueOf(msgtran[1])+"月"+String.valueOf(msgtran[2])+"日");
}
if(msgtran[3]<10)
{
time_data="0"+msgtran[3];
}
else
{
time_data=String.valueOf(msgtran[3]);
}
if(msgtran[4]<10)
{
time_data=time_data+":0"+msgtran[4];
}
else
{
time_data=time_data+":"+msgtran[4];
}
if(msgtran[5]<10)
{
time_data=time_data+":0"+msgtran[5];
}
else
{
time_data=time_data+":"+msgtran[5];
}
timeview.setText(time_data);
timehander.post(dodatatime);
}
};
/*获得时间值*/
Runnable dodatatime = new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
timeread[0] = rtc_srv.get_time(0);
timeread[1] = rtc_srv.get_time(1);
timeread[2] = rtc_srv.get_time(2);
timeread[3] = rtc_srv.get_time(3);
timeread[4] = rtc_srv.get_time(4);
timeread[5] = rtc_srv.get_time(5);
Log.e("main", timeread[0]+"");
Message msg = timehander.obtainMessage();
msg.obj = timeread;
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
timehander.sendMessage(msg);
}
};
/*按键检测处理*/
Handler handler = new Handler() {
public void handleMessage(Message msg) {
if (msg.arg1 == 1) {
btn4.setImageResource(R.drawable.up);
}
else if (msg.arg1 == 2) {
btn4.setImageResource(R.drawable.light);
}
else if (msg.arg1 == 3) {
btn4.setImageResource(R.drawable.right);
}
else if (msg.arg1 == 4) {
btn4.setImageResource(R.drawable.down);
}
else if (msg.arg1 == 5) {
btn4.setImageResource(R.drawable.refresh);
}
else if (msg.arg1 == 6) {
btn4.setImageResource(R.drawable.close);
}
else {
btn4.setImageResource(R.drawable.back);
}
handler.post(doUpDataButton);
}
};
/*获得键值*/
Runnable doUpDataButton = new Runnable() {
@Override
public void run() {
key = key_srv.getKeyValue();
Message msg = handler.obtainMessage();
msg.arg1 = key;
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
handler.sendMessage(msg);
}
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
rtc_srv = new RtcService();
iflag[0]=true;
iflag[1]=true;
iflag[2]=true;
iflag[3]=true;
text1=(TextView)findViewById(R.id.textView2);
text2=(TextView)findViewById(R.id.textView4);
bar1 = (ProgressBar)findViewById(R.id.progressBar1);
bar1.setMax(4096);
bar1.setProgress(1);
bar2 = (ProgressBar)findViewById(R.id.progressBar2);
bar2.setMax(15);
bar2.setProgress(1);
mv= (SensorManager)getSystemService(Context.SENSOR_SERVICE);//获取传感器服务
xx =(TextView)findViewById(R.id.textView14);
yy =(TextView)findViewById(R.id.textView15);
zz=(TextView)findViewById(R.id.textView16);
mvop = (opView)findViewById(R.id.mainView);
date = (TextView)findViewById(R.id.textView11);
timeview =(TextView)findViewById(R.id.textView12);
timesend =(Button)findViewById(R.id.button1);
/*监听设置时间按钮*/
timesend.setOnClickListener(
new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent(myActivity.this,send.class);
myActivity.this.startActivity(intent);//转到send界面
}
}
);
led_srv = new LedService();//获得led控制类对象
key_srv = new KeyService();//获得KEY控制类对象
beep_srv = new BeepService();//获得蜂鸣器控制类对象
btn0 = (ImageButton)this.findViewById(R.id.imageButton2);
btn1 = (ImageButton)this.findViewById(R.id.imageButton3);
btn2 = (ImageButton)this.findViewById(R.id.imageButton4);
btn3 = (ImageButton)this.findViewById(R.id.imageButton5);
btn4 = (ImageView)findViewById(R.id.imageView3);
btn4.setClickable(false);
btn4.setFocusable(false);
btn4.setImageResource(R.drawable.back);
btn5 = (ImageButton)findViewById(R.id.imageButton1);
Thread threadButton = new Thread(doUpDataButton, "threadButton");//创建按键监听线程
handler.post(threadButton);
Thread threadtime = new Thread(dodatatime,"threadtime");//创建时间处理线程
timehander.post(threadtime);
/*监控并处理LED1*/
this.btn0.setOnClickListener(new OnClickListener(){
public void onClick(View v){
String title = new String();
if (iflag[0]) {
mOnScreenHint = OnScreenHint.makeText(myActivity.this, "LED1_ON");
mOnScreenHint.show();
title = led_srv.set_on(1);
iflag[0] = false;
btn0.setImageResource(R.drawable.bulb_on);
} else {
mOnScreenHint = OnScreenHint.makeText(myActivity.this, "LED1_OFF");
mOnScreenHint.show();
title = led_srv.set_off(1);
iflag[0] = true;
btn0.setImageResource(R.drawable.bulb_off);
}
}
});
/*监控处理LED2*/
this.btn1.setOnClickListener(new OnClickListener(){
public void onClick(View v){
String title = new String();
if (iflag[1]) {
mOnScreenHint = OnScreenHint.makeText(myActivity.this, "LED2_ON");
mOnScreenHint.show();
title = led_srv.set_on(2);
if
没有合适的资源?快使用搜索试试~ 我知道了~
platform-test.rar_//www.fptest.com.cn_indicatelsr_s5pc100
共79个文件
class:35个
png:18个
xml:10个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 160 浏览量
2022-09-20
19:49:04
上传
评论
收藏 593KB RAR 举报
温馨提示
S5PC100 Cortex-A8 开发板 板级资源平台测试 应用层源代码
资源推荐
资源详情
资源评论
收起资源包目录
platform-test.rar (79个子文件)
platform-test
bin
classes.dex 27KB
maintest2.apk 101KB
com
farsight
service
RtcService.class 2KB
LedService.class 1KB
KeyService.class 860B
BeepService.class 983B
cn
com
farsight
fp
send$4.class 871B
send.class 2KB
OnScreenHint$1.class 947B
myActivity$3.class 1KB
myActivity$9.class 2KB
R$layout.class 460B
send$1.class 961B
myActivity$8.class 2KB
R$id.class 2KB
R$drawable.class 860B
send$3.class 1KB
opView.class 2KB
R$dimen.class 886B
R$attr.class 340B
myActivity$6.class 1004B
R.class 721B
myActivity$7.class 2KB
myActivity$10.class 2KB
myActivity$5.class 3KB
myActivity$2.class 2KB
R$string.class 649B
R$color.class 593B
myActivity$4.class 1KB
OnScreenHint.class 5KB
R$anim.class 447B
myActivity.class 5KB
myActivity$11.class 2KB
OnScreenHint$2.class 631B
R$style.class 637B
send$2.class 751B
myActivity$1.class 2KB
resources.ap_ 86KB
res
drawable-ldpi
icon.png 2KB
drawable-hdpi
android.png 10KB
icon.png 4KB
logo.png 57KB
values
colors.xml 367B
strings.xml 467B
styles.xml 2KB
dimens.xml 1KB
drawable-mdpi
on_screen_hint_frame.9.png 4KB
refresh.png 73KB
right.png 4KB
back.png 52KB
up.png 4KB
alert_on.png 58KB
close.png 48KB
light.png 4KB
icon.png 3KB
bulb_off.png 46KB
down.png 4KB
bulb_on.png 53KB
small.png 920B
alert_off.png 53KB
anim
on_screen_hint_enter.xml 879B
on_screen_hint_exit.xml 879B
layout
send.xml 3KB
on_screen_hint.xml 1KB
main.xml 8KB
assets
default.properties 362B
gen
cn
com
farsight
fp
R.java 7KB
proguard.cfg 1KB
src
com
farsight
service
RtcService.java 2KB
LedService.java 1023B
BeepService.java 740B
KeyService.java 561B
cn
com
farsight
fp
send.java 3KB
opView.java 1KB
OnScreenHint.java 7KB
myActivity.java 14KB
.project 845B
.classpath 280B
AndroidManifest.xml 802B
共 79 条
- 1
资源评论
周楷雯
- 粉丝: 78
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功