1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_HDI_SENSOR_V1_1_ISENSORCALLBACK_VDI_H 17 #define OHOS_HDI_SENSOR_V1_1_ISENSORCALLBACK_VDI_H 18 19 #include <stdint.h> 20 #include <vector> 21 #include <hdf_base.h> 22 #include <hdi_base.h> 23 #include "iremote_object.h" 24 #include "v3_0/isensor_interface.h" 25 26 #define DEFAULT_DEVICE_ID (-1) 27 #define DEFAULT_SENSOR_ID 0 28 #define DEFAULT_LOCATION 1 29 #define ONE_MILLION 1000000 30 31 namespace OHOS { 32 namespace HDI { 33 namespace Sensor { 34 namespace V1_1 { 35 36 using namespace OHOS::HDI::Sensor::V3_0; 37 struct HdfSensorEventsVdi { 38 int32_t sensorId; 39 struct DeviceSensorInfo deviceSensorInfo; 40 int32_t version; 41 int64_t timestamp; 42 uint32_t option; 43 int32_t mode; 44 std::vector<uint8_t> data; 45 uint32_t dataLen; 46 }; 47 48 struct SensorInterval { 49 int64_t samplingInterval; 50 int64_t reportInterval; 51 }; 52 53 class ISensorCallbackVdi : public HdiBase { 54 public: 55 virtual ~ISensorCallbackVdi() = default; 56 virtual int32_t OnDataEventVdi(const HdfSensorEventsVdi& eventVdi) = 0; 57 virtual int32_t OnDataEvent(const V3_0::HdfSensorEvents& event) = 0; 58 virtual sptr<IRemoteObject> HandleCallbackDeath() = 0; 59 }; 60 61 } // V1_1 62 } // Sensor 63 } // HDI 64 } // OHOS 65 66 #endif // OHOS_HDI_SENSOR_V1_1_ISENSORCALLBACK_VDI_H 67