From 0b5ab25a6bd4115d7a201c7e4a9effe8da58be8c Mon Sep 17 00:00:00 2001 From: wuhb Date: Fri, 7 Jan 2022 10:39:38 +0800 Subject: [PATCH] feat: add medical_sensor js api Signed-off-by: wuhb Signed-off-by: wuhb --- OAT.xml | 1 + api/@ohos.medical.d.ts | 64 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) mode change 100644 => 100755 OAT.xml create mode 100644 api/@ohos.medical.d.ts diff --git a/OAT.xml b/OAT.xml old mode 100644 new mode 100755 index 63d6db0d99..a3c8af187a --- a/OAT.xml +++ b/OAT.xml @@ -60,6 +60,7 @@ Note:If the text contains special characters, please escape them according to th + diff --git a/api/@ohos.medical.d.ts b/api/@ohos.medical.d.ts new file mode 100644 index 0000000000..6d5358d7b8 --- /dev/null +++ b/api/@ohos.medical.d.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2022 Chipsea Technologies (Shenzhen) Corp., 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. + */ +import { Callback } from './basic'; + +/** + * This module provides the capability to subscribe to medical data. + * + * @since 8 + * @sysCap SystemCapability.Sensors.Medical_sensor + * @import import medical from '@ohos.medical' + * @permission ohos.permission.READ_HEALTH_DATA + */ +declare namespace medical { + /** + * Subscribe to medical sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the medical type to listen for, {@code MedicalSensorType.TYPE_ID_PHOTOPLETHYSMOGRAPH}. + * @param options Optional parameters specifying the interval at which medical sensor data is reported, {@code Options}. + * @permission ohos.permission.READ_HEALTH_DATA + * @since 8 + */ + function on(type: MedicalSensorType, callback: Callback, options?: Options): void; + + /** + * Unsubscribe to medical sensor data once. + * @param type Indicate the medical sensor type to listen for, {@code MedicalSensorType}. + * @permission ohos.permission.READ_HEALTH_DATA + * @since 8 + */ + function off(type: MedicalSensorType, callback?: Callback): void; + + /** + * Subscribe to the medical sensor's optional parameters. + * @sysCap SystemCapability.Sensors.Medical_sensor + */ + interface Options { + interval?: number; /**< Sensor event reporting event interval */ + } + + /** + * The type of medical sensor. + * @sysCap SystemCapability.Sensors.Medical_sensor + */ + enum MedicalSensorType { + TYPE_ID_PHOTOPLETHYSMOGRAPH = 129, /**< Photoplethysmography */ + } + + interface PpgResponse { + dataArray: Array; /**< Photoplethysmography data */ + } + } + + export default medical; -- Gitee