云手机服务器 CPH-触控注入:调用示例

时间:2024-04-15 16:50:30

调用示例

// 触控数据结构体
struct InputTouch {
    uint8_t pointerID;       
    uint8_t orientation;     
    uint8_t action;         
    uint16_t pressure;       
    uint16_t touchX;        
    uint16_t touchY;        
    uint16_t physicalWidth;  
    uint16_t physicalHeight; 
    int32_t touchTime;       
    uint8_t reserved[16];    // 保留字段
};

InputTouch inputTouch;
inputTouch.pointerID = 0;
inputTouch.orientation = 0;
inputTouch.action = 0;        // ACTION_DOWN
inputTouch.pressure = 129;
inputTouch.physicalWidth = 720;
inputTouch.physicalHeight = 1280;
inputTouch.touchX = 52;
inputTouch.touchY = 157;
inputTouch.touchTime = 0;
int ret = InjectTouchData(inputTouch);
//注意
要确保数据类型是本地字节序,数据来自网络则需要使用ntohl()方法进行本地字节序转换
support.huaweicloud.com/sdkreference-cph/cph_sdk_0004.html