基于DragonBoard410C的智能管家
2017-10-16 17:33
267 查看
前段时间公司有一个基于高通410c开发板的智能管家项目,该项目的功能点如下:远程控制,烟雾检测, 开关控制。下面我将为大家一一讲解这些功能的实现。
远程控制主要是集成第三方的服务-Wilddog.WildDog采用用RXjava的订阅者/分发者的思想逻辑。
主要实现逻辑如下:
`
public static SyncReference getSyncref(String child){
SyncReference ref = WilddogSync.getInstance().getReference().child(child);
return ref;
}
烟雾检测逻辑:主要是接受板子端回传的数据。
开关控制主要逻辑:
这样我们就可以实时地了解家里的情况了!!!!
远程控制主要是集成第三方的服务-Wilddog.WildDog采用用RXjava的订阅者/分发者的思想逻辑。
主要实现逻辑如下:
`
public static SyncReference getSyncref(String child){
SyncReference ref = WilddogSync.getInstance().getReference().child(child);
return ref;
}
public static void setvalue(SyncReference ref, String key, String value) { if (ref!=null){ Command command = new Command(key, value); ref.setValue(command); } } public static String datalisterner( SyncReference ref,String key, String value) { final String[] result = {null}; if (ref!=null){ ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { result[0] =dataSnapshot.toString(); } @Override public void onCancelled(SyncError syncError) { } }); } return result[0]; }`
烟雾检测逻辑:主要是接受板子端回传的数据。
private void initListerner() { reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String key = dataSnapshot.child("finction").getValue().toString(); if (key.equals("value")) { String code = dataSnapshot.child("code").getValue().toString(); Log.i("index-of",code+""); String tem[] = code.split("XX"); Message message = new Message(); Bundle bundle = new Bundle(); Log.i("danpness",tem[0]); bundle.putString("tem", tem[0]); bundle.putString("bool", tem[1]); message.setData(bundle); handler.sendMessage(message); } } @Override public void onCancelled(SyncError syncError) { } }); }
开关控制主要逻辑:
private void initview() { seekBar = view.findViewById(R.id.progress); button = view.findViewById(R.id.open_bull); status_text = view.findViewById(R.id.value_status); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (status) { WildDogUtil.setvalue(reference, "open", "10"); button.setBackground(getResources().getDrawable(R.drawable.shape_button_not)); seekBar.setVisibility(View.VISIBLE); status = false; closeProgress(); } else { WildDogUtil.setvalue(reference, "close", "10"); seekBar.setVisibility(View.VISIBLE); button.setBackground(getResources().getDrawable(R.drawable.shape_button_open)); status = true; closeProgress(); } } }); } private void closeProgress() { handler.postDelayed(new Runnable() { @Override public void run() { seekBar.setVisibility(View.INVISIBLE); } }, 3000); }
这样我们就可以实时地了解家里的情况了!!!!
相关文章推荐
- 基于Dragonboard410c的智能音箱(二)
- 基于Dragon Board410c 的智能机器人预研-语音识别及定位
- 基于Dragonboard410c的智能音箱(一)
- 基于Dragonboard410c的智能音箱(三)
- 基于Dragon Board410c 的智能机器人预研-语音识别及定位
- 基于Dragonboard 410c设计的智能管家
- 基于DragonBoard410c的智能照明系统
- 基于dragonboard410c 智能门锁 开发
- 基于Dragonboard410c的智能音箱(五)
- 基于Dragonboard410c的智能音箱(四)
- 基于dragonboard 410c的智能魔镜设计(2)——数据库设计与实现
- 基于DragonBoard 410c 开发板的智能物料仓库调控系统之zigbee模块简介
- 基于Dragonboard 410c的智能小车(二)
- 基于DragonBoard 410c的智能门铃系列二之软件总框架
- 基于Dragonboard 410c 的智能仪表预研
- 基于DragonBoard 410c的家庭智能环保卫士——(6)kobuki位置信息传输及显示
- 基于dragonboard 410c的智能魔镜设计(5)——基于人脸的用户身份识别
- 基于DragonBoard 410c的家庭智能环保卫士----各数据获取接口封装
- 基于dragonboard 410c的智能魔镜设计(6)——人脸检测及身份识别启动模块封装
- 基于dragonboard410c的magic mirror demo展示