Skip to content

Commit

Permalink
feat: adds CameraListItem interface and updates RoomConfiguration to …
Browse files Browse the repository at this point in the history
…include
  • Loading branch information
ndorin committed Jun 29, 2024
1 parent 520695c commit b4f1f6b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/shared/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export * from "./interfaces";
export * from "./useDeviceIBasicVolumeWithFeedback";
export * from "./useGetDeviceStateFromRoomConfiguration";
export * from "./useHeldButtonAction";
export * from "./useOverflow";
export * from "./usePressHoldRelease";
export * from "./useRoomIBasicVolumeWithFeedback";
export * from "./useScroll";
export * from "./useSystemControl";
export * from "./useTimeAndDate";
export * from "./useOverflow";
export * from "./useScroll";
35 changes: 35 additions & 0 deletions src/lib/shared/hooks/interfaces/useCameraBase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { CameraState, PressHoldReleaseReturn, useGetDevice, useWebsocketContext } from 'src/lib';
import { useButtonHeldHeartbeat } from '../useHeldButtonAction';


export function useCameraBase(key: string): CameraBaseProps | undefined{
const { sendMessage } = useWebsocketContext();
const path = `/device/${key}`;
const cameraState = useGetDevice<CameraState>(key);


const up = useButtonHeldHeartbeat(path, 'cameraUp');
const down = useButtonHeldHeartbeat(path, 'cameraDown');
const left = useButtonHeldHeartbeat(path, 'cameraLeft');
const right = useButtonHeldHeartbeat(path, 'cameraRight');
const zoomIn = useButtonHeldHeartbeat(path, 'cameraZoomIn');
const zoomOut = useButtonHeldHeartbeat(path, 'cameraZoomOut');

const recallPreset = (presetNumber: number) => sendMessage('/camera/recallPreset', presetNumber);


if(!cameraState) return undefined;

return { state: cameraState, zoomIn, zoomOut, up, down, left, right, recallPreset};
}

export interface CameraBaseProps {
state: CameraState;
zoomIn: PressHoldReleaseReturn;
zoomOut: PressHoldReleaseReturn;
up: PressHoldReleaseReturn;
down: PressHoldReleaseReturn;
left: PressHoldReleaseReturn;
right: PressHoldReleaseReturn;
recallPreset: (presetNumber: number) => void;
}
11 changes: 11 additions & 0 deletions src/lib/types/state/CameraListItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { IconNames } from 'src/lib/shared/Icons/iconsDictionary';

export interface CameraListItem {
deviceKey: string;
name: string;
preferredName: string;
icon: IconNames;
altIcon: IconNames;
includeInUserList: boolean;
order: number;
}
4 changes: 3 additions & 1 deletion src/lib/types/state/state/RoomState.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable max-classes-per-file */

import { PresetListItem } from '..';
import { CameraListItem } from '../CameraListItem';
import { DestinationListItem } from '../DestinationListItem';
import { LevelControlListItem } from '../LevelControlListItem';
import { SourceListItem } from '../sourceListItem';
Expand All @@ -27,6 +28,8 @@ export interface RoomState extends DeviceState{
export interface RoomConfiguration {
accessoryDeviceKeys?: string[];
audioCodecKey?: string;
audioControlPointList: AudioControlPointListItem;
cameraList?: Record<string, CameraListItem>;
ciscoNavigatorKey?: string;
defaultDisplayKey?: string;
defaultPresentationSourceKey: string;
Expand All @@ -38,7 +41,6 @@ export interface RoomConfiguration {
hasEnvironmentalControls?: boolean;
hasVideoConferencing?: boolean;
helpMessage?: string;
audioControlPointList: AudioControlPointListItem;
matrixRoutingKey?: string;
roomCombinerKey?: string;
sourceList: Record<string, SourceListItem>;
Expand Down

0 comments on commit b4f1f6b

Please sign in to comment.