Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/routes/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,27 @@ export const camera = (base: URL, init?: RequestInit, headers?: () => Promise<He
const url = new URL('camera/connected', base)
return dispatchRequest<T>(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<T>(url, init, headers)
}
}
] as const
21 changes: 21 additions & 0 deletions tests/camera.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
})
})
})
20 changes: 20 additions & 0 deletions tests/mocks/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
]