|
|
@@ -8,9 +8,14 @@ let ecDeviceId = ''
|
|
|
let ecGattServerUUID = ''
|
|
|
const ecGattServerUUIDOption1 = '0000FFF0-0000-1000-8000-00805F9B34FB'
|
|
|
const ecGattServerUUIDOption2 = 'FFF0'
|
|
|
+const yiyuanUUIDOption1 = '0000F536-0000-1000-8000-00805F9B34FB';
|
|
|
+const yiyuanUUIDOption2 = 'F536';
|
|
|
let ecGattCharacteristicWriteUUID = ''
|
|
|
const ecGattCharacteristicWriteUUIDOption1 = '0000FFF2-0000-1000-8000-00805F9B34FB'
|
|
|
const ecGattCharacteristicWriteUUIDOption2 = 'FFF2'
|
|
|
+const yiyuancharacterID1 = '0000FF15-0000-1000-8000-00805F9B34FB'
|
|
|
+const yiyuancharacterID2 = 'FF15'
|
|
|
+
|
|
|
|
|
|
const log = data => {
|
|
|
if (logEnable) {
|
|
|
@@ -285,10 +290,21 @@ uni.onBLEConnectionStateChange(async res => {
|
|
|
return
|
|
|
}
|
|
|
for (const service of servicesResult.services) {
|
|
|
+ var isRightService = false;
|
|
|
if ((service.uuid.toUpperCase() === ecGattServerUUIDOption1) ||
|
|
|
(service.uuid.toUpperCase() === ecGattServerUUIDOption2)) {
|
|
|
ecGattServerUUID = service.uuid
|
|
|
+ isRightService = true;
|
|
|
+ }
|
|
|
+ if ((service.uuid.toUpperCase() === yiyuanUUIDOption1) ||
|
|
|
+ (service.uuid.toUpperCase() === yiyuanUUIDOption2)) {
|
|
|
+ ecGattServerUUID = service.uuid
|
|
|
+ isRightService = true;
|
|
|
}
|
|
|
+ if(!isRightService){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ console.log("uuid:"+ecGattServerUUID)
|
|
|
const characteristicsResult = await getBLEDeviceCharacteristics(
|
|
|
service.uuid
|
|
|
)
|
|
|
@@ -297,6 +313,7 @@ uni.onBLEConnectionStateChange(async res => {
|
|
|
closeBLEConnection()
|
|
|
return
|
|
|
}
|
|
|
+ console.log(characteristicsResult)
|
|
|
for (const characteristic of characteristicsResult.characteristics) {
|
|
|
if (
|
|
|
characteristic.properties &&
|
|
|
@@ -317,13 +334,26 @@ uni.onBLEConnectionStateChange(async res => {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 14:49:25.419 uuid:0000FFF0-0000-1000-8000-00805F9B34FB at utils/ecBLE/ecBLEApp.js:298
|
|
|
+ * 14:49:25.427 characteristic.uuid:0000FFF2-0000-1000-8000-00805F9B34FB at utils/ecBLE/ecBLEApp.js:327
|
|
|
+ * 14:49:25.443 characteristic.uuid:0000FFF1-0000-1000-8000-00805F9B34FB at utils/ecBLE/ecBLEApp.js:327
|
|
|
+ */
|
|
|
+ console.log("characteristic.uuid:"+characteristic.uuid)
|
|
|
if ((characteristic.uuid.toUpperCase() ===
|
|
|
ecGattCharacteristicWriteUUIDOption1) ||
|
|
|
(characteristic.uuid.toUpperCase() ===
|
|
|
ecGattCharacteristicWriteUUIDOption2)) {
|
|
|
ecGattCharacteristicWriteUUID = characteristic.uuid
|
|
|
}
|
|
|
+
|
|
|
+ if ((characteristic.uuid.toUpperCase() ===
|
|
|
+ yiyuancharacterID1) ||
|
|
|
+ (characteristic.uuid.toUpperCase() ===
|
|
|
+ yiyuancharacterID2)) {
|
|
|
+ ecGattCharacteristicWriteUUID = characteristic.uuid
|
|
|
+ }
|
|
|
+ console.log("rghtCID:"+ecGattCharacteristicWriteUUID);
|
|
|
}
|
|
|
}
|
|
|
if (isAndroid) {
|