Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
77b9d799
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
77b9d799
编写于
3月 22, 2023
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
9a31ff87
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
111 addition
and
32 deletion
+111
-32
communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js
...bluetooth_manager/src/main/js/test/BleGattManager.test.js
+1
-1
communication/nfc_Controller/Test.json
communication/nfc_Controller/Test.json
+10
-1
communication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js
...nication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js
+100
-30
未找到文件。
communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js
浏览文件 @
77b9d799
...
...
@@ -249,7 +249,7 @@ describe('bluetoothBLETest', function() {
console
.
error
(
'
getname1 failed
'
);
}
console
.
info
(
'
[bluetooth_js]getname value:
'
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertNull
(
);
expect
(
true
).
assertEqual
(
data
!=
null
);
});
await
sleep
(
2000
);
done
();
...
...
communication/nfc_Controller/Test.json
浏览文件 @
77b9d799
...
...
@@ -15,6 +15,15 @@
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"svc nfc enable"
,
"hilog -Q pidoff"
,
"power-shell wakeup"
,
"power-shell setmode 602"
]
}
]
}
}
\ No newline at end of file
communication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js
浏览文件 @
77b9d799
...
...
@@ -17,6 +17,7 @@
import
tag
from
'
@ohos.nfc.tag
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
cardEmulation
from
'
@ohos.nfc.cardEmulation
'
;
import
controller
from
'
@ohos.nfc.controller
'
;
function
sleep
(
delay
)
{
// delay x ms
let
start
=
(
new
Date
()).
getTime
();
...
...
@@ -25,32 +26,6 @@ function sleep(delay) { // delay x ms
}
}
let
NdefRecord
=
{
NFC_A
:
1
,
NFC_B
:
2
,
ISO_DEP
:
3
,
NFC_F
:
4
,
NFC_V
:
5
,
NDEF
:
6
,
MIFARE_CLASSIC
:
8
,
MIFARE_ULTRALIGHT
:
9
,
NDEF_FORMATABLE
:
10
,
};
let
NfcForumType
=
{
NFC_FORUM_TYPE_1
:
1
,
NFC_FORUM_TYPE_2
:
2
,
NFC_FORUM_TYPE_3
:
3
,
NFC_FORUM_TYPE_4
:
4
,
MIFARE_CLASSIC
:
101
,
};
let
FeatureType
=
{
HCE
:
0
,
UICC
:
0
,
ESE
:
0
,
}
let
isoDepTaginfo
=
{
"
uid
"
:
[
0x01
,
0x02
,
0x03
,
0x04
],
"
technology
"
:
[
1
,
3
],
...
...
@@ -194,7 +169,7 @@ export default function nfcIsoDepTagTest() {
if
(
IsoDepTag
!=
null
&&
IsoDepTag
!=
undefined
)
{
let
cardEmulationnfc
;
try
{
cardEmulationnfc
=
cardEmulation
.
isSupported
(
FeatureType
.
ESE
);
cardEmulationnfc
=
cardEmulation
.
isSupported
(
cardEmulation
.
FeatureType
.
ESE
);
console
.
info
(
'
[NFC_test] cardEmulationnfc5 type ->
'
+
cardEmulationnfc
)
expect
(
cardEmulationnfc
).
assertFalse
();
}
catch
(
error
)
{
...
...
@@ -251,8 +226,103 @@ export default function nfcIsoDepTagTest() {
}
})
/**
* @tc.number SUB_Communication_NFC_Enumerated_js_0800
* @tc.name Test Enumerated
* @tc.desc Enumeration return value test
* @tc.size since 9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_Enumerated_js_0800
'
,
0
,
function
()
{
console
.
info
(
'
[nfc_test]1 PAYMENT Enumerated value test pass:
'
+
cardEmulation
.
CardType
.
PAYMENT
)
expect
(
cardEmulation
.
CardType
.
PAYMENT
).
assertEqual
(
"
payment
"
);
console
.
info
(
'
[nfc_test]2 OTHER Enumerated value test pass:
'
+
cardEmulation
.
CardType
.
OTHER
)
expect
(
cardEmulation
.
CardType
.
OTHER
).
assertEqual
(
"
other
"
);
console
.
info
(
'
[nfc_test]3 NFC_FORUM_TYPE_1 Enumerated value test pass:
'
+
tag
.
NfcForumType
.
NFC_FORUM_TYPE_1
)
expect
(
tag
.
NfcForumType
.
NFC_FORUM_TYPE_1
).
assertEqual
(
1
);
console
.
info
(
'
[nfc_test]4 NFC_FORUM_TYPE_2 Enumerated value test pass:
'
+
tag
.
NfcForumType
.
NFC_FORUM_TYPE_2
)
expect
(
tag
.
NfcForumType
.
NFC_FORUM_TYPE_2
).
assertEqual
(
2
);
console
.
info
(
'
[nfc_test]5 NFC_FORUM_TYPE_3 Enumerated value test pass:
'
+
tag
.
NfcForumType
.
NFC_FORUM_TYPE_3
)
expect
(
tag
.
NfcForumType
.
NFC_FORUM_TYPE_3
).
assertEqual
(
3
);
console
.
info
(
'
[nfc_test]6 NFC_FORUM_TYPE_4 Enumerated value test pass:
'
+
tag
.
NfcForumType
.
NFC_FORUM_TYPE_4
)
expect
(
tag
.
NfcForumType
.
NFC_FORUM_TYPE_4
).
assertEqual
(
4
);
console
.
info
(
'
[nfc_test]7 MIFARE_CLASSIC Enumerated value test pass:
'
+
tag
.
NfcForumType
.
MIFARE_CLASSIC
)
expect
(
tag
.
NfcForumType
.
MIFARE_CLASSIC
).
assertEqual
(
101
);
console
.
info
(
'
[nfc_test]8 HCE Enumerated value test pass:
'
+
cardEmulation
.
FeatureType
.
HCE
)
expect
(
cardEmulation
.
FeatureType
.
HCE
).
assertEqual
(
0
);
console
.
info
(
'
[nfc_test]9 UICC Enumerated value test pass:
'
+
cardEmulation
.
FeatureType
.
UICC
)
expect
(
cardEmulation
.
FeatureType
.
UICC
).
assertEqual
(
1
);
console
.
info
(
'
[nfc_test]10 ESE Enumerated value test pass:
'
+
cardEmulation
.
FeatureType
.
ESE
)
expect
(
cardEmulation
.
FeatureType
.
ESE
).
assertEqual
(
2
);
console
.
info
(
'
[nfc_test]11 TYPE_UNKNOWN Enumerated value test pass:
'
+
tag
.
MifareClassicType
.
TYPE_UNKNOWN
)
expect
(
tag
.
MifareClassicType
.
TYPE_UNKNOWN
).
assertEqual
(
0
);
console
.
info
(
'
[nfc_test]12 TYPE_CLASSIC Enumerated value test pass:
'
+
tag
.
MifareClassicType
.
TYPE_CLASSIC
)
expect
(
tag
.
MifareClassicType
.
TYPE_CLASSIC
).
assertEqual
(
1
);
console
.
info
(
'
[nfc_test]13 TYPE_PLUS Enumerated value test pass:
'
+
tag
.
MifareClassicType
.
TYPE_PLUS
)
expect
(
tag
.
MifareClassicType
.
TYPE_PLUS
).
assertEqual
(
2
);
console
.
info
(
'
[nfc_test]14 TYPE_PRO Enumerated value test pass:
'
+
tag
.
MifareClassicType
.
TYPE_PRO
)
expect
(
tag
.
MifareClassicType
.
TYPE_PRO
).
assertEqual
(
3
);
console
.
info
(
'
[nfc_test]15 MC_SIZE_MINI Enumerated value test pass:
'
+
tag
.
MifareClassicSize
.
MC_SIZE_MINI
)
expect
(
tag
.
MifareClassicSize
.
MC_SIZE_MINI
).
assertEqual
(
320
);
console
.
info
(
'
[nfc_test]16 MC_SIZE_1K Enumerated value test pass:
'
+
tag
.
MifareClassicSize
.
MC_SIZE_1K
)
expect
(
tag
.
MifareClassicSize
.
MC_SIZE_1K
).
assertEqual
(
1024
);
console
.
info
(
'
[nfc_test]17 MC_SIZE_2K Enumerated value test pass:
'
+
tag
.
MifareClassicSize
.
MC_SIZE_2K
)
expect
(
tag
.
MifareClassicSize
.
MC_SIZE_2K
).
assertEqual
(
2048
);
console
.
info
(
'
[nfc_test]18 MC_SIZE_4K Enumerated value test pass:
'
+
tag
.
MifareClassicSize
.
MC_SIZE_4K
)
expect
(
tag
.
MifareClassicSize
.
MC_SIZE_4K
).
assertEqual
(
4096
);
console
.
info
(
'
[nfc_test]19 TYPE_UNKNOWN Enumerated value test pass:
'
+
tag
.
MifareUltralightType
.
TYPE_UNKNOWN
)
expect
(
tag
.
MifareUltralightType
.
TYPE_UNKNOWN
).
assertEqual
(
0
);
console
.
info
(
'
[nfc_test]20 TYPE_ULTRALIGHT Enumerated value pass:
'
+
tag
.
MifareUltralightType
.
TYPE_ULTRALIGHT
)
expect
(
tag
.
MifareUltralightType
.
TYPE_ULTRALIGHT
).
assertEqual
(
1
);
console
.
info
(
'
[nfc_test]21 TYPE_ULTRALIGHT_C Enumerated value pass:
'
+
tag
.
MifareUltralightType
.
TYPE_ULTRALIGHT_C
)
expect
(
tag
.
MifareUltralightType
.
TYPE_ULTRALIGHT_C
).
assertEqual
(
2
);
console
.
info
(
'
[nfc_test]22 TNF_EMPTY Enumerated value test pass:
'
+
tag
.
TnfType
.
TNF_EMPTY
)
expect
(
tag
.
TnfType
.
TNF_EMPTY
).
assertEqual
(
0x0
);
console
.
info
(
'
[nfc_test]23 TNF_WELL_KNOWN Enumerated value test pass:
'
+
tag
.
TnfType
.
TNF_WELL_KNOWN
)
expect
(
tag
.
TnfType
.
TNF_WELL_KNOWN
).
assertEqual
(
0x01
);
console
.
info
(
'
[nfc_test]24 TNF_MEDIA Enumerated value test pass:
'
+
tag
.
TnfType
.
TNF_MEDIA
)
expect
(
tag
.
TnfType
.
TNF_MEDIA
).
assertEqual
(
0x02
);
console
.
info
(
'
[nfc_test]25 TNF_ABSOLUTE_URI Enumerated value test pass:
'
+
tag
.
TnfType
.
TNF_ABSOLUTE_URI
)
expect
(
tag
.
TnfType
.
TNF_ABSOLUTE_URI
).
assertEqual
(
0x03
);
console
.
info
(
'
[nfc_test]26 TNF_EXT_APP Enumerated value test pass:
'
+
tag
.
TnfType
.
TNF_EXT_APP
)
expect
(
tag
.
TnfType
.
TNF_EXT_APP
).
assertEqual
(
0x04
);
console
.
info
(
'
[nfc_test]27 TNF_UNKNOWN Enumerated value test pass:
'
+
tag
.
TnfType
.
TNF_UNKNOWN
)
expect
(
tag
.
TnfType
.
TNF_UNKNOWN
).
assertEqual
(
0x05
);
console
.
info
(
'
[nfc_test]28 TNF_UNCHANGED Enumerated value test pass:
'
+
tag
.
TnfType
.
TNF_UNCHANGED
)
expect
(
tag
.
TnfType
.
TNF_UNCHANGED
).
assertEqual
(
0x06
);
console
.
info
(
'
[nfc_test]29 RTD_TEXT Enumerated value pass:
'
+
String
(
tag
.
RtdType
.
RTD_TEXT
)
+
'
--
'
+
String
(
0x54
))
expect
(
String
(
tag
.
RtdType
.
RTD_TEXT
)).
assertEqual
(
String
(
0x54
));
console
.
info
(
'
[nfc_test]30 RTD_URI Enumerated value pass:
'
+
String
(
tag
.
RtdType
.
RTD_URI
)
+
'
--
'
+
String
(
0x55
))
expect
(
String
(
tag
.
RtdType
.
RTD_URI
)).
assertEqual
(
String
(
0x55
));
console
.
info
(
'
[nfc_test]31 STATE_OFF Enumerated value test pass:
'
+
controller
.
NfcState
.
STATE_OFF
)
expect
(
controller
.
NfcState
.
STATE_OFF
).
assertEqual
(
1
);
console
.
info
(
'
[nfc_test]32 STATE_TURNING_ON Enumerated value test pass:
'
+
controller
.
NfcState
.
STATE_TURNING_ON
)
expect
(
controller
.
NfcState
.
STATE_TURNING_ON
).
assertEqual
(
2
);
console
.
info
(
'
[nfc_test]33 STATE_ON Enumerated value test pass:
'
+
controller
.
NfcState
.
STATE_ON
)
expect
(
controller
.
NfcState
.
STATE_ON
).
assertEqual
(
3
);
console
.
info
(
'
[nfc_test]34 STATE_TURNING_OFF Enumerated value test pass:
'
+
controller
.
NfcState
.
STATE_TURNING_OFF
)
expect
(
controller
.
NfcState
.
STATE_TURNING_OFF
).
assertEqual
(
4
);
console
.
info
(
'
[nfc_test]35 NFC_A Enumerated value test pass:
'
+
tag
.
NFC_A
)
expect
(
tag
.
NFC_A
).
assertEqual
(
1
);
console
.
info
(
'
[nfc_test]36 NFC_B Enumerated value test pass:
'
+
tag
.
NFC_B
)
expect
(
tag
.
NFC_B
).
assertEqual
(
2
);
console
.
info
(
'
[nfc_test]37 ISO_DEP Enumerated value test pass:
'
+
tag
.
ISO_DEP
)
expect
(
tag
.
ISO_DEP
).
assertEqual
(
3
);
console
.
info
(
'
[nfc_test]38 NFC_F Enumerated value test pass:
'
+
tag
.
NFC_F
)
expect
(
tag
.
NFC_F
).
assertEqual
(
4
);
console
.
info
(
'
[nfc_test]39 NFC_V Enumerated value test pass:
'
+
tag
.
NFC_V
)
expect
(
tag
.
NFC_V
).
assertEqual
(
5
);
console
.
info
(
'
[nfc_test]40 NDEF Enumerated value test pass:
'
+
tag
.
NDEF
)
expect
(
tag
.
NDEF
).
assertEqual
(
6
);
console
.
info
(
'
[nfc_test]41 MIFARE_CLASSIC Enumerated value test pass:
'
+
tag
.
MIFARE_CLASSIC
)
expect
(
tag
.
MIFARE_CLASSIC
).
assertEqual
(
8
);
console
.
info
(
'
[nfc_test]42 MIFARE_ULTRALIGHT Enumerated value test pass:
'
+
tag
.
MIFARE_ULTRALIGHT
)
expect
(
tag
.
MIFARE_ULTRALIGHT
).
assertEqual
(
9
);
console
.
info
(
'
[nfc_test]43 NDEF_FORMATABLE Enumerated value test pass:
'
+
tag
.
NDEF_FORMATABLE
)
expect
(
tag
.
NDEF_FORMATABLE
).
assertEqual
(
7
);
})
console
.
info
(
"
*************[nfc_test] start nfc js unit test end*************
"
);
})
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录