| 1865 | // ---------------------------------------------------------------------- |
| 1866 | |
| 1867 | void RenderingController::HandleGET_mxnCamera(const httplib::Request& req, httplib::Response& res) const |
| 1868 | { |
| 1869 | const auto id = ReadRequiredPathParam(req, "id"); |
| 1870 | |
| 1871 | if (!IsValidMxNWindowId(id)) |
| 1872 | { |
| 1873 | const auto error = ErrorResponse::InvalidRequest( |
| 1874 | "Malformed MxN window id '" + id + "'. Expected pattern: <prefix>__<bare> with URL-segment-safe characters.", |
| 1875 | req.path); |
| 1876 | this->SendErrorResponse(res, 400, error); |
| 1877 | return; |
| 1878 | } |
| 1879 | |
| 1880 | if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasMxNCameraGetter()) |
| 1881 | { |
| 1882 | const auto error = ErrorResponse::RenderWindowNotAvailable(req.path); |
| 1883 | this->SendErrorResponse(res, 503, error); |
| 1884 | return; |
| 1885 | } |
| 1886 | |
| 1887 | CameraState state; |
| 1888 | try |
| 1889 | { |
| 1890 | state = m_RenderWindowBridge->GetMxNCamera(id); |
| 1891 | } |
| 1892 | catch (const std::exception& e) |
| 1893 | { |
| 1894 | const auto [status, payload] = MapBridgeException(e, req.path); |
| 1895 | this->SendErrorResponse(res, status, payload); |
| 1896 | return; |
| 1897 | } |
| 1898 | |
| 1899 | res.status = 200; |
| 1900 | res.set_content(CameraStateToJson(state).dump(), "application/json"); |
| 1901 | } |
| 1902 | |
| 1903 | void RenderingController::HandlePUT_mxnCamera(const httplib::Request& req, httplib::Response& res) const |
| 1904 | { |