Files
xueguang_flutter_app/lib/request/websocket/room_protocol.dart
2025-11-28 13:31:23 +08:00

110 lines
2.5 KiB
Dart
Raw 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.
enum RoomCommand {
///ping服务器用于心跳
ping("ping"),
///加入房间
joinRoom("into_room"),
///获取房间信息(没啥用)
getRoomInfo("room_data"),
///学生开关扬声器、摄像头、麦克风
studentActon("mute_self"),
///学生上传文件
uploadFile("upload_file"),
///学生举手
handUp("handup"),
///老师开启自习室
openRoom("start_study_room"),
///老师关闭自习室
closeRoom("close_study_room"),
///老师开关学生的扬声器、关闭摄像头、关闭麦克风
switchStudentCamera("mute_user"),
///老师清除学生的举手
clearHandUp("clear_handup"),
///邀请学生进入白板
inviteStudent("invite_whiteboard");
final String value;
const RoomCommand(this.value);
}
enum RoomEvent {
///人员变化事件
changeUser("sys_room_user_changed"),
///学生端开启扬声器
openSpeaker("user_unmute_self_speeker"),
///学生端关闭扬声器
closeSpeaker("user_mute_self_speeker"),
///学生开启麦克风
openMic("user_unmute_self_microphone"),
///学生关闭麦克风
closeMic("user_mute_self_microphone"),
///学生开启摄像头
openCamera("user_unmute_self_camera"),
///学生关闭摄像头
closeCamera("user_mute_self_camera"),
///学生文件上传完毕
fileUploadComplete("sys_user_file_uploaded"),
///学生举手事件
handUp("sys_user_handup"),
///自习室以开启,进入自习室(学生用)
// openRoom("sys_start_study_room"),
///自习室以关闭,退出自习室(学生用)
closeRoom("sys_close_study_room"),
///老师关闭学生的扬声器
closeStudentSpeaker("sys_control_mute_speeker"),
///老师打开学生的扬声器
openStudentSpeaker("sys_control_unmute_speeker"),
///老师关闭学生的麦克风
closeStudentMic("sys_control_mute_microphone"),
///老师打开学生的麦克风
openStudentMic("sys_control_unmute_microphone"),
///老师开启学生的摄像头
openStudentCamera("sys_control_unmute_camera"),
///老师关闭学生的摄像头
closeStudentCamera("sys_control_mute_camera"),
///老师清除学生的举手(学生用)
clearHandUp("sys_clear_handup"),
///学生收到白板邀请(学生用)
inviteWhiteboard("sys_invite_whiteboard");
final String value;
const RoomEvent(this.value);
/// 根据 值获取枚举
static RoomEvent? fromStr(String value) {
for (final e in RoomEvent.values) {
if (e.value == value) return e;
}
return null; // 找不到就返回 null
}
}