Skip to content

Commit 2cfb529

Browse files
committed
fix(cloud): cherry-pick roiPosition validation fix (cec8eb8)
CameraRoiPosition is a string union ('center' | 'top' | 'bottom') not a number. Original fix was on origin/dev but our initial merge used stale local dev. Cherry-picked instead of re-merging to avoid 40+ mobile conflicts from SRT refactor. Locally verified: types, sdk, cloud all build clean (zero TS errors).
1 parent 3686449 commit 2cfb529

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cloud/packages/cloud/src/services/session/handlers/app-message-handler.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
PermissionType,
3131
RgbLedControlRequest,
3232
CameraFovSetRequest,
33+
CameraRoiPosition,
3334
OwnershipReleaseMessage,
3435
AppStateChange,
3536
} from "@mentra/sdk";
@@ -327,13 +328,14 @@ async function handleCameraFovSet(
327328

328329
// Validate FOV and ROI values before forwarding to glasses
329330
const SUPPORTED_FOV = [82, 92, 102, 118];
331+
const VALID_ROI_POSITIONS: CameraRoiPosition[] = ["center", "top", "bottom"];
330332
const { fov, roiPosition } = message;
331-
if (!SUPPORTED_FOV.includes(fov) || roiPosition < 0 || roiPosition > 2) {
333+
if (!SUPPORTED_FOV.includes(fov) || !VALID_ROI_POSITIONS.includes(roiPosition)) {
332334
logger.warn({ fov, roiPosition, packageName: message.packageName }, "Invalid camera FOV/ROI values");
333335
sendError(
334336
appWebsocket,
335337
AppErrorCode.MALFORMED_MESSAGE,
336-
`Invalid FOV/ROI: fov must be one of [${SUPPORTED_FOV.join(", ")}], roiPosition must be 0-2`,
338+
`Invalid FOV/ROI: fov must be one of [${SUPPORTED_FOV.join(", ")}], roiPosition must be one of ${VALID_ROI_POSITIONS.map((p) => `"${p}"`).join(", ")}`,
337339
logger,
338340
);
339341
return;

0 commit comments

Comments
 (0)