---
title: registerTouchSendHook
description: "注册触控引擎客户端数据发送钩子函数。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/armnative/kunpengcpsvideo_17_0034.html
sourcePath: /source/zh/kunpengboostkithistory/2300/armnative/kunpengcpsvideo_17_0034.html
indexId: d86460db16884a1985226778418cad0d8aaaa196a9fad3eb9b5cb227b950f23277
---
# registerTouchSendHook

#### 函数功能

注册触控引擎客户端数据发送钩子函数。


#### 约束说明

NA


#### 函数原型

int registerTouchSendHook(TOUCHSENDHOOK hook)


#### 参数说明

| 字段名称 | 输入/输出 | 字段类型 | 字段描述 |
| --- | --- | --- | --- |
| hook | 输入 | TOUCHSENDHOOK | 使用引擎的用户将自己实现的触控数据发送接口挂到此hook上。public interface TOUCHSENDHOOK { void touchSendData(byte[] data, int length); } data：数据buff length：数据长度 |


#### 返回值说明

数据类型：int

取值如下：

- VMI_SUCCESS：成功。
- VMI_TOUCH_CLIENT_SENDHOOK_REGISTER_FAIL：触控引擎客户端注册发送函数失败。


#### 调用示例

```
public class DataPipe implements TOUCHSENDHOOK  
{ 
    void touchSendData(byte[] data, int length) { 
        // 实现具体的发送函数代码 
    } 
} 

void Test()  
{ 
    int ret = VmiTouch.getInstance().registerTouchSendHook( 
        DataPipe.getInstance()); 
}
```
