From 31fced3ab6c7829ea842eddd2f8f2589628b95ab Mon Sep 17 00:00:00 2001 From: Baku Hashimoto Date: Wed, 27 Sep 2023 13:57:21 +0900 Subject: [PATCH] Create UnsupportedOperationResult --- src/Tethr.ts | 102 ++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/src/Tethr.ts b/src/Tethr.ts index 348f087..6fda0ff 100644 --- a/src/Tethr.ts +++ b/src/Tethr.ts @@ -83,6 +83,10 @@ export const UnsupportedConfigDesc: ConfigDesc = { value: null, } +export const UnsupportedOperationResult: OperationResult = { + status: 'unsupported', +} + export function createReadonlyConfigDesc(value: T): ConfigDesc { return { writable: false, @@ -195,7 +199,7 @@ export abstract class Tethr return this.setWhiteBalance(value as WhiteBalance) } - return {status: 'unsupported'} + return UnsupportedOperationResult } async getDesc( @@ -303,7 +307,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: Aperture ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getApertureDesc(): Promise> { return UnsupportedConfigDesc @@ -316,7 +320,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: BatteryLevel ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getBatteryLevelDesc(): Promise> { return UnsupportedConfigDesc @@ -329,7 +333,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getBurstIntervalDesc(): Promise> { return UnsupportedConfigDesc @@ -342,7 +346,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getBurstNumberDesc(): Promise> { return UnsupportedConfigDesc @@ -355,7 +359,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: boolean ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getCanRunAutoFocusDesc(): Promise> { return UnsupportedConfigDesc @@ -368,7 +372,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: boolean ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getCanRunManualFocusDesc(): Promise> { return UnsupportedConfigDesc @@ -381,7 +385,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: boolean ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getCanStartLiveviewDesc(): Promise> { return UnsupportedConfigDesc @@ -394,7 +398,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: boolean ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getCanTakePhotoDesc(): Promise> { return UnsupportedConfigDesc @@ -407,7 +411,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getCaptureDelayDesc(): Promise> { return UnsupportedConfigDesc @@ -420,7 +424,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getColorModeDesc(): Promise> { return UnsupportedConfigDesc @@ -433,7 +437,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getColorTemperatureDesc(): Promise> { return UnsupportedConfigDesc @@ -446,7 +450,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getCompressionSettingDesc(): Promise> { return UnsupportedConfigDesc @@ -459,7 +463,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getContrastDesc(): Promise> { return UnsupportedConfigDesc @@ -472,7 +476,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: Date ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getDateTimeDesc(): Promise> { return UnsupportedConfigDesc @@ -485,7 +489,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getDestinationToSaveDesc(): Promise> { return UnsupportedConfigDesc @@ -498,7 +502,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getDigitalZoomDesc(): Promise> { return UnsupportedConfigDesc @@ -511,7 +515,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: DriveMode ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getDriveModeDesc(): Promise> { return UnsupportedConfigDesc @@ -524,7 +528,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getExposureCompDesc(): Promise> { return UnsupportedConfigDesc @@ -537,7 +541,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getExposureMeteringModeDesc(): Promise< ConfigDesc @@ -552,7 +556,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: ExposureMode ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getExposureModeDesc(): Promise> { return UnsupportedConfigDesc @@ -565,7 +569,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getFacingModeDesc(): Promise> { return UnsupportedConfigDesc @@ -578,7 +582,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: FlashMode ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getFlashModeDesc(): Promise> { return UnsupportedConfigDesc @@ -591,7 +595,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: FocalLength ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getFocalLengthDesc(): Promise> { return UnsupportedConfigDesc @@ -604,7 +608,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getFocusDistanceDesc(): Promise> { return UnsupportedConfigDesc @@ -617,7 +621,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: FocusMeteringMode ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getFocusMeteringModeDesc(): Promise> { return UnsupportedConfigDesc @@ -630,7 +634,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: FocusMode ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getFocusModeDesc(): Promise> { return { @@ -646,7 +650,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: FunctionalMode ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getFunctionalModeDesc(): Promise> { return UnsupportedConfigDesc @@ -659,7 +663,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getImageAspectDesc(): Promise> { return UnsupportedConfigDesc @@ -672,7 +676,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getImageQualityDesc(): Promise> { return UnsupportedConfigDesc @@ -685,7 +689,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getImageSizeDesc(): Promise> { return UnsupportedConfigDesc @@ -698,7 +702,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: ISO ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getIsoDesc(): Promise> { return UnsupportedConfigDesc @@ -711,7 +715,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: boolean ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getLiveviewEnabledDesc(): Promise> { return UnsupportedConfigDesc @@ -724,7 +728,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getLiveviewMagnifyRatioDesc(): Promise> { return UnsupportedConfigDesc @@ -737,7 +741,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getLiveviewSizeDesc(): Promise> { return UnsupportedConfigDesc @@ -750,7 +754,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: ManualFocusOption[] ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getManualFocusOptionsDesc(): Promise> { return UnsupportedConfigDesc @@ -763,7 +767,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getManufacturerDesc(): Promise> { return UnsupportedConfigDesc @@ -776,7 +780,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getModelDesc(): Promise> { return UnsupportedConfigDesc @@ -789,7 +793,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getSerialNumberDesc(): Promise> { return UnsupportedConfigDesc @@ -802,7 +806,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getSharpnessDesc(): Promise> { return UnsupportedConfigDesc @@ -815,7 +819,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: string ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getShutterSpeedDesc(): Promise> { return UnsupportedConfigDesc @@ -828,7 +832,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getTimelapseIntervalDesc(): Promise> { return UnsupportedConfigDesc @@ -841,7 +845,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: number ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getTimelapseNumberDesc(): Promise> { return UnsupportedConfigDesc @@ -854,7 +858,7 @@ export abstract class Tethr // eslint-disable-next-line @typescript-eslint/no-unused-vars value: WhiteBalance ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async getWhiteBalanceDesc(): Promise> { return UnsupportedConfigDesc @@ -862,27 +866,27 @@ export abstract class Tethr // Actions async runAutoFocus(): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async runManualFocus( // eslint-disable-next-line @typescript-eslint/no-unused-vars option: ManualFocusOption ): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } async takePhoto( // eslint-disable-next-line @typescript-eslint/no-unused-vars option?: TakePhotoOption ): Promise> { - return {status: 'unsupported'} + return UnsupportedOperationResult } async startLiveview(): Promise> { - return {status: 'unsupported'} + return UnsupportedOperationResult } async stopLiveview(): Promise { - return {status: 'unsupported'} + return UnsupportedOperationResult } }