mirror of
https://github.com/openharmony/connectivity_connectivity_cangjie_wrapper.git
synced 2026-06-30 22:17:54 -04:00
fix ble scan non_utf8 deviceName
Signed-off-by: liuhan <liuhan53@huawei.com>
This commit is contained in:
@@ -930,12 +930,18 @@ struct NativeScanResult {
|
||||
) {}
|
||||
|
||||
func toObject(): ScanResult {
|
||||
var name: String
|
||||
try {
|
||||
name = deviceName.toString()
|
||||
} catch (_) {
|
||||
name = ""
|
||||
}
|
||||
unsafe {
|
||||
ScanResult(
|
||||
deviceId.toString(),
|
||||
rssi,
|
||||
cArr2cjArr<UInt8, Byte>(data.size, data.head, {i => i}),
|
||||
deviceName.toString(),
|
||||
name,
|
||||
connectable
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user