diff --git a/common/ECG/README_zh.md b/common/ECG/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..6bab3e02ba6fac710bd9ab7bf16fe55e2787e4e4
--- /dev/null
+++ b/common/ECG/README_zh.md
@@ -0,0 +1,7 @@
+# 心率检测
+##### 简介
+本示例通过stack组件,模拟显示实时心率监测数据图。
+##### 使用说明
+每秒采集一次心率和心跳数据,并且以心电图形式实时显示,动态更新心电数据图。
+##### 约束与限制
+本实例支持标准系统运行。
\ No newline at end of file
diff --git a/common/ECG/build.gradle b/common/ECG/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..729c646b74ca801b1d77eab87d6dd53e00fa9779
--- /dev/null
+++ b/common/ECG/build.gradle
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 6
+ }
+}
+buildscript {
+ repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.huawei.ohos:hap:2.4.4.3-RC'
+ }
+}
+allprojects {
+ repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ jcenter()
+ }
+}
diff --git a/common/ECG/entry/build.gradle b/common/ECG/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..921386f38e8d5e8e0272b5326c80b80bcf5a067d
--- /dev/null
+++ b/common/ECG/entry/build.gradle
@@ -0,0 +1,16 @@
+apply plugin: 'com.huawei.ohos.hap'
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 6
+ }
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
+ }
+ }
+ supportSystem "standard"
+}
diff --git a/common/ECG/entry/src/main/config.json b/common/ECG/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..d2eac8a20187ec57d770cd8937fa0209c3afb9b8
--- /dev/null
+++ b/common/ECG/entry/src/main/config.json
@@ -0,0 +1,62 @@
+{
+ "app": {
+ "bundleName": "ohos.samples.ecg",
+ "version": {
+ "code": 1000000,
+ "name": "1.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.samples.ecg",
+ "name": ".MyApplication",
+ "mainAbility": "ohos.samples.ecg.MainAbility",
+ "reqCapabilities": [
+ "video_support"
+ ],
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "visible": false,
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/common/ECG/entry/src/main/js/default/app.js b/common/ECG/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..58d12b7b501fbf46db906a86187aaf18dfb1f677
--- /dev/null
+++ b/common/ECG/entry/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ onCreate() {
+ console.info("Application onCreate");
+ },
+ onDestroy() {
+ console.info("Application onDestroy");
+ }
+};
diff --git a/common/ECG/entry/src/main/js/default/common/A054_048.png b/common/ECG/entry/src/main/js/default/common/A054_048.png
new file mode 100644
index 0000000000000000000000000000000000000000..0c5d425022eb3194dfa9aa0d8513c1d9e9204be1
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_048.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_049.png b/common/ECG/entry/src/main/js/default/common/A054_049.png
new file mode 100644
index 0000000000000000000000000000000000000000..8b1d1df82395cb366118def7dd6dd644cade5d10
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_049.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_050.png b/common/ECG/entry/src/main/js/default/common/A054_050.png
new file mode 100644
index 0000000000000000000000000000000000000000..18e54026191692615ef40f692d784249172437f7
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_050.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_078.png b/common/ECG/entry/src/main/js/default/common/A054_078.png
new file mode 100644
index 0000000000000000000000000000000000000000..33bd888c99df3ac4cd9c486702cec5fc9c68db27
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_078.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_079.png b/common/ECG/entry/src/main/js/default/common/A054_079.png
new file mode 100644
index 0000000000000000000000000000000000000000..a6c38e1854a74705c167bcff7dfb42ffc59ba1ec
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_079.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_080.png b/common/ECG/entry/src/main/js/default/common/A054_080.png
new file mode 100644
index 0000000000000000000000000000000000000000..b0f7e0f1c08a9b2b33fb098ccc07a401c591cdec
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_080.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_081.png b/common/ECG/entry/src/main/js/default/common/A054_081.png
new file mode 100644
index 0000000000000000000000000000000000000000..df7ebf6b2c7465916403ccf44545e6d3f3e146f2
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_081.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_082.png b/common/ECG/entry/src/main/js/default/common/A054_082.png
new file mode 100644
index 0000000000000000000000000000000000000000..925a1137be1c4c73ee3986fcfa6f467b84035269
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_082.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_083.png b/common/ECG/entry/src/main/js/default/common/A054_083.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce52995ff7459a3710badbbbc11603ab6dac2242
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_083.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_084.png b/common/ECG/entry/src/main/js/default/common/A054_084.png
new file mode 100644
index 0000000000000000000000000000000000000000..9595f20bf7d089b68b31f98f8b3466a7043984a9
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_084.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_085.png b/common/ECG/entry/src/main/js/default/common/A054_085.png
new file mode 100644
index 0000000000000000000000000000000000000000..381f3c02ea84064b7f7afc0ee3cf6aebd9638a55
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_085.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_086.png b/common/ECG/entry/src/main/js/default/common/A054_086.png
new file mode 100644
index 0000000000000000000000000000000000000000..65bd43c13a0d15127d13f25bb3d6c1934b4dbfa5
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_086.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_087.png b/common/ECG/entry/src/main/js/default/common/A054_087.png
new file mode 100644
index 0000000000000000000000000000000000000000..b0e82c7394ad7e6a0ef009acdfc33cd77d235066
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_087.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_088.png b/common/ECG/entry/src/main/js/default/common/A054_088.png
new file mode 100644
index 0000000000000000000000000000000000000000..4c46d2e0dbd821440fcd517fbb7c4bf0e21b450d
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_088.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_089.png b/common/ECG/entry/src/main/js/default/common/A054_089.png
new file mode 100644
index 0000000000000000000000000000000000000000..b2e6c957722ef0a67a7c1d5012ac74aa4a81dac5
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_089.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_090.png b/common/ECG/entry/src/main/js/default/common/A054_090.png
new file mode 100644
index 0000000000000000000000000000000000000000..188ddb2c6718f642a0b82d27ffd8d84062822d8d
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_090.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_091.png b/common/ECG/entry/src/main/js/default/common/A054_091.png
new file mode 100644
index 0000000000000000000000000000000000000000..7ab630418f84e5e9ea427fbf0756b3376acd2fb6
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_091.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_092.png b/common/ECG/entry/src/main/js/default/common/A054_092.png
new file mode 100644
index 0000000000000000000000000000000000000000..14838831aca6445e20a94473938331501e3fdad6
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_092.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_093.png b/common/ECG/entry/src/main/js/default/common/A054_093.png
new file mode 100644
index 0000000000000000000000000000000000000000..d6dde5258314854da1bc9c6ec7f6fb6fb9d63f7c
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_093.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_094.png b/common/ECG/entry/src/main/js/default/common/A054_094.png
new file mode 100644
index 0000000000000000000000000000000000000000..3507a1c3db7a15590864a28e52b8208f8f65a6ce
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_094.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_095.png b/common/ECG/entry/src/main/js/default/common/A054_095.png
new file mode 100644
index 0000000000000000000000000000000000000000..5fd742169805ac166753782138d3879b1f0e1958
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_095.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_096.png b/common/ECG/entry/src/main/js/default/common/A054_096.png
new file mode 100644
index 0000000000000000000000000000000000000000..33bd888c99df3ac4cd9c486702cec5fc9c68db27
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_096.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_100.png b/common/ECG/entry/src/main/js/default/common/A054_100.png
new file mode 100644
index 0000000000000000000000000000000000000000..71c7e43c7b0b36d5909d07a9861c8c9135fdea46
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_100.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_101.png b/common/ECG/entry/src/main/js/default/common/A054_101.png
new file mode 100644
index 0000000000000000000000000000000000000000..e2af4cf94e90b8a01033b809e45d2f2590f8325c
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_101.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_102.png b/common/ECG/entry/src/main/js/default/common/A054_102.png
new file mode 100644
index 0000000000000000000000000000000000000000..1048aa09f98d3fe1ba10ebed834282b9157fe3d0
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_102.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_103.png b/common/ECG/entry/src/main/js/default/common/A054_103.png
new file mode 100644
index 0000000000000000000000000000000000000000..849bd55cfba6bd55986049db4dbd1259396559a8
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_103.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_104.png b/common/ECG/entry/src/main/js/default/common/A054_104.png
new file mode 100644
index 0000000000000000000000000000000000000000..014338ac1f00adbbf6e4126cfda6430d85e208e5
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_104.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_105.png b/common/ECG/entry/src/main/js/default/common/A054_105.png
new file mode 100644
index 0000000000000000000000000000000000000000..6b42bcadad680113235ba62640f0d5f16e543b9f
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_105.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_106.png b/common/ECG/entry/src/main/js/default/common/A054_106.png
new file mode 100644
index 0000000000000000000000000000000000000000..80f71920a6478f437b22066ce0edcd81f0d30237
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_106.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_107.png b/common/ECG/entry/src/main/js/default/common/A054_107.png
new file mode 100644
index 0000000000000000000000000000000000000000..aef5db849155b4a5162da2b54eab2e39477a5cd0
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_107.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_108.png b/common/ECG/entry/src/main/js/default/common/A054_108.png
new file mode 100644
index 0000000000000000000000000000000000000000..1ca0c7026b4b11b3b3697133f286cc6b30f73059
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_108.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_109.png b/common/ECG/entry/src/main/js/default/common/A054_109.png
new file mode 100644
index 0000000000000000000000000000000000000000..dd890ada1b58596bb558885736a589e87e49d956
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_109.png differ
diff --git a/common/ECG/entry/src/main/js/default/common/A054_110.png b/common/ECG/entry/src/main/js/default/common/A054_110.png
new file mode 100644
index 0000000000000000000000000000000000000000..6b62e1dc6e3783b0eaeb6371f241afc46cfac36a
Binary files /dev/null and b/common/ECG/entry/src/main/js/default/common/A054_110.png differ
diff --git a/common/ECG/entry/src/main/js/default/i18n/en-US.json b/common/ECG/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..356c7831de9f506b6918d124c4ee214d959947c3
--- /dev/null
+++ b/common/ECG/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "times_minute": "bpm",
+ "count_down": " sec"
+ }
+}
\ No newline at end of file
diff --git a/common/ECG/entry/src/main/js/default/i18n/zh-CN.json b/common/ECG/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..bce21abf40022acd7e90960418978fc443bbb96c
--- /dev/null
+++ b/common/ECG/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "times_minute": "次/分",
+ "count_down": " 秒"
+ }
+}
\ No newline at end of file
diff --git a/common/ECG/entry/src/main/js/default/pages/index/index.css b/common/ECG/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..a2173296961686425ea8d224a03c5b14f7c7e414
--- /dev/null
+++ b/common/ECG/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.stackMain {
+ width: 100%;
+ height: 100%;
+ flex-direction: column;
+ background-color: black;
+}
+.chart_t_l {
+ width: 110px;
+ height: 110px;
+ object-fit: cover;
+ top: 8%;
+ left: 10px;
+}
+.numberImg {
+ width: 32px;
+ height: 66px;
+ top: 10%;
+}
+.hundredImg {
+ left: 140px;
+}
+.chart_t_r {
+ width: 80px;
+ height: 40px;
+ top: 12%;
+ color: #a6a6a6;
+}
+.chartBg {
+ width: 100%;
+ height: 50%;
+ top: 20%;
+}
+.chartTime {
+ width: 100%;
+ top: 70%;
+ font-size: 38px;
+ text-align: center;
+ color: white;
+}
\ No newline at end of file
diff --git a/common/ECG/entry/src/main/js/default/pages/index/index.hml b/common/ECG/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..2d7fb723bdc948af1cd2ab056c659a49e98e566f
--- /dev/null
+++ b/common/ECG/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+ {{ $t('strings.times_minute') }}
+
+
+ {{ chartTime }}{{ $t('strings.count_down') }}
+
+
diff --git a/common/ECG/entry/src/main/js/default/pages/index/index.js b/common/ECG/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..22adb0e687ee7816e541161f1cc8ddfde24dfea1
--- /dev/null
+++ b/common/ECG/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ data: {
+ hundredImg: "/common/A054_110.png",
+ tensImg: "/common/A054_110.png",
+ onesImg: "/common/A054_110.png",
+ tensLeft: "140px",
+ onesLeft: "170px",
+ chartUnit: "220px",
+ hundredDisplay: "none",
+ realHrValue: 0,
+ moving: false,
+ leftNum: 0,
+ passTime: 0,
+ chartTime: 30,
+ chartHeartImg: '/common/A054_078.png',
+ isFill: false,
+ chartHeartInterval: '',
+ electrocardInterval: '',
+ heartDataInterval: '',
+ maskLeft: 454,
+ tipTop: "320px",
+ hideFlag: false,
+ isBreak: true,
+ digMaskLeft: 454,
+ times_minute: "",
+ ecgData: [
+ 45,45,45,46,46,46,46,47,47,47,
+ 47,46,46,46,46,46,46,45,45,45,
+ 44,44,45,49,73,94,97,80,51,43,
+ 42,43,43,43,43,43,43,43,43,43,
+ 44,44,44,44,44,45,45,45,45,46,
+ 46,47,47,47,48,48,49,50,51,52,
+ 54,54,55,56,56,55,54,53,52,48,
+ 47,45,45,44,44,43,43,43,43,43,
+ 44,44,44,44,45,45,45,46,46,46,
+ 46,46,46,46,47,47,47,47,47,47
+ ],
+ heartData: [70,78,80,89,90,85,95,99,101,106,118],
+ datasets: [
+ {
+ strokeColor: '#fc3159',
+ data: [50]
+ }
+ ],
+ options: {
+ xAxis: { display: false, min: 0, max: 454},
+ yAxis: { display: false, min: 0, max: 100},
+ series: {
+ lineStyle: {
+ width: "5",
+ smooth: true
+ },
+ headPoint: {
+ shape: 'circle',
+ size: '8px',
+ strokeColor: '#ffffff',
+ fillColor: '#ffffff',
+ },
+ loop: {
+ margin: 30,
+ gradient: true
+ }
+ }
+ }
+ },
+ onInit() {
+ this.times_minute = this.$t('strings.times_minute');
+ this.startChartHeart();
+ this.handleMeasureData();
+ },
+ onHide() {
+ this.clearChart();
+ this.clearTimes();
+ },
+ handleMeasureData() {
+ this.updateElectrocarddiogram();
+ this.updateHeart();
+ },
+ updateElectrocarddiogram() {
+ let minEcgIndex = 0;
+ let maxEcgIndex = 99;
+ let curEcgIndex = minEcgIndex;
+ this.electrocardInterval = setInterval(() => {
+ let arrayObj = [];
+ for (let i = 0; i < 13; i++) {
+ if (curEcgIndex == maxEcgIndex) {
+ curEcgIndex = minEcgIndex;
+ } else {
+ arrayObj.push(this.ecgData[curEcgIndex]);
+ curEcgIndex++;
+ }
+ }
+ this.addChartDate(arrayObj);
+ this.handleCountDown();
+ }, 100);
+ },
+ updateHeart() {
+ this.heartDataInterval = setInterval(() => {
+ this.realHrValue = this.heartData[Math.floor(Math.random() * this.heartData.length)];
+ }, 1000);
+ },
+ addChartDate(list) {
+ let appendDate = { serial: 0, data: list };
+ this.$refs.chart.append(appendDate);
+ },
+ handleCountDown() {
+ let countdownValue = 30;
+ this.passTime++;
+ if (this.passTime % 10 == 0) {
+ countdownValue -= (this.passTime / 10);
+ this.setRealHrValue();
+ if (countdownValue > 0) {
+ if (countdownValue < 10) {
+ this.chartTime = '0' + countdownValue;
+ } else {
+ this.chartTime = countdownValue;
+ }
+ } else {
+ this.chartTime = 0;
+ }
+ }
+ },
+ setRealHrValue() {
+ let hundreds, tens, ones;
+ let realHrMin = 0;
+ let realHrMax = 255;
+ let doubleAvgHr = 2;
+ let threeAvgHr = 3;
+ let subIndexZero = 0;
+ let subIndexOne = 1;
+ let subIndexTwo = 2;
+ let subIndexEnd = 3;
+ if (this.realHrValue == realHrMin || this.realHrValue == realHrMax) {
+ this.initRealHrValue();
+ } else {
+ this.times_minute = this.$t('strings.ecg_times_minute_many_id');
+ let number = this.realHrValue.toString();
+ if (number.length == doubleAvgHr) {
+ this.hundredDisplay = 'none';
+ this.tensLeft = '140px';
+ this.onesLeft = '170px';
+ this.chartUnit = '220px';
+ tens = number.substring(subIndexZero, subIndexOne);
+ ones = number.substring(subIndexOne, subIndexTwo);
+ this.tensImg = '/common/A054_10' + tens + '.png';
+ this.onesImg = '/common/A054_10' + ones + '.png';
+ } else if (number.length == threeAvgHr) {
+ this.hundredDisplay = 'block';
+ this.tensLeft = '170px';
+ this.onesLeft = '200px';
+ this.chartUnit = '250px';
+ hundreds = number.substring(subIndexZero, subIndexOne);
+ tens = number.substring(subIndexOne, subIndexTwo);
+ ones = number.substring(subIndexTwo, subIndexEnd);
+ this.hundredImg = '/common/A054_10' + hundreds + '.png';
+ this.tensImg = '/common/A054_10' + tens + '.png';
+ this.onesImg = '/common/A054_10' + ones + '.png';
+ } else {
+ }
+ }
+ },
+ initRealHrValue() {
+ this.hundredDisplay = 'none';
+ this.tensLeft = '140px';
+ this.onesLeft = '170px';
+ this.chartUnit = '220px';
+ this.tensImg = '/common/A054_110.png';
+ this.onesImg = '/common/A054_110.png';
+ },
+ startChartHeart() {
+ let chartHeartIndex = 78;
+ let chartEndHeartIndex = 97;
+ let heartImgIndex = chartHeartIndex;
+ this.chartHeartInterval = setInterval(() => {
+ if (heartImgIndex == chartEndHeartIndex) {
+ heartImgIndex = chartHeartIndex;
+ } else {
+ this.chartHeartImg = '/common/A054_0' + heartImgIndex + '.png';
+ heartImgIndex++;
+ }
+ }, 50);
+ },
+ clearTimes() {
+ clearInterval(this.chartHeartInterval);
+ clearInterval(this.electrocardInterval);
+ clearInterval(this.heartDataInterval);
+ },
+ clearChart() {
+ this.chartTime = 30;
+ this.datasets = [{ strokeColor: '#fc3159', data: [50]}];
+ }
+}
+
+
+
diff --git a/common/ECG/entry/src/main/resources/base/element/string.json b/common/ECG/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..116d901911d72daa19e83bbc6b7ea53212774cb5
--- /dev/null
+++ b/common/ECG/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ECG"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/common/ECG/entry/src/main/resources/base/media/icon.png b/common/ECG/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..daed6b2167eaebc1d45e25eab964be8423a10ac9
Binary files /dev/null and b/common/ECG/entry/src/main/resources/base/media/icon.png differ
diff --git a/common/ECG/screenshots/device/ecg.png b/common/ECG/screenshots/device/ecg.png
new file mode 100644
index 0000000000000000000000000000000000000000..2a1889a61410cc451d05ef214fec332fed8ee91d
Binary files /dev/null and b/common/ECG/screenshots/device/ecg.png differ
diff --git a/common/ECG/settings.gradle b/common/ECG/settings.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..7dc3285c045cc590e49d231a4280ef52ba646d91
--- /dev/null
+++ b/common/ECG/settings.gradle
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+include ':entry'
diff --git a/common/Flashlight/README_zh.md b/common/Flashlight/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..6b25f5b81b54f41f61e9bedf5b70e9cba8431600
--- /dev/null
+++ b/common/Flashlight/README_zh.md
@@ -0,0 +1,7 @@
+# 手电筒
+##### 简介
+本示例通过屏幕的亮度变化来模拟手电筒功能,屏幕变亮模拟手电筒打开,屏幕变暗模拟手电筒关闭。
+##### 使用说明
+点击应用界面中的手电筒图标来开关手电筒。
+##### 约束与限制
+本示例仅支持在标准系统上运行。
\ No newline at end of file
diff --git a/common/Flashlight/build.gradle b/common/Flashlight/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..729c646b74ca801b1d77eab87d6dd53e00fa9779
--- /dev/null
+++ b/common/Flashlight/build.gradle
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 6
+ }
+}
+buildscript {
+ repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.huawei.ohos:hap:2.4.4.3-RC'
+ }
+}
+allprojects {
+ repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ jcenter()
+ }
+}
diff --git a/common/Flashlight/entry/build.gradle b/common/Flashlight/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..921386f38e8d5e8e0272b5326c80b80bcf5a067d
--- /dev/null
+++ b/common/Flashlight/entry/build.gradle
@@ -0,0 +1,16 @@
+apply plugin: 'com.huawei.ohos.hap'
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 6
+ }
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
+ }
+ }
+ supportSystem "standard"
+}
diff --git a/common/Flashlight/entry/src/main/config.json b/common/Flashlight/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..c1b773498e71f29509e7e52ae95e5ee4a955824a
--- /dev/null
+++ b/common/Flashlight/entry/src/main/config.json
@@ -0,0 +1,62 @@
+{
+ "app": {
+ "bundleName": "ohos.samples.flashlight",
+ "version": {
+ "code": 1000000,
+ "name": "1.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.samples.flashlight",
+ "name": ".MyApplication",
+ "mainAbility": "ohos.samples.flashlight.MainAbility",
+ "reqCapabilities": [
+ "video_support"
+ ],
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "visible": true,
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/common/Flashlight/entry/src/main/js/default/app.js b/common/Flashlight/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..58d12b7b501fbf46db906a86187aaf18dfb1f677
--- /dev/null
+++ b/common/Flashlight/entry/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ onCreate() {
+ console.info("Application onCreate");
+ },
+ onDestroy() {
+ console.info("Application onDestroy");
+ }
+};
diff --git a/common/Flashlight/entry/src/main/js/default/common/A017_001.png b/common/Flashlight/entry/src/main/js/default/common/A017_001.png
new file mode 100644
index 0000000000000000000000000000000000000000..39c0328a78afc9cac518d5c819311d704180005a
Binary files /dev/null and b/common/Flashlight/entry/src/main/js/default/common/A017_001.png differ
diff --git a/common/Flashlight/entry/src/main/js/default/common/logo.png b/common/Flashlight/entry/src/main/js/default/common/logo.png
new file mode 100644
index 0000000000000000000000000000000000000000..8ff99801a568aba384af790d7af48f83d9cf1603
Binary files /dev/null and b/common/Flashlight/entry/src/main/js/default/common/logo.png differ
diff --git a/common/Flashlight/entry/src/main/js/default/i18n/en-US.json b/common/Flashlight/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..08e34eac912bf2651eefc20e26aa479b5e4e7ec2
--- /dev/null
+++ b/common/Flashlight/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,11 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World",
+ "page": "Second Page",
+ "next": "Next Page",
+ "back": "Back"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/common/Flashlight/entry/src/main/js/default/i18n/zh-CN.json b/common/Flashlight/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..3dd53b3a8b808aec9396fa663cb00ef22ba61e0a
--- /dev/null
+++ b/common/Flashlight/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,11 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界",
+ "page": "第二页",
+ "next": "下一页",
+ "back": "返回"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/common/Flashlight/entry/src/main/js/default/pages/index/index.css b/common/Flashlight/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..d91a8584ca4f1780a89ec3ef9615a3b6cf0cd748
--- /dev/null
+++ b/common/Flashlight/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ left: 0px;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+}
+#lightContainer {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ height: 100%;
+}
+.backImage {
+ width: 102px;
+ height: 102px;
+}
+.textStyle {
+ width: 100%;
+ height: 20%;
+ text-align: center;
+}
\ No newline at end of file
diff --git a/common/Flashlight/entry/src/main/js/default/pages/index/index.hml b/common/Flashlight/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..8a7501429a172395c8f9e56b7b99e04bb5a25104
--- /dev/null
+++ b/common/Flashlight/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,20 @@
+
+
+
+
+ {{ time }}
+
+
\ No newline at end of file
diff --git a/common/Flashlight/entry/src/main/js/default/pages/index/index.js b/common/Flashlight/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..097d94d2c0be8e7db411f2f104e3f382a41887cb
--- /dev/null
+++ b/common/Flashlight/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ data: {
+ lightShow: true,
+ time: ''
+ },
+ onInit() {
+ setTimeout(() => {
+ app.terminate();
+ }, 300000);
+ },
+ onShow() {
+ this.refreshTime();
+ },
+ onDestroy() {},
+ refreshTime() {
+ setTimeout(() => {
+ let nowTime = new Date();
+ let minutes = nowTime.getMinutes();
+ let hours = nowTime.getHours();
+ let minStr = '';
+ let hourStr = '';
+ if (minutes < 10) {
+ minStr = '0' + minutes.toString();
+ } else {
+ minStr = minutes.toString();
+ }
+ if (hours < 10) {
+ hourStr = '0' + hours.toString();
+ } else {
+ hourStr = hours.toString();
+ }
+ this.time = hourStr + ':' + minStr;
+ this.refreshTime();
+ }, 1000);
+ },
+ changeMode() {
+ this.lightShow = !this.lightShow;
+ }
+}
+
+
+
diff --git a/common/Flashlight/entry/src/main/resources/base/element/string.json b/common/Flashlight/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..45b7a6d823d48e121f5780fa043cba285780c2ab
--- /dev/null
+++ b/common/Flashlight/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Flashlight"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/common/Flashlight/entry/src/main/resources/base/media/icon.png b/common/Flashlight/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..96ca5fa6aaeea71c56007ebce8c0e6a1bba58eda
Binary files /dev/null and b/common/Flashlight/entry/src/main/resources/base/media/icon.png differ
diff --git a/common/Flashlight/entry/src/main/resources/base/media/icon_small.png b/common/Flashlight/entry/src/main/resources/base/media/icon_small.png
new file mode 100644
index 0000000000000000000000000000000000000000..b2aba6ff180b113c9553bea95a77206b0f7f1e39
Binary files /dev/null and b/common/Flashlight/entry/src/main/resources/base/media/icon_small.png differ
diff --git a/common/Flashlight/screenshots/device/dark.png b/common/Flashlight/screenshots/device/dark.png
new file mode 100644
index 0000000000000000000000000000000000000000..70a71158d82dc296133380f58d8caf3490ac9213
Binary files /dev/null and b/common/Flashlight/screenshots/device/dark.png differ
diff --git a/common/Flashlight/screenshots/device/light.png b/common/Flashlight/screenshots/device/light.png
new file mode 100644
index 0000000000000000000000000000000000000000..9bd08762fd3d9c31661ab0c865896804b38b805f
Binary files /dev/null and b/common/Flashlight/screenshots/device/light.png differ
diff --git a/common/Flashlight/settings.gradle b/common/Flashlight/settings.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07
--- /dev/null
+++ b/common/Flashlight/settings.gradle
@@ -0,0 +1 @@
+include ':entry'