UNPKG

@neirth/sony-camera-mcp

Version:

MCP Server for controlling Sony Alpha 6100 camera

384 lines 11.2 kB
import type { RequestInit } from 'node-fetch'; export interface CameraConfig { cameraIp?: string; cameraPort?: string; ddXmlPort?: string; debug?: boolean; } export interface ServiceEndpoints { [key: string]: string; } export interface ScalarWebAPIService { name: string; endpoint: string; version: string; } export interface DeviceDescription { [key: string]: any; root?: { [key: string]: any; device?: { [key: string]: any; serviceList?: { [key: string]: any; service?: Array<any> | any; }; 'av:X_ScalarWebAPI_DeviceInfo'?: ScalarWebAPIDeviceInfo; X_ScalarWebAPI_DeviceInfo?: { [key: string]: any; X_ScalarWebAPI_ServiceList?: Array<{ X_ScalarWebAPI_Service?: Array<{ [key: string]: any; X_ScalarWebAPI_ServiceType?: string; X_ScalarWebAPI_ActionList_URL?: string | Array<string>; }>; }>; }; }; 'av:X_ScalarWebAPI_DeviceInfo'?: ScalarWebAPIDeviceInfo; }; } export interface ScalarWebAPIDeviceInfo { [key: string]: any; 'av:X_ScalarWebAPI_Version'?: string; 'av:X_ScalarWebAPI_ServiceList'?: { 'av:X_ScalarWebAPI_Service'?: Array<{ 'av:X_ScalarWebAPI_ServiceType'?: string; 'av:X_ScalarWebAPI_ActionList_URL'?: string; 'av:X_ScalarWebAPI_AccessType'?: string; }> | { 'av:X_ScalarWebAPI_ServiceType'?: string; 'av:X_ScalarWebAPI_ActionList_URL'?: string; 'av:X_ScalarWebAPI_AccessType'?: string; }; }; } export interface ScalarWebAPIInfo { endpoints: Array<{ name: string; endpoint: string; protocols?: string[]; }>; version: string; } export declare const enum CameraErrorCode { PARSE_ERROR = -32700, INVALID_REQUEST = -32600, METHOD_NOT_FOUND = -32601, INVALID_PARAMS = -32602, INTERNAL_ERROR = -32603, ILLEGAL_STATE = 7, ILLEGAL_TYPE = 8, INDEX_OUT_OF_BOUNDS = 9, NO_SUCH_ELEMENT = 10, NO_SUCH_FIELD = 11, NO_SUCH_METHOD = 12, NULL_POINTER = 13, UNSUPPORTED_VERSION = 14, UNSUPPORTED_OPERATION = 15, SHOOTING_FAIL = 40400, CAMERA_NOT_READY = 40401, ALREADY_RUNNING_POLLING_API = 40402, STILL_CAPTURING_NOT_FINISHED = 40403 } export type ShootMode = 'still' | 'movie' | 'audio' | 'intervalstill' | 'loop' | 'continuous'; export type ZoomDirection = 'in' | 'out'; export type ZoomMovement = '1shot' | 'start' | 'stop'; export type LiveviewSize = 'L' | 'M' | null; export type CameraFunction = 'Remote Shooting' | 'Contents Transfer'; /** Possible camera states during capture */ export type CameraStatus = 'IDLE' | 'NotReady' | 'StillCapturing' | 'StillSaving' | 'MovieRecording' | 'MovieSaving' | 'AudioRecording' | 'AudioSaving' | 'Continuous' | 'ContShootingReady' | 'SelfTimer' | 'BufferOverflow'; /** * Interface for camera API error * Based on the official Sony Camera API error specification */ export interface ApiError { code: CameraErrorCode; message: string; retriable?: boolean; } /** * Camera zoom information * According to getEvent specification */ export interface ZoomInformation { zoomPosition: number; zoomMaxPosition: number; zoomIndexCurrentBox: number; zoomNumberBox: number; } /** * Storage information * According to getStorageInformation specification */ export interface StorageInformation { recordTarget: boolean; storageID: string; storageDescription: string; numberOfRecordableImages: number; recordableTime: number; theSystemDateAndTime?: string; } /** * Types of service available in Sony Camera API */ /** * Available service types in Sony Camera API * According to official documentation */ export type ServiceType = 'camera' | 'guide' | 'system' | 'avContent' | 'accessControl'; /** * Endpoints for each camera service * camera is required, others are optional */ export interface CameraServiceEndpoints { camera: string; guide?: string; system?: string; avContent?: string; accessControl?: string; [key: string]: string | undefined; } /** * Strict types for Sony Camera API response format * Required format according to documentation: [ ["http://ip:port/takepicture.jpg"] ] */ export type TakePictureUrl = string; export type TakePictureUrlList = [TakePictureUrl]; export type TakePictureResult = [TakePictureUrlList]; /** * Camera event structure * According to getEvent specification v1.0, v1.1, v1.2 and v1.3 * * @see Sony_CameraRemoteAPIbeta_API-Reference_v2.40.pdf */ export interface CameraEvent { /** * Event type * Required for all events */ type: 'cameraStatus' | 'storageInformation' | 'takePicture' | 'liveviewStatus' | 'zoomInformation' | 'position' | 'shootMode' | 'beepMode' | 'exposureMode'; /** * Current camera status * @see CameraStatus for possible values */ cameraStatus?: CameraStatus; /** * Captured image URL * Format: [ ["http://ip:port/postview/postview.jpg"] ] */ takePictureUrl?: TakePictureResult; /** * Preview URLs * Array of URLs to access preview images */ postviewUrl?: string[]; /** Live streaming status */ liveviewStatus?: boolean; /** Detailed storage information */ storageInformation?: StorageInformation[]; /** Zoom information */ zoomInformation?: ZoomInformation; /** * List of available APIs at the current moment * Changes according to camera state */ availableApiList?: string[]; /** * Result of the last camera function operation * Updated after each operation */ cameraFunctionResult?: 'Success' | 'Failed' | 'Cancel'; /** * Still capture status * Information about focus and zoom position */ stillCapturingStatus?: { focused: boolean; zoomPosition: number; focusStatus?: 'Not Focusing' | 'Focusing' | 'Focused'; }; /** * Current and available shoot modes * Updated when shoot mode changes */ shootMode?: { current: ShootMode; available: ShootMode[]; }; /** * Current and available exposure modes */ exposureMode?: { current: string; available: string[]; }; /** * Sound configuration */ beepMode?: { currentBeepMode: 'Off' | 'On' | 'Shutter Only'; beepModeCandidates: ('Off' | 'On' | 'Shutter Only')[]; }; /** * Flash configuration */ flashMode?: { current: 'off' | 'auto' | 'on' | 'slowSync' | 'rearSync'; available: ('off' | 'auto' | 'on' | 'slowSync' | 'rearSync')[]; }; /** * File system information */ storageDescription?: string; numberOfRecordableImages?: number; recordableTime?: number; /** * Program state */ programShiftActivation?: boolean; /** * Additional fields that may be present depending on the API version * and the camera model */ [key: string]: any; } /** * Extended API response with detailed error information */ export interface ApiResponse<T = unknown> { result?: T[]; error?: [CameraErrorCode, string]; id: number; version: string; } export type ApiResult<T> = T extends ApiResponse<infer U> ? U : T; export type UnwrappedApiResponse<T> = T extends (infer U)[] ? U : T; export interface PhotoResult { url: string; id?: number; aspectRatio?: [number, number]; thumbnailUrl?: string; postviewUrl?: string; } export interface SSDPResponse { location: string; deviceInfo?: DeviceDescription; } export interface ExtendedRequestInit extends RequestInit { timeout?: number; } /** * Exposure mode configuration * Based on Sony Camera API documentation */ export interface ExposureSettings { /** Current exposure mode */ current: ExposureMode; /** Available exposure modes */ available: ExposureMode[]; /** Current exposure compensation */ compensation: number; /** Available compensation range [current, max, min, step] */ compensationRange: [number, number, number, number]; } /** * Supported exposure modes */ export type ExposureMode = 'Program Auto' | 'Aperture' | 'Shutter' | 'Manual' | 'Intelligent Auto' | 'Superior Auto'; /** * Detailed ISO configuration * According to Sony Camera API specification */ export interface ISOSettings { /** Current ISO value */ current: string; /** Available ISO values */ available: string[]; /** Indicates if ISO is in automatic mode */ autoMode: boolean; /** ISO range when in auto mode [min, max] */ autoRange?: [number, number]; } /** * Detailed shutter configuration */ export interface ShutterSettings { /** Current shutter speed (e.g.: "1/60") */ current: string; /** Available speeds */ available: string[]; /** Indicates if speed is automatic */ autoMode: boolean; /** Range in auto mode (if applicable) */ autoRange?: [string, string]; } /** * API response for capture operations * Ensures correct format according to documentation */ export interface CaptureResponse { /** URLs of captured images */ urls: TakePictureResult; /** Additional capture information */ captureInfo?: { /** Time taken for capture in ms */ captureTime?: number; /** Settings used for capture */ settings?: { iso?: string; shutterSpeed?: string; aperture?: string; exposureMode?: string; }; }; } /** * Camera-specific error with detailed information */ export declare class CameraError extends Error { code: CameraErrorCode; retriable: boolean; details?: Record<string, any> | undefined; constructor(code: CameraErrorCode, message: string, retriable?: boolean, details?: Record<string, any> | undefined); /** * Indicate if the error can be retried */ isRetriable(): boolean; /** * Gets a detailed description of the error */ getDetailedMessage(): string; } /** * Complete camera state * Represents the current state of all settings */ export interface CameraState { /** Main camera status */ status: CameraStatus; /** Current shoot mode */ shootMode: ShootMode; /** Exposure mode and settings */ exposure: ExposureSettings; /** ISO settings */ iso: ISOSettings; /** Shutter settings */ shutter: ShutterSettings; /** Zoom state */ zoom: ZoomInformation; /** Storage information */ storage: StorageInformation[]; /** List of available APIs in current state */ availableApis: string[]; /** Current camera function */ currentFunction: CameraFunction; /** Indicates if liveview is active */ liveviewActive: boolean; } /** * Type validation utilities */ export declare const ensureArray: <T>(value: T | T[]) => T[]; export declare const ensureTuple: <T>(value: T[]) => [T] | never; //# sourceMappingURL=models.d.ts.map