diff --git a/OAT.xml b/OAT.xml
new file mode 100755
index 0000000000000000000000000000000000000000..9c356f7c11f79c7f46211368895a21d48a991e1c
--- /dev/null
+++ b/OAT.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+ LICENSE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.en.md b/README.en.md
deleted file mode 100644
index fbdac5fb07de7b832671dff51a611716c94a0a29..0000000000000000000000000000000000000000
--- a/README.en.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# sensors_sensor
-
-#### Description
-{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
-
-#### Software Architecture
-Software architecture description
-
-#### Installation
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### Instructions
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### Contribution
-
-1. Fork the repository
-2. Create Feat_xxx branch
-3. Commit your code
-4. Create Pull Request
-
-
-#### Gitee Feature
-
-1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4. The most valuable open source project [GVP](https://gitee.com/gvp)
-5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index 6a0d19f0cdd039ec1122fbb9d9067ea4e689b794..bb5a5ff723541df09297eafb0e0369a172e88c5f
--- a/README.md
+++ b/README.md
@@ -1,39 +1,200 @@
-# sensors_sensor
+# Sensor
-#### 介绍
-{**以下是 Gitee 平台说明,您可以替换此简介**
-Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
-无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
+- [Introduction](#section11660541593)
+- [Directory Structure](#section44981327519)
+- [Constraints](#section98068674513)
+- [Usage](#section1581412211528)
+ - [Available APIs](#section15684191115524)
+ - [How to Use](#section1543714111810)
-#### 软件架构
-软件架构说明
+- [Repositories Involved](#section96071132185310)
+> **NOTE:**
+>The APIs of this module are supported since API version 7.
-#### 安装教程
+## Introduction
-1. xxxx
-2. xxxx
-3. xxxx
+A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another device \(for example, a CPU\). Generally, a sensor is composed of sensitive components and conversion components. Sensors are the cornerstone of the IoT. A unified sensor management framework is required to achieve data sensing at a low latency and low power consumption, thereby keeping up with requirements of "1+8+N" products or business in the Seamless AI Life Strategy. Based on the usage, sensors are divided into the following categories:
-#### 使用说明
+- Motion: acceleration sensors, gyroscope sensors, gravity sensors, linear acceleration sensors, etc.
+- Orientation: rotation vector sensors, orientation sensors, etc.
+- Environment: magnetic field sensors, barometric pressure sensors, humidity sensors, etc.
+- Light: ambient light sensors, proximity sensors, color temperature sensors, etc.
+- Body: heart rate sensors, heartbeat sensors, etc.
+- Other: Hall effect sensors, grip detection sensors, etc.
-1. xxxx
-2. xxxx
-3. xxxx
+The following figure shows the sensor architecture.
-#### 参与贡献
+**Figure 1** Sensor architecture
-1. Fork 本仓库
-2. 新建 Feat_xxx 分支
-3. 提交代码
-4. 新建 Pull Request
+
-#### 特技
+## Directory Structure
+
+The sample code for importing the sensor module is as follows:
+
+```
+/base/sensors/sensor
+├── frameworks # Framework code
+│ └── native # Sensor client code
+├── interfaces # External APIs
+│ ├── native # Native Implementation for sensors
+│ └── plugin # JS APIs
+├── sa_profile # Configuration file of system ability names and dynamic libraries
+├── services # Code of services
+│ └── sensor # Sensor service for reporting data about sensors, such as the acceleration and gyroscope sensors
+└── utils # Common code, including permissions and communication capabilities
+```
+
+## Constraints
+
+- To use sensor functions, ensure that the device where your application runs has the required sensor components.
+
+- To obtain data of some sensors, you need to request the required permissions.
+
+ **Table 1** Permissions required by sensors
+
+
+
Sensor
+ |
+ Permission Name
+ |
+ Sensitivity
+ |
+ Permission Description
+ |
+
+
+ Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor
+ |
+ ohos.permission.ACCELEROMETER
+ |
+ system_grant
+ |
+ Allows an application to subscribe to data of these acceleration-related sensors.
+ |
+
+ Gyroscope sensor and uncalibrated gyroscope sensor
+ |
+ ohos.permission.GYROSCOPE
+ |
+ system_grant
+ |
+ Allows an application to subscribe to data of these gyroscope-related sensors.
+ |
+
+ Pedometer sensor
+ |
+ ohos.permission.ACTIVITY_MOTION
+ |
+ user_grant
+ |
+ Allows an application to subscribe to the motion status.
+ |
+
+ Heart rate sensor
+ |
+ ohos.permission.READ_HEALTH_DATA
+ |
+ user_grant
+ |
+ Allows an application to read health data.
+ |
+
+
+
+
+
+## Usage
+
+This section uses the sensor JS APIs as an example to describe their functionalities and usage.
+
+### Available APIs
+
+The sensor JS APIs listen for sensor data changes. If an API is called multiple times, the last call takes effect. The following table describes these APIs.
+
+**Table 2** Sensor JS APIs
+
+
+API
+ |
+Description
+ |
+
+
+on(type: SensorType, callback: AsyncCallback<Response>, options?: Options)
+ |
+Subscribes to a type of sensor that listens for changes of sensor data. SensorType indicates the type of the sensor that can be subscribed to. callback specifies whether the subscription is successful. options indicates the interval for reporting sensor data.
+ |
+
+once(type: SensorType, callback: AsyncCallback<Response>)
+ |
+Subscribes to a type of sensor that listens for the sensor data change once. SensorType indicates the type of the sensor that can be subscribed to. callback specifies whether the subscription is successful.
+ |
+
+off(type: SensorType, callback: AsyncCallback<void>)
+ |
+Unsubscribes from a type of sensor that listens for data changes. SensorType indicates the type of the sensor that can be unsubscribed from. callback specifies whether the unsubscription is successful.
+ |
+
+
+
+
+### How to Use
+
+1. Import the sensor package.
+2. Subscribe to and listen for data changes of an acceleration sensor.
+3. Unsubscribe from data changes of the acceleration sensor.
+4. Subscribe to and listen for a data change of a gravity sensor.
+
+Example:
+
+```
+// Step 1 Import the sensor package.
+import sensor from '@ohos.sensor';
+export default {
+ onCreate() {
+ // Step 2 Subscribe to and listen for data changes of a type of sensor.
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (error, data) => {
+ if (error) {
+ console.error("Failed to subscribe to acceleration data. Error code: " + error.code + "; message: " + error.message);
+ return;
+ }
+ console.info("Acceleration data obtained. x: " + data.x + "; y: " + data.y + "; z: " + data.z);
+ }, {'interval':200000000});
+ // Step 3 Unsubscribe from data changes of the sensor 10 seconds later.
+ setTimeout(function(){
+ sensor.off(SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(error) {
+ if (error) {
+ console.error("Failed to unsubscribe from acceleration data. Error code: " + error.code + "; message: " + error.message);
+ return;
+ }
+ console.info("Succeeded in unsubscribe from sensor data");
+ });
+ } ,10000);
+ // Step 4 Subscribe to and listen for a data change of a type of sensor.
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (error, data) => {
+ if (error) {
+ console.error("Failed to subscribe to gravity data. Error code: " + error.code + "; message: " + error.message);
+ return;
+ }
+ console.info("Gravity data obtained. x: " + data.x + "; y: " + data.y + "; z: " + data.z);
+ });
+ }
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+}
+```
+
+## Repositories Involved
+
+Pan-sensor subsystem
+
+sensors\_start
+
+**sensors\_sensor**
+
+sensors\_miscdevice
-1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
-2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
-3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
-4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
-5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
-6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/README_zh.md b/README_zh.md
new file mode 100755
index 0000000000000000000000000000000000000000..10a2b2cc771fcd16dfd1b5cdfea3ca68771a21b8
--- /dev/null
+++ b/README_zh.md
@@ -0,0 +1,200 @@
+# Sensor组件
+
+- [简介](#section11660541593)
+- [目录](#section44981327519)
+- [约束](#section98068674513)
+- [使用](#section1581412211528)
+ - [接口说明](#section15684191115524)
+ - [使用说明](#section1543714111810)
+
+- [相关仓](#section96071132185310)
+
+> **说明:**
+>从API Version 7 开始支持。
+
+## 简介
+
+传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。根据用途可分为以下六大类:
+
+- 运动类:加速度、陀螺仪、重力、线性加速度传感器等
+- 姿态类:旋转矢量、方向传感器等
+- 环境类:磁力计、气压、湿度传感器等
+- 光线类:环境光、接近光、色温传感器等
+- 健康类:心率、心跳传感器等
+- 其它:霍尔传感器、手握传感器等
+
+传感器架构图如下所示:
+
+**图 1** Sensor架构图
+
+
+
+
+## 目录
+
+sensor导入模块的示例代码如下:
+
+```
+/base/sensors/sensor
+├── frameworks # 框架代码
+│ └── native # sensor客户端代码
+├── interfaces # 对外接口存放目录
+│ ├── native # sensor native实现
+│ └── plugin # Js API
+├── sa_profile # 服务名称和服务的动态库的配置文件
+├── services # 服务的代码目录
+│ └── sensor # 传感器服务,包括加速度、陀螺仪等,上报传感器数据
+└── utils # 公共代码,包括权限、通信等能力
+```
+
+## 约束
+
+- 要使用传感器的功能,设备必须具有对应的传感器器件。
+
+- 针对某些传感器,开发者需要请求相应的权限,才能获取到相应传感器的数据。
+
+ **表 1** 传感器权限列表
+
+
+ 传感器
+ |
+ 权限名
+ |
+ 敏感级别
+ |
+ 权限描述
+ |
+
+
+ 加速度传感器、加速度未校准传感器、线性加速度传感器
+ |
+ ohos.permission.ACCELEROMETER
+ |
+ system_grant
+ |
+ 允许订阅加速度传感器的数据。
+ |
+
+ 陀螺仪传感器、陀螺仪未校准传感器
+ |
+ ohos.permission.GYROSCOPE
+ |
+ system_grant
+ |
+ 允许订阅陀螺仪传感器的数据。
+ |
+
+ 计步器
+ |
+ ohos.permission.ACTIVITY_MOTION
+ |
+ user_grant
+ |
+ 允许订阅运动状态。
+ |
+
+ 心率传感器
+ |
+ ohos.permission.READ_HEALTH_DATA
+ |
+ user_grant
+ |
+ 允许读取健康数据。
+ |
+
+
+
+
+
+## 使用
+
+本节以传感器 JS API为例,说明其提供的具体功能以及使用流程。
+
+### 接口说明
+
+传感器 JS API:监听传感器数据变化,如果多次调用该接口,则最后一次调用生效。JS API开放的能力如下:
+
+**表 2** JS API的主要接口
+
+
+接口名
+ |
+描述
+ |
+
+
+on(type: SensorType, callback: AsyncCallback<Response>, options?: Options)
+ |
+监听传感器数据变化。SensorType为支持订阅的传感器类型,callback表示订阅传感器的回调函数,options为设置传感器数据上报的时间间隔。
+ |
+
+once(type: SensorType, callback: AsyncCallback<Response>)
+ |
+监听传感器数据变化一次。SensorType为支持订阅的传感器类型,callback表示订阅传感器的回调函数。
+ |
+
+off(type: SensorType, callback: AsyncCallback<void>)
+ |
+取消订阅传感器数据。SensorType为支持的取消订阅的传感器类型,callback表示取消订阅传感器是否成功。
+ |
+
+
+
+
+### 使用说明
+
+1. 导包。
+2. 注册并监听加速度传感器数据的变化。
+3. 取消订阅加速度传感器数据的变化。
+4. 注册并监听重力传感器数据的变化一次。
+
+示例代码:
+
+```
+//步骤1 导包
+import sensor from '@ohos.sensor';
+export default {
+ onCreate() {
+ //步骤2 监听传感器数据变化,并注册传感器类型
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (error, data) => {
+ if (error) {
+ console.error("Failed to subscribe to acceleration data. Error code: " + error.code + "; message: " + error.message);
+ return;
+ }
+ console.info("Acceleration data obtained. x: " + data.x + "; y: " + data.y + "; z: " + data.z);
+ }, {'interval':200000000});
+ //步骤3 设置10秒后取消订阅传感器数据
+ setTimeout(function(){
+ sensor.off(SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(error) {
+ if (error) {
+ console.error("Failed to unsubscribe from acceleration data. Error code: " + error.code + "; message: " + error.message);
+ return;
+ }
+ console.info("Succeeded in unsubscribe from sensor data");
+ });
+ } ,10000);
+ //步骤4 监听传感器数据变化一次,并注册传感器类型
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (error, data) => {
+ if (error) {
+ console.error("Failed to subscribe to gravity data. Error code: " + error.code + "; message: " + error.message);
+ return;
+ }
+ console.info("Gravity data obtained. x: " + data.x + "; y: " + data.y + "; z: " + data.z);
+ });
+ }
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+}
+```
+
+## 相关仓
+
+泛Sensor服务子系统
+
+sensors\_start
+
+**sensors\_sensor**
+
+sensors\_miscdevice
+
diff --git a/figures/en-us_image_0000001199027515.png b/figures/en-us_image_0000001199027515.png
new file mode 100755
index 0000000000000000000000000000000000000000..0466444dc0f6c126b0e1c7e2a2e673f77ea04611
Binary files /dev/null and b/figures/en-us_image_0000001199027515.png differ
diff --git a/figures/zh-cn_image_0000001199027515.png b/figures/zh-cn_image_0000001199027515.png
new file mode 100755
index 0000000000000000000000000000000000000000..8ee23421356979ef07df9202ca9225036c841407
Binary files /dev/null and b/figures/zh-cn_image_0000001199027515.png differ
diff --git a/frameworks/native/sensor/BUILD.gn b/frameworks/native/sensor/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..6210e4a18875824d1c9aa0be35bab8563fe6f8c4
--- /dev/null
+++ b/frameworks/native/sensor/BUILD.gn
@@ -0,0 +1,66 @@
+# 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.
+
+import("//build/ohos.gni")
+import("//foundation/appexecfwk/standard/appexecfwk.gni")
+import(
+ "//foundation/appexecfwk/standard/libs/libeventhandler/lib_event_handler_sources.gni")
+
+SUBSYSTEM_DIR = "//base/sensors"
+
+##############################################
+ohos_shared_library("libsensor_native") {
+ sources = [
+ "src/my_event_handler.cpp",
+ "src/my_file_descriptor_listener.cpp",
+ "src/sensor_agent_proxy.cpp",
+ "src/sensor_data_channel.cpp",
+ "src/sensor_service_client.cpp",
+ "src/sensor_service_proxy.cpp",
+ ]
+
+ include_dirs = [
+ "include",
+ "//utils/native/base/include",
+ "//utils/system/safwk/native/include",
+ "$SUBSYSTEM_DIR/sensor/utils/include",
+ "$SUBSYSTEM_DIR/sensor/services/sensor/include",
+ "$SUBSYSTEM_DIR/sensor/interfaces/native/include",
+ "//drivers/peripheral/sensor/interfaces/include",
+ "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include",
+ "//foundation/appexecfwk/standard/libs/test/moduletest/common/event_handler",
+ ]
+ deps = [
+ "$SUBSYSTEM_DIR/sensor/services/sensor:libsensor_service",
+ "$SUBSYSTEM_DIR/sensor/utils:libsensor_utils",
+ "//drivers/peripheral/sensor/hal:hdi_sensor",
+ "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
+ "//foundation/appexecfwk/standard/libs/libeventhandler:libeventhandler_target",
+ "//utils/native/base:utils",
+ ]
+
+ external_deps = [
+ "hiviewdfx_hilog_native:libhilog",
+ "ipc:ipc_core",
+ "safwk:system_ability_fwk",
+ "samgr_L2:samgr_proxy",
+ ]
+
+ part_name = "sensors_sensor"
+ subsystem_name = "sensors"
+}
+
+##############################################
+group("sensor_native_target") {
+ deps = [ ":libsensor_native" ]
+}
diff --git a/frameworks/native/sensor/include/i_sensor_client.h b/frameworks/native/sensor/include/i_sensor_client.h
new file mode 100755
index 0000000000000000000000000000000000000000..9b8d07e71850ae86b51d2653c103b893aa6114e3
--- /dev/null
+++ b/frameworks/native/sensor/include/i_sensor_client.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#ifndef I_SENSOR_CLIENT_H
+#define I_SENSOR_CLIENT_H
+
+#include "iremote_broker.h"
+
+namespace OHOS {
+namespace Sensors {
+class ISensorClient : public IRemoteBroker {
+public:
+ ISensorClient() = default;
+
+ virtual ~ISensorClient() = default;
+
+ DECLARE_INTERFACE_DESCRIPTOR(u"ISensorClient");
+};
+} // namespace Sensors
+} // namespace OHOS
+#endif // I_SENSOR_CLIENT_H
diff --git a/frameworks/native/sensor/include/i_sensor_service.h b/frameworks/native/sensor/include/i_sensor_service.h
new file mode 100755
index 0000000000000000000000000000000000000000..4c210e08a8be1c599eb28da029dc3777c66f13c1
--- /dev/null
+++ b/frameworks/native/sensor/include/i_sensor_service.h
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+#ifndef I_SENSOR_SERVICE_H
+#define I_SENSOR_SERVICE_H
+
+#include
+
+#include "errors.h"
+#include "i_sensor_client.h"
+#include "iremote_broker.h"
+#include "sensor.h"
+#include "sensor_basic_data_channel.h"
+
+namespace OHOS {
+namespace Sensors {
+class ISensorService : public IRemoteBroker {
+public:
+ ISensorService() = default;
+
+ virtual ~ISensorService() = default;
+
+ DECLARE_INTERFACE_DESCRIPTOR(u"ISensorService");
+
+ virtual ErrCode EnableSensor(uint32_t sensorId, int64_t samplingPeriodNs,
+ int64_t maxReportDelayNs) = 0;
+
+ virtual ErrCode DisableSensor(uint32_t sensorId) = 0;
+
+ virtual int32_t GetSensorState(uint32_t sensorId) = 0;
+
+ virtual ErrCode RunCommand(uint32_t sensorId, uint32_t cmdType, uint32_t params) = 0;
+
+ virtual std::vector GetSensorList() = 0;
+
+ virtual ErrCode TransferDataChannel(const sptr &sensorBasicDataChannel,
+ const sptr &sensorClient) = 0;
+
+ virtual ErrCode DestroySensorChannel(sptr sensorClient) = 0;
+
+ enum {
+ ENABLE_SENSOR = 0,
+ DISABLE_SENSOR,
+ GET_SENSOR_STATE,
+ RUN_COMMAND,
+ GET_SENSOR_LIST,
+ TRANSFER_DATA_CHANNEL,
+ DESTROY_SENSOR_CHANNEL,
+ };
+};
+} // namespace Sensors
+} // namespace OHOS
+#endif // I_SENSOR_SERVICE_H
diff --git a/frameworks/native/sensor/include/my_event_handler.h b/frameworks/native/sensor/include/my_event_handler.h
new file mode 100755
index 0000000000000000000000000000000000000000..3b89c93bd67ecff4c538200a48e6626567e81d2b
--- /dev/null
+++ b/frameworks/native/sensor/include/my_event_handler.h
@@ -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.
+ */
+
+#ifndef MY_EVENT_HANDLER_H
+#define MY_EVENT_HANDLER_H
+
+#include "event_handler.h"
+#include "event_runner.h"
+
+namespace OHOS {
+namespace Sensors {
+class MyEventHandler : public AppExecFwk::EventHandler {
+public:
+ explicit MyEventHandler(const std::shared_ptr &runner);
+ ~MyEventHandler() = default;
+
+ /**
+ * Function: Process the event. Override the method of base class.
+ * @param event The event need to be processed.
+ */
+ void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override;
+};
+} // namespace Sensors
+} // namespace OHOS
+#endif // MY_EVENT_HANDLER_H
\ No newline at end of file
diff --git a/frameworks/native/sensor/include/my_file_descriptor_listener.h b/frameworks/native/sensor/include/my_file_descriptor_listener.h
new file mode 100755
index 0000000000000000000000000000000000000000..fc7f16d5ae72700e27a53d1a46d55edeb4d46a41
--- /dev/null
+++ b/frameworks/native/sensor/include/my_file_descriptor_listener.h
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#ifndef MY_FILE_DESCRIPTOR_LISTENER_H
+#define MY_FILE_DESCRIPTOR_LISTENER_H
+
+#include
+#include
+#include
+
+#include "event_handler.h"
+#include "event_runner.h"
+#include "file_descriptor_listener.h"
+#include "sensor_agent_type.h"
+#include "sensor_data_channel.h"
+
+namespace OHOS {
+namespace Sensors {
+class MyFileDescriptorListener : public AppExecFwk::FileDescriptorListener {
+public:
+ explicit MyFileDescriptorListener();
+
+ ~MyFileDescriptorListener() = default;
+
+ void OnReadable(int32_t fileDescriptor) override;
+
+ void OnWritable(int32_t fileDescriptor) override;
+
+ void OnShutdown(int32_t fileDescriptor) override;
+
+ void OnException(int32_t fileDescriptor) override;
+
+ void SetChannel(SensorDataChannel* channel);
+
+private:
+ SensorDataChannel* channel_;
+};
+} // namespace Sensors
+} // namespace OHOS
+#endif // MY_FILE_DESCRIPTOR_LISTENER_H
diff --git a/frameworks/native/sensor/include/sensor_agent_proxy.h b/frameworks/native/sensor/include/sensor_agent_proxy.h
new file mode 100755
index 0000000000000000000000000000000000000000..9cfe116937958889674ede78a4b241d16180717d
--- /dev/null
+++ b/frameworks/native/sensor/include/sensor_agent_proxy.h
@@ -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.
+ */
+
+#ifndef SENSOR_PROXY_H
+#define SENSOR_PROXY_H
+
+#include