2020-08-20

1、测试
2 测试

初始化锁具

H5 获取到的服务id 获取服务成功! 3 at js/common.js:139
15:15:12.409 {"uuid":"00001800-0000-1000-8000-00805F9B34FB","isPrimary":true} at js/common.js:139
15:15:12.429 {"uuid":"00001801-0000-1000-8000-00805F9B34FB","isPrimary":true} at js/common.js:139
15:15:12.449 {"uuid":"6E400001-B5A3-F393-E0A9-E50E24DCCA9E","isPrimary":true} at js/common.js:139
H5 获取到的特征ID

android 中 用到的 服务id
public static UUID UUID_SERVICE = UUID.fromString("00001800-0000-1000-8000-00805f9b34fb");
public static UUID UUID_WRITE = UUID.fromString("00002a00-0000-1000-8000-00805f9b34fb");
public static UUID UUID_NOTIFY = UUID.fromString("6e400003-b5a3-f393-e0a9-e50e24dcca9e");

    /**
     * 初始化锁具
     */
  1-  private void initKey() {
        if (!isConn) {
            ToastUtils.show(this, "请连接蓝牙");

            return;
        }
        bLETools.initLock(0, "00330001000800001d25000000000000");


    }
2-    public void initLock(int type, String devCode) {
        boolean isT = false;
        if (type == 0) {
            isT = false;
        } else {
            isT = true;
        }

        List<Byte> bytes = BLEpLocProtocol.initLock(isT, devCode); (2-1)
        this.sendData(this.mainBleDevice, bytes);(2-2)
    }

 2-1   public static List<Byte> initLock(boolean type, String code) {
        List<Byte> byteList = new ArrayList();
        byteList.addAll(Plutilities.converDecStringToHexArray(code));
        int lockTypeNumber = type ? 2 : 1;
        byteList.add((byte)lockTypeNumber);
        List<Byte> newBytes = Plutilities.getFormatByte(byteList, 162);
        return newBytes;
    }

2-2


 

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。