Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
662a9094
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
1 年多 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
662a9094
编写于
4月 13, 2023
作者:
C
chengjinsong2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
device js接口添加返回值判断
Signed-off-by:
N
chengjinsong2
<
chengjinsong2@huawei.com
>
上级
cdc6e4dd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
69 addition
and
0 deletion
+69
-0
interfaces/kits/jskits/src/native_deviceinfo_js.cpp
interfaces/kits/jskits/src/native_deviceinfo_js.cpp
+69
-0
未找到文件。
interfaces/kits/jskits/src/native_deviceinfo_js.cpp
浏览文件 @
662a9094
...
...
@@ -27,6 +27,9 @@ static napi_value GetDeviceType(napi_env env, napi_callback_info info)
{
napi_value
deviceType
=
nullptr
;
const
char
*
value
=
GetDeviceType
();
if
(
value
==
nullptr
)
{
value
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
value
,
strlen
(
value
),
&
deviceType
));
return
deviceType
;
...
...
@@ -36,6 +39,9 @@ static napi_value GetManufacture(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
manfactureName
=
GetManufacture
();
if
(
manfactureName
==
nullptr
)
{
manfactureName
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
manfactureName
,
strlen
(
manfactureName
),
&
napiValue
));
return
napiValue
;
...
...
@@ -45,6 +51,9 @@ static napi_value GetBrand(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
productBrand
=
GetBrand
();
if
(
productBrand
==
nullptr
)
{
productBrand
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
productBrand
,
strlen
(
productBrand
),
&
napiValue
));
return
napiValue
;
...
...
@@ -54,6 +63,9 @@ static napi_value GetMarketName(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
marketName
=
GetMarketName
();
if
(
marketName
==
nullptr
)
{
marketName
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
marketName
,
strlen
(
marketName
),
&
napiValue
));
return
napiValue
;
...
...
@@ -63,6 +75,9 @@ static napi_value GetProductSeries(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
productSeries
=
GetProductSeries
();
if
(
productSeries
==
nullptr
)
{
productSeries
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
productSeries
,
strlen
(
productSeries
),
&
napiValue
));
return
napiValue
;
...
...
@@ -72,6 +87,9 @@ static napi_value GetProductModel(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
productModel
=
GetProductModel
();
if
(
productModel
==
nullptr
)
{
productModel
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
productModel
,
strlen
(
productModel
),
&
napiValue
));
return
napiValue
;
...
...
@@ -81,6 +99,9 @@ static napi_value GetSoftwareModel(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
softwareModel
=
GetSoftwareModel
();
if
(
softwareModel
==
nullptr
)
{
softwareModel
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
softwareModel
,
strlen
(
softwareModel
),
&
napiValue
));
return
napiValue
;
...
...
@@ -90,6 +111,9 @@ static napi_value GetHardwareModel(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
hardwareModel
=
GetHardwareModel
();
if
(
hardwareModel
==
nullptr
)
{
hardwareModel
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
hardwareModel
,
strlen
(
hardwareModel
),
&
napiValue
));
return
napiValue
;
...
...
@@ -99,6 +123,9 @@ static napi_value GetHardwareProfile(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
hardwareProfile
=
GetHardwareProfile
();
if
(
hardwareProfile
==
nullptr
)
{
hardwareProfile
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
hardwareProfile
,
strlen
(
hardwareProfile
),
&
napiValue
));
return
napiValue
;
...
...
@@ -108,6 +135,9 @@ static napi_value GetSerial(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
serialNumber
=
AclGetSerial
();
if
(
serialNumber
==
nullptr
)
{
serialNumber
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
serialNumber
,
strlen
(
serialNumber
),
&
napiValue
));
return
napiValue
;
...
...
@@ -117,6 +147,9 @@ static napi_value GetBootloaderVersion(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
bootloaderVersion
=
GetBootloaderVersion
();
if
(
bootloaderVersion
==
nullptr
)
{
bootloaderVersion
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
bootloaderVersion
,
strlen
(
bootloaderVersion
),
&
napiValue
));
return
napiValue
;
...
...
@@ -126,6 +159,9 @@ static napi_value GetAbiList(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
abiList
=
GetAbiList
();
if
(
abiList
==
nullptr
)
{
abiList
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
abiList
,
strlen
(
abiList
),
&
napiValue
));
return
napiValue
;
...
...
@@ -135,6 +171,9 @@ static napi_value GetSecurityPatchTag(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
securityPatchTag
=
GetSecurityPatchTag
();
if
(
securityPatchTag
==
nullptr
)
{
securityPatchTag
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
securityPatchTag
,
strlen
(
securityPatchTag
),
&
napiValue
));
return
napiValue
;
...
...
@@ -144,6 +183,9 @@ static napi_value GetDisplayVersion(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
productVersion
=
GetDisplayVersion
();
if
(
productVersion
==
nullptr
)
{
productVersion
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
productVersion
,
strlen
(
productVersion
),
&
napiValue
));
return
napiValue
;
...
...
@@ -153,6 +195,9 @@ static napi_value GetIncrementalVersion(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
incrementalVersion
=
GetIncrementalVersion
();
if
(
incrementalVersion
==
nullptr
)
{
incrementalVersion
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
incrementalVersion
,
strlen
(
incrementalVersion
),
&
napiValue
));
return
napiValue
;
...
...
@@ -162,6 +207,9 @@ static napi_value GetOsReleaseType(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
osReleaseType
=
GetOsReleaseType
();
if
(
osReleaseType
==
nullptr
)
{
osReleaseType
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
osReleaseType
,
strlen
(
osReleaseType
),
&
napiValue
));
return
napiValue
;
...
...
@@ -171,6 +219,9 @@ static napi_value GetOSFullName(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
osVersion
=
GetOSFullName
();
if
(
osVersion
==
nullptr
)
{
osVersion
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
osVersion
,
strlen
(
osVersion
),
&
napiValue
));
return
napiValue
;
...
...
@@ -234,6 +285,9 @@ static napi_value GetVersionId(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
versionId
=
GetVersionId
();
if
(
versionId
==
nullptr
)
{
versionId
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
versionId
,
strlen
(
versionId
),
&
napiValue
));
return
napiValue
;
...
...
@@ -243,6 +297,9 @@ static napi_value GetBuildType(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
buildType
=
GetBuildType
();
if
(
buildType
==
nullptr
)
{
buildType
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
buildType
,
strlen
(
buildType
),
&
napiValue
));
return
napiValue
;
...
...
@@ -252,6 +309,9 @@ static napi_value GetBuildUser(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
buildUser
=
GetBuildUser
();
if
(
buildUser
==
nullptr
)
{
buildUser
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
buildUser
,
strlen
(
buildUser
),
&
napiValue
));
return
napiValue
;
...
...
@@ -261,6 +321,9 @@ static napi_value GetBuildHost(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
buildHost
=
GetBuildHost
();
if
(
buildHost
==
nullptr
)
{
buildHost
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
buildHost
,
strlen
(
buildHost
),
&
napiValue
));
return
napiValue
;
...
...
@@ -270,6 +333,9 @@ static napi_value GetBuildTime(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
buildTime
=
GetBuildTime
();
if
(
buildTime
==
nullptr
)
{
buildTime
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
buildTime
,
strlen
(
buildTime
),
&
napiValue
));
return
napiValue
;
...
...
@@ -279,6 +345,9 @@ static napi_value GetBuildRootHash(napi_env env, napi_callback_info info)
{
napi_value
napiValue
=
nullptr
;
const
char
*
buildRootHash
=
GetBuildRootHash
();
if
(
buildRootHash
==
nullptr
)
{
buildRootHash
=
""
;
}
NAPI_CALL
(
env
,
napi_create_string_utf8
(
env
,
buildRootHash
,
strlen
(
buildRootHash
),
&
napiValue
));
return
napiValue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录