feat: 增加对讲

This commit is contained in:
zhanghao 2026-07-22 09:37:34 +08:00
parent 21adafc3be
commit d1e139ad71
8 changed files with 255 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import "cmvr/api/arm_command.proto";
service ArmService { service ArmService {
rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback); rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback);
rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback); rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback);
rpc clearFault(CommandHeader.Request) returns (CommandHeader.Feedback);
rpc moveJ(MoveJ.Request) returns (MoveJ.Response); rpc moveJ(MoveJ.Request) returns (MoveJ.Response);
rpc moveL(MoveL.Request) returns (MoveL.Response); rpc moveL(MoveL.Request) returns (MoveL.Response);
rpc speedJ(SpeedJ.Request) returns (SpeedJ.Response); rpc speedJ(SpeedJ.Request) returns (SpeedJ.Response);

View File

@ -29,6 +29,22 @@ message CommandHeader {
} }
} }
message AudioData {
enum AudioFormat {
PCM = 0;
MP3 = 1;
AAC = 2;
WAV = 3;
}
bytes data = 1;
int32 sample_rate = 2;
int32 channels = 3;
AudioFormat format = 4;
string codec = 5;
int64 pts = 6;
int32 nb_samples = 7;
}
message ConfigParam { message ConfigParam {
string param_name = 1; string param_name = 1;

View File

@ -0,0 +1,92 @@
syntax = "proto3";
import "cmvr/api/common.proto";
package cmvr.api;
message MicState {
bool is_initialized = 1;
bool is_running = 2;
bool is_recording = 3;
int32 volume = 4;
string error_message = 5;
}
message GetMicStateCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
MicState state = 2;
}
}
message StartMicRecordingCommand {
message Request {
CommandHeader.Request header = 1;
string file_path = 2;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message StopMicRecordingCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message PauseMicRecordingCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message ResumeMicRecordingCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message StreamMicAudioCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
AudioData audio = 2;
}
}
message SetMicPhoneVolumeCommand {
message Request {
CommandHeader.Request header = 1;
int32 volume = 2;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message GetMicPhoneVolumeCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
int32 volume = 2;
}
}

View File

@ -0,0 +1,17 @@
syntax = "proto3";
import "cmvr/api/microphone_command.proto";
package cmvr.api;
service MicPhoneService {
rpc GetStatus(GetMicStateCommand.Request) returns (GetMicStateCommand.Feedback);
rpc StartRecord(StartMicRecordingCommand.Request) returns (StartMicRecordingCommand.Feedback);
rpc StopRecord(StopMicRecordingCommand.Request) returns (StopMicRecordingCommand.Feedback);
rpc PauseRecord(PauseMicRecordingCommand.Request) returns (PauseMicRecordingCommand.Feedback);
rpc ResumeRecord(ResumeMicRecordingCommand.Request) returns (ResumeMicRecordingCommand.Feedback);
rpc StreamAudio(StreamMicAudioCommand.Request) returns (stream StreamMicAudioCommand.Feedback);
rpc SetVolume(SetMicPhoneVolumeCommand.Request) returns (SetMicPhoneVolumeCommand.Feedback);
rpc GetVolume(GetMicPhoneVolumeCommand.Request) returns (GetMicPhoneVolumeCommand.Feedback);
}

View File

@ -0,0 +1,92 @@
syntax = "proto3";
import "cmvr/api/common.proto";
package cmvr.api;
message SpeakerState {
bool is_initialized = 1;
bool is_running = 2;
bool is_decoding = 3;
bool is_paused = 5;
int32 volume = 6;
string error_message = 7;
}
message GetSpeakerStateCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
SpeakerState state = 2;
}
}
message PlayAudioCommand {
message Request {
CommandHeader.Request header = 1;
string audio_path = 2;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message StreamSpeakerAudioCommand {
message Request {
CommandHeader.Request header = 1;
AudioData audio = 2;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message StopSpeakerCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message PauseSpeakerCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message ResumeSpeakerCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message SetSpeakerVolumeCommand {
message Request {
CommandHeader.Request header = 1;
int32 volume = 2;
}
message Feedback {
CommandHeader.Feedback header = 1;
}
}
message GetSpeakerVolumeCommand {
message Request {
CommandHeader.Request header = 1;
}
message Feedback {
CommandHeader.Feedback header = 1;
int32 volume = 2;
}
}

View File

@ -0,0 +1,17 @@
syntax = "proto3";
import "cmvr/api/speaker_command.proto";
package cmvr.api;
service SpeakerService {
rpc GetStatus(GetSpeakerStateCommand.Request) returns (GetSpeakerStateCommand.Feedback);
rpc PlayAudio(PlayAudioCommand.Request) returns (PlayAudioCommand.Feedback);
rpc StreamAudio(stream StreamSpeakerAudioCommand.Request) returns (StreamSpeakerAudioCommand.Feedback);
rpc StopPlayback(StopSpeakerCommand.Request) returns (StopSpeakerCommand.Feedback);
rpc PausePlayback(PauseSpeakerCommand.Request) returns (PauseSpeakerCommand.Feedback);
rpc ResumePlayback(ResumeSpeakerCommand.Request) returns (ResumeSpeakerCommand.Feedback);
rpc SetVolume(SetSpeakerVolumeCommand.Request) returns (SetSpeakerVolumeCommand.Feedback);
rpc GetVolume(GetSpeakerVolumeCommand.Request) returns (GetSpeakerVolumeCommand.Feedback);
}

View File

@ -37,7 +37,12 @@ import Camera from './camera/index.vue'
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import autofit from 'autofit.js' import autofit from 'autofit.js'
autofit.init() autofit.init({
designHeight: 1080,
designWidth: 1920,
renderDom: '#app',
resize: true
})
const router = useRouter() const router = useRouter()
@ -78,12 +83,25 @@ const back = () => {
router.back() router.back()
} }
const resetAutoFit = () => {
autofit.destroy() //
autofit.init({
designHeight: 1080,
designWidth: 1920,
renderDom: '#app',
resize: true
})
}
let clockTimer, binaryTimer; let clockTimer, binaryTimer;
onMounted(() => { onMounted(() => {
updateClock(); updateClock();
clockTimer = setInterval(updateClock, 1000); clockTimer = setInterval(updateClock, 1000);
animateBinary() animateBinary()
binaryTimer = setInterval(animateBinary, 400); binaryTimer = setInterval(animateBinary, 400);
document.addEventListener('fullscreenchange', resetAutoFit)
document.addEventListener('webkitfullscreenchange', resetAutoFit)
}) })
onUnmounted(() => { onUnmounted(() => {

View File

@ -523,7 +523,7 @@ onUnmounted(() => {
margin-bottom: 12px; margin-bottom: 12px;
.number { .number {
width: 180px; width: 170px;
border-radius: 5px; border-radius: 5px;
padding: 6px; padding: 6px;
background: $color-background-card; background: $color-background-card;