function N(l, a) {
c("ymBleWriteLongBuf", s, n, o, a.buf),
function() {
if (!e.CFG_MAC) return m = 0, 0;
let t = e.CFG_MAC.split(":");
m = parseInt(t[5], 16) + parseInt(t[4], 16) + parseInt(t[3], 16) + parseInt(t[2], 16) + parseInt(t[1], 16) + parseInt(t[0], 16), m &= 255, u = parseInt(t[5], 16) + parseInt(t[4], 16) + 10, u &= 65535, d = parseInt(t[5], 16) + 11, d <<= 8, d |= parseInt(t[4], 16), d &= 65535, c("ymBleGetLongBufkey", e.CFG_MAC, m, u, d)
}();
let B = function(e, t) {
let i = [],
s = 0;
e ? (i[s++] = 236, i[s++] = 237, y = 236, h = 237) : (i[s++] = 147, i[s++] = 146, y = 147, h = 146), s += 2;
for (let e = 0; e < t.length; e++) i[s + e] = t[e];
s += t.length;
const n = C(t);
i[s++] = n >> 8 & 255, i[s++] = 255 & n, i[2] = s - 6 >> 8 & 255, i[3] = s - 6 & 255;
for (let e = 0; e < i.length; e++) i[e] ^= m;
return c("ymBleCreateLongBuf", n, i), i
}(l, a.buf),
I = B;
if (r = 1, v = 0, f = 0, B.length > 20)
for (let e = 0; e < B.length; e += 20) e + 20 >= B.length ? (I = B.slice(e, B.length), g({
deviceId: s,
serviceId: n,
characteristicId: o,
value: new Int8Array(I).buffer,
success: e => {
c("ymBleWriteLongBuf success 1", a), t.ymEventOn({
event: "devrecvbuf",
timeout: a.timeout,
success(e) {
wx.stopBluetoothDevicesDiscovery({}), c("ymBleWriteLongBuf 1 devciceId=", e), r = 0, a.success(e)
},
fail(e) {
i = 0, r = 0, "请求响应超时" === e.msg && (e.msg = "设备响应超时"), a.fail(e)
}
})
},
fail: e => {
c("ymBleWriteLongBuf fail 1", a), i = 0, r = 0, a.fail(e)
}
})) : (I = B.slice(e, e + 20), g({
deviceId: s,
serviceId: n,
characteristicId: o,
value: new Int8Array(I).buffer,
success: e => {},
fail: e => (r = 0, i = 0, c("ymBleWriteLongBuf fail 2", a), a.fail(e))
}));
else I = B, g({
deviceId: s,
serviceId: n,
characteristicId: o,
value: new Int8Array(I).buffer,
success: e => {
c("ymBleWriteLongBuf success 3", a), t.ymEventOn({
event: "devrecvbuf",
timeout: a.timeout,
success(e) {
wx.stopBluetoothDevicesDiscovery({}), c("ymBleWriteLongBuf 3 ymEventOn success", e), r = 0, a.success(e)
},
fail(e) {
c("ymBleWriteLongBuf 3 ymEventOn fail", e), i = 0, r = 0, "请求响应超时" === e.msg && (e.msg = "设备响应超时"), a.fail(e)
}
})
},
fail: e => {
c("ymBleWriteLongBuf fail 3", a), r = 0, i = 0, a.fail(e)
}
})
}