| 1161 | } |
| 1162 | |
| 1163 | void RenderingController::HandleGET_stdmultiCamera(const httplib::Request& req, httplib::Response& res) const |
| 1164 | { |
| 1165 | const auto id = ReadRequiredPathParam(req, "id"); |
| 1166 | |
| 1167 | if (!IsValidStdMultiWindowId(id)) |
| 1168 | { |
| 1169 | const auto error = ErrorResponse::RenderWindowNotFound(id, req.path); |
| 1170 | this->SendErrorResponse(res, 404, error); |
| 1171 | return; |
| 1172 | } |
| 1173 | |
| 1174 | if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasStdMultiCameraGetter()) |
| 1175 | { |
| 1176 | const auto error = ErrorResponse::RenderWindowNotAvailable(req.path); |
| 1177 | this->SendErrorResponse(res, 503, error); |
| 1178 | return; |
| 1179 | } |
| 1180 | |
| 1181 | CameraState state; |
| 1182 | try |
| 1183 | { |
| 1184 | state = m_RenderWindowBridge->GetStdMultiCamera(id); |
| 1185 | } |
| 1186 | catch (const std::exception& e) |
| 1187 | { |
| 1188 | const auto [status, payload] = MapBridgeException(e, req.path); |
| 1189 | this->SendErrorResponse(res, status, payload); |
| 1190 | return; |
| 1191 | } |
| 1192 | |
| 1193 | const auto j = CameraStateToJson(state); |
| 1194 | res.status = 200; |
| 1195 | res.set_content(j.dump(), "application/json"); |
| 1196 | } |
| 1197 | |
| 1198 | void RenderingController::HandlePUT_stdmultiCamera(const httplib::Request& req, httplib::Response& res) const |
| 1199 | { |