diff --git a/src/routes/camera.ts b/src/routes/camera.ts index d8ba94c..9c1f595 100644 --- a/src/routes/camera.ts +++ b/src/routes/camera.ts @@ -22,5 +22,27 @@ export const camera = (base: URL, init?: RequestInit, headers?: () => Promise(url, init, headers) } + }, + { + name: 'getConfiguration', + action: < + T = { + asymmetricBin: boolean + binX: number + binY: number + ccdXSize: number + ccdYSize: number + fastReadOut: boolean + fullWellCapacity: number + gain: number + maxExposure: number + minExposure: number + pixelSizeX: number + pixelSizeY: number + } + >() => { + const url = new URL('camera/config', base) + return dispatchRequest(url, init, headers) + } } ] as const diff --git a/tests/camera.spec.ts b/tests/camera.spec.ts index a8f4eca..16c7f6d 100644 --- a/tests/camera.spec.ts +++ b/tests/camera.spec.ts @@ -25,5 +25,26 @@ suite('@observerly/hyper Fiber API Observing Camera Client', () => { if (!isDataResult(isConnected)) return expect(isConnected).toStrictEqual({ connected: true }) }) + + it('should be able to get the configuration of the camera', async () => { + const client = setupClient(getURL('/api/v1/')) + const configuration = await client.camera.getConfiguration() + expect(isDataResult(configuration)).toBe(true) + if (!isDataResult(configuration)) return + expect(configuration).toStrictEqual({ + asymmetricBin: false, + binX: 1, + binY: 1, + ccdXSize: 0, + ccdYSize: 0, + fastReadOut: false, + fullWellCapacity: 0, + gain: 0, + maxExposure: 0, + minExposure: 0, + pixelSizeX: 0, + pixelSizeY: 0 + }) + }) }) }) diff --git a/tests/mocks/camera.ts b/tests/mocks/camera.ts index dcb6517..a099ec4 100644 --- a/tests/mocks/camera.ts +++ b/tests/mocks/camera.ts @@ -21,5 +21,25 @@ export const cameraHandlers: Handler[] = [ connected: true } }) + }, + { + method: 'GET', + url: '/api/v1/camera/config', + handler: eventHandler(_event => { + return { + asymmetricBin: false, + binX: 1, + binY: 1, + ccdXSize: 0, + ccdYSize: 0, + fastReadOut: false, + fullWellCapacity: 0, + gain: 0, + maxExposure: 0, + minExposure: 0, + pixelSizeX: 0, + pixelSizeY: 0 + } + }) } ]