对接EF06S

This commit is contained in:
qcl_123 2025-10-20 10:58:11 +08:00
parent 950d8f118c
commit 29c6a48868
43 changed files with 179 additions and 147 deletions

View File

@ -85,11 +85,13 @@
serviceId: "", serviceId: "",
write: "", write: "",
notify: "", notify: "",
height: "",
// cur_sex: 1, // cur_sex: 1,
// cur_age: 27, // cur_age: 27,
// show_info: false, // show_info: false,
// ageRange: [], // ageRange: [],
// ageIndex: 30, // ageIndex: 30,
unit: "kg",
textW: "", textW: "",
textH: "", textH: "",
send_err_count: 0, send_err_count: 0,
@ -319,6 +321,8 @@
uni.onBLECharacteristicValueChange(function(res) { uni.onBLECharacteristicValueChange(function(res) {
const raw = new Uint8Array(res.value); const raw = new Uint8Array(res.value);
let value = that.$tools.ab2hex(res.value, ""); let value = that.$tools.ab2hex(res.value, "");
let height = value.substring(3, 4) + value.substring(
30, 32)
cnt++ cnt++
console.log("value", value, cnt) console.log("value", value, cnt)
@ -343,6 +347,10 @@
} }
if (raw[0] == 0x5A && cnt > 1) { if (raw[0] == 0x5A && cnt > 1) {
//
that.unit = value.substring(2, 3) == 0 ? "kg" :
"lb"
// (, 100) // (, 100)
that.BLEResult.weight = ((raw[2] << 8) | raw[3]) / that.BLEResult.weight = ((raw[2] << 8) | raw[3]) /
100.0 100.0
@ -374,16 +382,25 @@
10.0; 10.0;
// (, ) // (, )
that.BLEResult.height = raw[15] that.textW = "您的体重是:" + that.BLEResult.weight + that.unit
that.textW = "您的体重是:" + that.BLEResult.weight +'kg' console.log("体重", that.BLEResult.weight, that.unit)
that.textH = "您的身高是:" + raw[15] + "cm"
console.log("体重", that.BLEResult.weight)
console.log("身高", raw[15])
if (raw.length == 18 && raw[17] == 0xA5) { if (raw.length == 18 && raw[17] == 0xA5) {
if (that.unit == 'kg') {
that.BLEResult.height = raw[15]
that.textH = "您的身高是:" + raw[15] + "cm"
} else {
let height0 = parseInt(height, 16) / 10
that.textH = "您的身高是:" + parseInt(height, 16) / 10 + "inch"
that.BLEResult.height = Math.round(height0 / 0.39)
}
that.BLEResult.ecode = that.macAddr that.BLEResult.ecode = that.macAddr
that.BLEResult.familyid = that.info.familyid that.BLEResult.familyid = that.info.familyid
that.BLEResult.weight = that.BLEResult.weight +'kg' that.BLEResult.weight = that.BLEResult.weight +
that.unit
setTimeout(function() {
that.handleGetMeasure() that.handleGetMeasure()
}, 200)
} }
} }
}) })
@ -461,7 +478,7 @@
that.$store.dispatch("getResult", { that.$store.dispatch("getResult", {
birthday: that.info.birthday, birthday: that.info.birthday,
familyid: that.info.familyid, familyid: that.info.familyid,
height: that.height ? that.height : that.info.height, height: that.BLEResult.height ? that.BLEResult.height : that.info.height,
sex: that.info.sex, sex: that.info.sex,
}); });
} else { } else {

View File

@ -22,6 +22,7 @@ export default {
getResult({ getResult({
commit commit
}, account) { }, account) {
console.log("1111111", account)
return model.getResult(account).then((res) => { return model.getResult(account).then((res) => {
console.log("报告", res) console.log("报告", res)
if (res.code == 0) { if (res.code == 0) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -154,11 +154,13 @@ var _default = {
serviceId: "", serviceId: "",
write: "", write: "",
notify: "", notify: "",
height: "",
// cur_sex: 1, // cur_sex: 1,
// cur_age: 27, // cur_age: 27,
// show_info: false, // show_info: false,
// ageRange: [], // ageRange: [],
// ageIndex: 30, // ageIndex: 30,
unit: "kg",
textW: "", textW: "",
textH: "", textH: "",
send_err_count: 0, send_err_count: 0,
@ -390,6 +392,7 @@ var _default = {
uni.onBLECharacteristicValueChange(function (res) { uni.onBLECharacteristicValueChange(function (res) {
var raw = new Uint8Array(res.value); var raw = new Uint8Array(res.value);
var value = that.$tools.ab2hex(res.value, ""); var value = that.$tools.ab2hex(res.value, "");
var height = value.substring(3, 4) + value.substring(30, 32);
cnt++; cnt++;
console.log("value", value, cnt); console.log("value", value, cnt);
if (raw[0] == 0x55 && raw[1] == 0xAA) { if (raw[0] == 0x55 && raw[1] == 0xAA) {
@ -412,6 +415,9 @@ var _default = {
return; return;
} }
if (raw[0] == 0x5A && cnt > 1) { if (raw[0] == 0x5A && cnt > 1) {
// 单位
that.unit = value.substring(2, 3) == 0 ? "kg" : "lb";
// 体重(高低位组合, 实际值的100倍) // 体重(高低位组合, 实际值的100倍)
that.BLEResult.weight = (raw[2] << 8 | raw[3]) / 100.0; that.BLEResult.weight = (raw[2] << 8 | raw[3]) / 100.0;
if (that.BLEResult.weight < 1) { if (that.BLEResult.weight < 1) {
@ -436,16 +442,23 @@ var _default = {
that.BLEResult.bmi = (raw[14] << 8 | raw[16]) / 10.0; that.BLEResult.bmi = (raw[14] << 8 | raw[16]) / 10.0;
// 身高(高低位组合, 厘米) // 身高(高低位组合, 厘米)
that.BLEResult.height = raw[15]; that.textW = "您的体重是:" + that.BLEResult.weight + that.unit;
that.textW = "您的体重是:" + that.BLEResult.weight + 'kg'; console.log("体重", that.BLEResult.weight, that.unit);
that.textH = "您的身高是:" + raw[15] + "cm";
console.log("体重", that.BLEResult.weight);
console.log("身高", raw[15]);
if (raw.length == 18 && raw[17] == 0xA5) { if (raw.length == 18 && raw[17] == 0xA5) {
if (that.unit == 'kg') {
that.BLEResult.height = raw[15];
that.textH = "您的身高是:" + raw[15] + "cm";
} else {
var height0 = parseInt(height, 16) / 10;
that.textH = "您的身高是:" + parseInt(height, 16) / 10 + "inch";
that.BLEResult.height = Math.round(height0 / 0.39);
}
that.BLEResult.ecode = that.macAddr; that.BLEResult.ecode = that.macAddr;
that.BLEResult.familyid = that.info.familyid; that.BLEResult.familyid = that.info.familyid;
that.BLEResult.weight = that.BLEResult.weight + 'kg'; that.BLEResult.weight = that.BLEResult.weight + that.unit;
setTimeout(function () {
that.handleGetMeasure(); that.handleGetMeasure();
}, 200);
} }
} }
}); });
@ -523,7 +536,7 @@ var _default = {
that.$store.dispatch("getResult", { that.$store.dispatch("getResult", {
birthday: that.info.birthday, birthday: that.info.birthday,
familyid: that.info.familyid, familyid: that.info.familyid,
height: that.height ? that.height : that.info.height, height: that.BLEResult.height ? that.BLEResult.height : that.info.height,
sex: that.info.sex sex: that.info.sex
}); });
} else { } else {

View File

@ -11122,6 +11122,7 @@ var _default = (_getUserInfo$getResul = {
// 获取称重结果 // 获取称重结果
getResult: function getResult(_ref2, account) { getResult: function getResult(_ref2, account) {
var commit = _ref2.commit; var commit = _ref2.commit;
console.log("1111111", account);
return _model.default.getResult(account).then(function (res) { return _model.default.getResult(account).then(function (res) {
console.log("报告", res); console.log("报告", res);
if (res.code == 0) { if (res.code == 0) {