qcloud-iotexplorer-bluetooth-adapter
Advanced tools
Comparing version 3.0.0-alpha.20230507b003 to 3.0.0-alpha.20240118b004
@@ -304,9 +304,9 @@ "use strict"; | ||
} | ||
async write(data, { writeId = '', serviceId = '', } = {}) { | ||
async write(data, { writeId = '', serviceId = '', writeType, } = {}) { | ||
if (typeof data === 'string') { | ||
data = hexToArrayBuffer(data); | ||
} | ||
return this._write(data, { writeId, serviceId }); | ||
return this._write(data, { writeId, serviceId, writeType }); | ||
} | ||
async _write(value, { writeId = '', serviceId = '', } = {}) { | ||
async _write(value, { writeId = '', serviceId = '', writeType, } = {}) { | ||
try { | ||
@@ -317,2 +317,3 @@ await this._bluetoothApi.writeBLECharacteristicValue({ | ||
serviceId: serviceId || this.serviceId, | ||
writeType, | ||
value, | ||
@@ -342,2 +343,4 @@ }); | ||
readIds: [], | ||
writeNoResponseIds: [], | ||
writeDefaultIds: [], | ||
}; | ||
@@ -349,15 +352,21 @@ const setCharacteristicsId = (idSet, uuid) => { | ||
}; | ||
characteristics.forEach(({ uuid, properties: { notify, write, indicate, read, }, }) => { | ||
characteristics.forEach(({ uuid, properties: { notify, write, indicate, read, writeNoResponse, writeDefault, }, }) => { | ||
if (notify) { | ||
setCharacteristicsId(map.notifyIds, uuid); | ||
} | ||
else if (write) { | ||
if (write) { | ||
setCharacteristicsId(map.writeIds, uuid); | ||
} | ||
else if (indicate) { | ||
if (indicate) { | ||
setCharacteristicsId(map.indicateIds, uuid); | ||
} | ||
else if (read) { | ||
if (read) { | ||
setCharacteristicsId(map.readIds, uuid); | ||
} | ||
if (writeNoResponse) { | ||
setCharacteristicsId(map.writeNoResponseIds, uuid); | ||
} | ||
if (writeDefault) { | ||
setCharacteristicsId(map.writeDefaultIds, uuid); | ||
} | ||
}); | ||
@@ -364,0 +373,0 @@ this.characteristicsMap[serviceId] = map; |
@@ -301,9 +301,9 @@ import { __rest } from "tslib"; | ||
} | ||
async write(data, { writeId = '', serviceId = '', } = {}) { | ||
async write(data, { writeId = '', serviceId = '', writeType, } = {}) { | ||
if (typeof data === 'string') { | ||
data = hexToArrayBuffer(data); | ||
} | ||
return this._write(data, { writeId, serviceId }); | ||
return this._write(data, { writeId, serviceId, writeType }); | ||
} | ||
async _write(value, { writeId = '', serviceId = '', } = {}) { | ||
async _write(value, { writeId = '', serviceId = '', writeType, } = {}) { | ||
try { | ||
@@ -314,2 +314,3 @@ await this._bluetoothApi.writeBLECharacteristicValue({ | ||
serviceId: serviceId || this.serviceId, | ||
writeType, | ||
value, | ||
@@ -339,2 +340,4 @@ }); | ||
readIds: [], | ||
writeNoResponseIds: [], | ||
writeDefaultIds: [], | ||
}; | ||
@@ -346,15 +349,21 @@ const setCharacteristicsId = (idSet, uuid) => { | ||
}; | ||
characteristics.forEach(({ uuid, properties: { notify, write, indicate, read, }, }) => { | ||
characteristics.forEach(({ uuid, properties: { notify, write, indicate, read, writeNoResponse, writeDefault, }, }) => { | ||
if (notify) { | ||
setCharacteristicsId(map.notifyIds, uuid); | ||
} | ||
else if (write) { | ||
if (write) { | ||
setCharacteristicsId(map.writeIds, uuid); | ||
} | ||
else if (indicate) { | ||
if (indicate) { | ||
setCharacteristicsId(map.indicateIds, uuid); | ||
} | ||
else if (read) { | ||
if (read) { | ||
setCharacteristicsId(map.readIds, uuid); | ||
} | ||
if (writeNoResponse) { | ||
setCharacteristicsId(map.writeNoResponseIds, uuid); | ||
} | ||
if (writeDefault) { | ||
setCharacteristicsId(map.writeDefaultIds, uuid); | ||
} | ||
}); | ||
@@ -361,0 +370,0 @@ this.characteristicsMap[serviceId] = map; |
@@ -123,9 +123,11 @@ /// <reference types="miniprogram-api-typings" /> | ||
autoNotifyCharacteristics(): Promise<void>; | ||
write(data: any, { writeId, serviceId, }?: { | ||
write(data: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: 'write' | 'writeNoResponse'; | ||
}): Promise<void>; | ||
_write(value: any, { writeId, serviceId, }?: { | ||
_write(value: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: 'write' | 'writeNoResponse'; | ||
}): Promise<void>; | ||
@@ -132,0 +134,0 @@ getBLEDeviceServices(): Promise<any>; |
@@ -72,5 +72,6 @@ import { DeviceAdapter } from '../base'; | ||
autoNotifyCharacteristics(): Promise<void>; | ||
_write(value: any, { writeId, serviceId, }?: { | ||
_write(value: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: "write" | "writeNoResponse"; | ||
}): Promise<void>; | ||
@@ -187,5 +188,6 @@ getBLEDeviceServices(): Promise<any>; | ||
autoNotifyCharacteristics(): Promise<void>; | ||
_write(value: any, { writeId, serviceId, }?: { | ||
_write(value: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: "write" | "writeNoResponse"; | ||
}): Promise<void>; | ||
@@ -192,0 +194,0 @@ getBLEDeviceServices(): Promise<any>; |
@@ -66,9 +66,11 @@ import { DeviceAdapter } from '../base'; | ||
autoNotifyCharacteristics(): Promise<void>; | ||
write(data: any, { writeId, serviceId, }?: { | ||
write(data: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: "write" | "writeNoResponse"; | ||
}): Promise<void>; | ||
_write(value: any, { writeId, serviceId, }?: { | ||
_write(value: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: "write" | "writeNoResponse"; | ||
}): Promise<void>; | ||
@@ -183,9 +185,11 @@ getBLEDeviceServices(): Promise<any>; | ||
autoNotifyCharacteristics(): Promise<void>; | ||
write(data: any, { writeId, serviceId, }?: { | ||
write(data: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: "write" | "writeNoResponse"; | ||
}): Promise<void>; | ||
_write(value: any, { writeId, serviceId, }?: { | ||
_write(value: any, { writeId, serviceId, writeType, }?: { | ||
writeId?: string; | ||
serviceId?: string; | ||
writeType?: "write" | "writeNoResponse"; | ||
}): Promise<void>; | ||
@@ -192,0 +196,0 @@ getBLEDeviceServices(): Promise<any>; |
{ | ||
"name": "qcloud-iotexplorer-bluetooth-adapter", | ||
"version": "3.0.0-alpha.20230507b003", | ||
"version": "3.0.0-alpha.20240118b004", | ||
"description": "", | ||
@@ -21,7 +21,7 @@ "bugs": { | ||
"dependencies": { | ||
"event-emitter-for-miniprogram": "3.0.0-alpha.20230507b003", | ||
"event-emitter-for-miniprogram": "3.0.0-alpha.20240118b004", | ||
"lodash.uniqwith": "^4.5.0", | ||
"qcloud-iotexplorer-appdev-sdk": "3.0.0-alpha.20230507b003", | ||
"qcloud-iotexplorer-common-libs": "3.0.0-alpha.20230507b003", | ||
"qcloud-iotexplorer-logger": "3.0.0-alpha.20230507b003", | ||
"qcloud-iotexplorer-appdev-sdk": "3.0.0-alpha.20240118b004", | ||
"qcloud-iotexplorer-common-libs": "3.0.0-alpha.20240118b004", | ||
"qcloud-iotexplorer-logger": "3.0.0-alpha.20240118b004", | ||
"tslib": "^2.1.0" | ||
@@ -33,3 +33,3 @@ }, | ||
}, | ||
"gitHead": "b64540d610a6b02a5400cb1e6e404949d378e5eb" | ||
"gitHead": "6beca018526e761fba4197634612bd6c71179181" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
443554
6512
+ Addedevent-emitter-for-miniprogram@3.0.0-alpha.20240118b004(transitive)
+ Addedqcloud-iotexplorer-appdev-sdk@3.0.0-alpha.20240118b004(transitive)
+ Addedqcloud-iotexplorer-common-libs@3.0.0-alpha.20240118b004(transitive)
+ Addedqcloud-iotexplorer-logger@3.0.0-alpha.20240118b004(transitive)
- Removedevent-emitter-for-miniprogram@3.0.0-alpha.20230507b003(transitive)
- Removedqcloud-iotexplorer-appdev-sdk@3.0.0-alpha.20230507b003(transitive)
- Removedqcloud-iotexplorer-common-libs@3.0.0-alpha.20230507b003(transitive)
- Removedqcloud-iotexplorer-logger@3.0.0-alpha.20230507b003(transitive)
Updatedevent-emitter-for-miniprogram@3.0.0-alpha.20240118b004
Updatedqcloud-iotexplorer-appdev-sdk@3.0.0-alpha.20240118b004
Updatedqcloud-iotexplorer-common-libs@3.0.0-alpha.20240118b004