import assert from "node:assert" ; import { ReadonlyDeep , } from "type-fest" ; import { ControlName , } from "uvc-control" ; import CameraHelper from "../camera-helper.js" ; import { Command , CommandHandlerArgumentCameraHelper , CommandHandlerArgumentNames , } from "../types/command.js" ; import flattenControlValues from "../utilities/flatten-control-values.js" ; export default class GetCommand implements Command { constructor ( ) { assert . strictEqual ( arguments . length , 0 ) ; } async getArguments ( ) { return [ CommandHandlerArgumentCameraHelper , "control" , ] ; } async execute ( ... args ) { assert . strictEqual ( arguments . length , 2 ) ; const cameraHelper = args [ 0 ] as ReadonlyDeep < CameraHelper > ; const controlName = args [ 1 ] as ControlName ; const valueObject = await cameraHelper . getValues ( controlName ) ; const value = flattenControlValues ( valueObject ) ; return value ; } }