Files
VibeCoding/webrtc_controller_flutter/proto/control_message.proto

58 lines
1.9 KiB
Protocol Buffer
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
syntax = "proto3";
package com.ttstd.control;
option java_package = "com.ttstd.control";
option java_multiple_files = true;
// 控制指令类型,对应原 JSON 字段 action。
enum Action {
ACTION_UNKNOWN = 0;
TOUCH = 1;
SWIPE = 2;
KEY = 3;
LONG_PRESS = 4;
MOTION_EVENT = 5;
SET_RESOLUTION = 6; // 控制端请求被控端切换屏幕采集分辨率
REPORT_RESOLUTION = 7; // 被控端上报当前实际采集分辨率(含连接建立后的初始值)
SET_STREAM_MODE = 8; // 控制端请求被控端切换屏幕串流模式WebRTC / 自编码)
REPORT_STREAM_MODE = 9; // 被控端上报当前生效的串流模式
}
// 通过 RTCDataChannel 传输的控制指令protobuf 二进制)。
// 坐标 x/y/x1/y1/x2/y2 均为相对屏幕的百分比,取值范围 0.0 ~ 1.0。
message ControlMessage {
// 指令类型
Action action = 1;
// 单点坐标TOUCH / LONG_PRESS / MOTION_EVENT
double x = 2;
double y = 3;
// 滑动起止坐标SWIPE
double x1 = 4;
double y1 = 5;
double x2 = 6;
double y2 = 7;
int64 duration = 8;
// 按键KEYkey_action 0=按下 1=抬起(对应 Android KeyEvent ACTION_DOWN/UP
int32 key_code = 9;
int32 key_action = 10;
// 原始动作MOTION_EVENT对应 Android MotionEvent ACTION_*0=DOWN 1=UP 2=MOVE
int32 motion_action = 11;
// 分辨率切换SET_RESOLUTION
// width 为目标长边/宽度;<=0 表示使用被控端原始native分辨率。
// height 为目标高度;<=0 时按被控端屏幕宽高比基于 width 计算(保留原始比例)。
// fps 为目标帧率;<=0 表示沿用当前帧率。
int32 width = 12;
int32 height = 13;
int32 fps = 14;
// 串流模式SET_STREAM_MODE / REPORT_STREAM_MODE
// 0 = WebRTC 全托管1 = 自编码(自建 MediaCodec 编解码 + video DataChannel 裸流透传)
int32 stream_mode = 15;
}