V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
TNOK
V2EX  ›  程序员

如何拯救只能微信小程序同步时间的闹钟?求小程序开发进

  •  
  •   TNOK · 21 小时 40 分钟前 · 218 次点击
    好久之前朋友送了一个闹钟音箱,只能使用小程序通过蓝牙同步时间,以及设置闹钟等功能,小程序叫 ZGO 正港,现在尝试多次使用小程序无法连接上设备。
    想着小程序不过也是向设备发送一段数据同步的,尝试自己通过调试软件发送,解包了小程序,其中有如下跟时间相关的代码:
    var n = (new Date).getFullYear(),
    a = (new Date).getMonth() + 1,
    o = (new Date).getDate(),
    i = (new Date).getHours(),
    c = (new Date).getMinutes(),
    s = (new Date).getSeconds(),
    l = new ArrayBuffer(11),
    u = new DataView(l);
    u.setUint8(0, 105), u.setUint8(1, 150), u.setUint8(2, 8), u.setUint8(3, 2), u.setUint8(4, (65280 & n) >> 8), u.setUint8(5, 255 & n), u.setUint8(6, a), u.setUint8(7, o), u.setUint8(8, i), u.setUint8(9, c), u.setUint8(10, s);

    发送的部分:
    write: function(t) {
    var a = this;
    0 != a.globalData.isWriteFinsh && (a.globalData.isWriteFinsh = 0, wx.writeBLECharacteristicValue({
    deviceId: a.globalData.deviceId,
    serviceId: a.globalData.serviceUUID,
    characteristicId: a.globalData.writeCharacteristicUUID,
    value: t,
    success: function(a) {
    console.log("发送的数据:" + e.arrayBuffer2HexString(t)), console.log("发送成功")
    },
    fail: function(e) {},
    complete: function(e) {
    a.globalData.isWriteFinsh = 1
    }
    }))
    }

    询问了 GPT ,尝试根据代码拼的格式自己 write 给闹钟,在手机使用调试软件发送:6996080207E902180F1E2D ( 2025 年 2 月 24 日 15:30:45 )。
    没有反应,几个能 write 的 UUID 都尝试了,也试了随便写入点什么,设备均没有反应,有一个 UUID 在写入后能读取相同的内容,但是设备没有反应,求问是发送的格式不对还是什么。
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3121 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 13:38 · PVG 21:38 · LAX 05:38 · JFK 08:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.