169f182c4Sopenharmony_ci/* 269f182c4Sopenharmony_ci * Copyright (c) 2022 Chipsea Technologies (Shenzhen) Corp., Ltd. 369f182c4Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 469f182c4Sopenharmony_ci * you may not use this file except in compliance with the License. 569f182c4Sopenharmony_ci * You may obtain a copy of the License at 669f182c4Sopenharmony_ci * 769f182c4Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 869f182c4Sopenharmony_ci * 969f182c4Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1069f182c4Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1169f182c4Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1269f182c4Sopenharmony_ci * See the License for the specific language governing permissions and 1369f182c4Sopenharmony_ci * limitations under the License. 1469f182c4Sopenharmony_ci */ 1569f182c4Sopenharmony_ciimport { Callback } from './basic'; 1669f182c4Sopenharmony_ci 1769f182c4Sopenharmony_ci/** 1869f182c4Sopenharmony_ci * This module provides the capability to subscribe to medical data. 1969f182c4Sopenharmony_ci * 2069f182c4Sopenharmony_ci * @since 8 2169f182c4Sopenharmony_ci * @sysCap SystemCapability.Sensors.Medical_sensor 2269f182c4Sopenharmony_ci * @import import medical from '@ohos.medical' 2369f182c4Sopenharmony_ci * @permission ohos.permission.HEALTH_DATA 2469f182c4Sopenharmony_ci */ 2569f182c4Sopenharmony_cideclare namespace medical { 2669f182c4Sopenharmony_ci /** 2769f182c4Sopenharmony_ci * Subscribe to medical sensor data, If the API is called multiple times, the last call takes effect. 2869f182c4Sopenharmony_ci * @param type Indicate the medical type to listen for, {@code MedicalSensorType.TYPE_ID_PHOTOPLETHYSMOGRAPH}. 2969f182c4Sopenharmony_ci * @param options Optional parameters specifying the interval at which medical sensor data is reported, {@code Options}. 3069f182c4Sopenharmony_ci * @permission ohos.permission.PHOTOPLETHYSMOGRAPH 3169f182c4Sopenharmony_ci * @since 8 3269f182c4Sopenharmony_ci */ 3369f182c4Sopenharmony_ci function on(type: MedicalSensorType.TYPE_ID_PHOTOPLETHYSMOGRAPH, callback: Callback<PpgResponse>, options?: Options): void; 3469f182c4Sopenharmony_ci 3569f182c4Sopenharmony_ci /** 3669f182c4Sopenharmony_ci * Unsubscribe to medical sensor data once. 3769f182c4Sopenharmony_ci * @param type Indicate the medical sensor type to listen for, {@code MedicalSensorType}. 3869f182c4Sopenharmony_ci * @permission N/A 3969f182c4Sopenharmony_ci * @since 8 4069f182c4Sopenharmony_ci */ 4169f182c4Sopenharmony_ci function off(type: MedicalSensorType.TYPE_ID_PHOTOPLETHYSMOGRAPH, callback?: Callback<PpgResponse>): void; 4269f182c4Sopenharmony_ci 4369f182c4Sopenharmony_ci /** 4469f182c4Sopenharmony_ci * Subscribe to the medical sensor's optional parameters. 4569f182c4Sopenharmony_ci * @sysCap SystemCapability.Sensors.Medical_sensor 4669f182c4Sopenharmony_ci */ 4769f182c4Sopenharmony_ci interface Options { 4869f182c4Sopenharmony_ci interval?: number; /**< Sensor event reporting event interval */ 4969f182c4Sopenharmony_ci } 5069f182c4Sopenharmony_ci 5169f182c4Sopenharmony_ci /** 5269f182c4Sopenharmony_ci * The type of medical sensor. 5369f182c4Sopenharmony_ci * @sysCap SystemCapability.Sensors.Medical_sensor 5469f182c4Sopenharmony_ci */ 5569f182c4Sopenharmony_ci enum MedicalSensorType { 5669f182c4Sopenharmony_ci TYPE_ID_PHOTOPLETHYSMOGRAPH = 129, /**< Photoplethysmography */ 5769f182c4Sopenharmony_ci } 5869f182c4Sopenharmony_ci 5969f182c4Sopenharmony_ci interface PpgResponse { 6069f182c4Sopenharmony_ci dataArray: Array<number>; /**< Acceleration x-axis component */ 6169f182c4Sopenharmony_ci } 6269f182c4Sopenharmony_ci } 6369f182c4Sopenharmony_ci 6469f182c4Sopenharmony_ci export default medical;