对接EF06S
This commit is contained in:
parent
950d8f118c
commit
29c6a48868
|
|
@ -85,11 +85,13 @@
|
|||
serviceId: "",
|
||||
write: "",
|
||||
notify: "",
|
||||
height: "",
|
||||
// cur_sex: 1,
|
||||
// cur_age: 27,
|
||||
// show_info: false,
|
||||
// ageRange: [],
|
||||
// ageIndex: 30,
|
||||
unit: "kg",
|
||||
textW: "",
|
||||
textH: "",
|
||||
send_err_count: 0,
|
||||
|
|
@ -319,6 +321,8 @@
|
|||
uni.onBLECharacteristicValueChange(function(res) {
|
||||
const raw = new Uint8Array(res.value);
|
||||
let value = that.$tools.ab2hex(res.value, "");
|
||||
let height = value.substring(3, 4) + value.substring(
|
||||
30, 32)
|
||||
cnt++
|
||||
console.log("value", value, cnt)
|
||||
|
||||
|
|
@ -343,6 +347,10 @@
|
|||
}
|
||||
|
||||
if (raw[0] == 0x5A && cnt > 1) {
|
||||
// 单位
|
||||
that.unit = value.substring(2, 3) == 0 ? "kg" :
|
||||
"lb"
|
||||
|
||||
// 体重(高低位组合, 实际值的100倍)
|
||||
that.BLEResult.weight = ((raw[2] << 8) | raw[3]) /
|
||||
100.0
|
||||
|
|
@ -374,16 +382,25 @@
|
|||
10.0;
|
||||
|
||||
// 身高(高低位组合, 厘米)
|
||||
that.BLEResult.height = raw[15]
|
||||
that.textW = "您的体重是:" + that.BLEResult.weight +'kg'
|
||||
that.textH = "您的身高是:" + raw[15] + "cm"
|
||||
console.log("体重", that.BLEResult.weight)
|
||||
console.log("身高", raw[15])
|
||||
that.textW = "您的体重是:" + that.BLEResult.weight + that.unit
|
||||
console.log("体重", that.BLEResult.weight, that.unit)
|
||||
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.familyid = that.info.familyid
|
||||
that.BLEResult.weight = that.BLEResult.weight +'kg'
|
||||
that.BLEResult.weight = that.BLEResult.weight +
|
||||
that.unit
|
||||
setTimeout(function() {
|
||||
that.handleGetMeasure()
|
||||
}, 200)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -461,7 +478,7 @@
|
|||
that.$store.dispatch("getResult", {
|
||||
birthday: that.info.birthday,
|
||||
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,
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export default {
|
|||
getResult({
|
||||
commit
|
||||
}, account) {
|
||||
console.log("1111111", account)
|
||||
return model.getResult(account).then((res) => {
|
||||
console.log("报告", res)
|
||||
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
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
|
|
@ -154,11 +154,13 @@ var _default = {
|
|||
serviceId: "",
|
||||
write: "",
|
||||
notify: "",
|
||||
height: "",
|
||||
// cur_sex: 1,
|
||||
// cur_age: 27,
|
||||
// show_info: false,
|
||||
// ageRange: [],
|
||||
// ageIndex: 30,
|
||||
unit: "kg",
|
||||
textW: "",
|
||||
textH: "",
|
||||
send_err_count: 0,
|
||||
|
|
@ -390,6 +392,7 @@ var _default = {
|
|||
uni.onBLECharacteristicValueChange(function (res) {
|
||||
var raw = new Uint8Array(res.value);
|
||||
var value = that.$tools.ab2hex(res.value, "");
|
||||
var height = value.substring(3, 4) + value.substring(30, 32);
|
||||
cnt++;
|
||||
console.log("value", value, cnt);
|
||||
if (raw[0] == 0x55 && raw[1] == 0xAA) {
|
||||
|
|
@ -412,6 +415,9 @@ var _default = {
|
|||
return;
|
||||
}
|
||||
if (raw[0] == 0x5A && cnt > 1) {
|
||||
// 单位
|
||||
that.unit = value.substring(2, 3) == 0 ? "kg" : "lb";
|
||||
|
||||
// 体重(高低位组合, 实际值的100倍)
|
||||
that.BLEResult.weight = (raw[2] << 8 | raw[3]) / 100.0;
|
||||
if (that.BLEResult.weight < 1) {
|
||||
|
|
@ -436,16 +442,23 @@ var _default = {
|
|||
that.BLEResult.bmi = (raw[14] << 8 | raw[16]) / 10.0;
|
||||
|
||||
// 身高(高低位组合, 厘米)
|
||||
that.BLEResult.height = raw[15];
|
||||
that.textW = "您的体重是:" + that.BLEResult.weight + 'kg';
|
||||
that.textH = "您的身高是:" + raw[15] + "cm";
|
||||
console.log("体重", that.BLEResult.weight);
|
||||
console.log("身高", raw[15]);
|
||||
that.textW = "您的体重是:" + that.BLEResult.weight + that.unit;
|
||||
console.log("体重", that.BLEResult.weight, that.unit);
|
||||
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.familyid = that.info.familyid;
|
||||
that.BLEResult.weight = that.BLEResult.weight + 'kg';
|
||||
that.BLEResult.weight = that.BLEResult.weight + that.unit;
|
||||
setTimeout(function () {
|
||||
that.handleGetMeasure();
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -523,7 +536,7 @@ var _default = {
|
|||
that.$store.dispatch("getResult", {
|
||||
birthday: that.info.birthday,
|
||||
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
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -11122,6 +11122,7 @@ var _default = (_getUserInfo$getResul = {
|
|||
// 获取称重结果
|
||||
getResult: function getResult(_ref2, account) {
|
||||
var commit = _ref2.commit;
|
||||
console.log("1111111", account);
|
||||
return _model.default.getResult(account).then(function (res) {
|
||||
console.log("报告", res);
|
||||
if (res.code == 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue