基于DragonBord410C的智能遥控

前段时间公司有一个基于高通410c开发板的智能遥控项目,该项目的功能点如下:编码解析,编码学习,远程控制。下面我将为大家一一讲解这些功能的实现和APP的整体架构。

主界面详情:

APP主界面

APP的架构:

这里写图片描述

发送Code:

    public static void WriteData(String path, String content) {
        FileOutputStream fos = null;
        File file = new File(path);
        if (file.exists()) {
            try {
                fos = new FileOutputStream(file);
                Log.e("File", "FileWriter");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            byte[] array = content.getBytes();
            try {
                fos.write(array);
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                fos.flush();
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

    }

解析编码:

  public void onClick(View view) {
        switch (view.getId()) {
            case R.id.learn_mode:
                im.setVisibility(View.VISIBLE);
                message = new Message();
                cancle_learn.setVisibility(View.VISIBLE);
                cancle_learn.setEnabled(true);
                Config.WriteData(Config.LEARN_PATH, "1");
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        String a = Config.Redata(Config.STATUS);
                        if (a.startsWith("0")) {
                           /* Config.Redata(Config.LEARN_PATH);*/
                            irCode = new ET4007IRDevice().readlearncode();
                            if (irCode.isValid()) {
                                irString = irCode.toString();
                            } else {
                                irString = "ERROR";
                            }
                            Bundle bundle = new Bundle();
                            bundle.putString("key", irString);
                            message.setData(bundle);
                            handler.sendMessage(message);
                            timer.cancel();

                        }

                    }
                }, 0, 1000);


                break;
            case R.id.mode_send:
                Config.WriteData(Config.SEND_PATH, irString);
                break;
            case R.id.cancle_learn:
                im.setVisibility(View.INVISIBLE);
                cancle_learn.setVisibility(View.INVISIBLE);
                setEnabled(false);
                timer.cancel();
                break;
            case R.id.save_value:
                 DialogUtil.launchdialog(this);
                break;

        }

主要用到的SO:

public class RemoteCore {
    private static final String libSoName = "IRCore";
    static {
        try {
            System.loadLibrary(libSoName);
            Log.e("JNI",libSoName+" load finished");
        }catch (Exception e){
            Log.e("JNI"," exception "+e.getMessage());
        }

    }





    public native static IRCode ET4007Learn(byte[] codes);

    public native static byte[] readLearnIRCode();

    public native static int IRinit();
}

OK,大功告成,简单的智能遥控就实现啦!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值