# register\_event\_callback

Source: [https://docs.qualcomm.com/doc/80-PK177-134Y/topic/register_event_callback.html](https://docs.qualcomm.com/doc/80-PK177-134Y/topic/register_event_callback.html)

针对传感器事件注册回调接口 Ievent\_callback\_type。每当客户端激活的传感器生成传感器事件时，都会调用已注册的回调。

void register_event_callback(
                    int sensor_session_id, 
                    final Ievent_callback_type cb)  Copy to clipboard

## 参数

                    - sensor\_session\_id

                        - 指定传感器的会话 ID。

                    - cb

                        - 发生事件时将触发的回调函数。
Ievent\_callback\_type 是 ISensorsCBs 接口中的接口。onValues() 方法由 QESDK 的传感器管理器触发，用于处理来自传感器子系统的传感器事件。

    public interface Ievent_callback_type {
                            void onValues(byte[] bytes, 
                            int sensor_session_id);
                            }
                        Copy to clipboard

                            - bytes

                                - 已编码的 Protobuf 消息

                            - sensor\_session\_id

                                - 指定传感器的会话 ID。

**Parent Topic:** [传感器接口](https://docs.qualcomm.com/doc/80-PK177-134Y/topic/sensor_interfaces.html)

Last Published: Jun 22, 2023

[Previous Topic
发送请求](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134Y/topics/send_request.md) [Next Topic
register\_error\_callback](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134Y/topics/register_error_callback.md)