This commit is contained in:
@@ -262,6 +262,29 @@ void RobotRuntime::clearActiveMapIf(const std::string& map_id)
|
||||
}
|
||||
}
|
||||
|
||||
bool RobotRuntime::queueSoundPlay(const std::string& sound_id, int volume, std::string& err)
|
||||
{
|
||||
if (sound_id.empty())
|
||||
{
|
||||
err = "sound_id is required";
|
||||
return false;
|
||||
}
|
||||
int vol = volume;
|
||||
if (vol < 0)
|
||||
vol = 0;
|
||||
if (vol > 100)
|
||||
vol = 100;
|
||||
|
||||
std::lock_guard<std::mutex> lock(mu_);
|
||||
state_["sound_play"] = {{"sound_id", sound_id},
|
||||
{"volume", vol},
|
||||
{"requested_at", IdUtil::nowIso8601()}};
|
||||
state_["message"] = "Playing sound on robot";
|
||||
state_["updated_at"] = IdUtil::nowIso8601();
|
||||
saveUnlocked();
|
||||
return true;
|
||||
}
|
||||
|
||||
void RobotRuntime::tick()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mu_);
|
||||
|
||||
Reference in New Issue
Block a user