diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-04-12 21:18:13 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-04-12 21:18:13 +0200 |
commit | 5ccdcb53a36ed95f08a99863164dc2151e47c2af (patch) | |
tree | b2363d7e9f7717157230ffa9c36dca05238cc8da /ipecamera/image.c | |
parent | 445d5db0183cf5dc98a33160857f22f012cacea6 (diff) | |
download | pcitool-5ccdcb53a36ed95f08a99863164dc2151e47c2af.tar.gz pcitool-5ccdcb53a36ed95f08a99863164dc2151e47c2af.tar.bz2 pcitool-5ccdcb53a36ed95f08a99863164dc2151e47c2af.tar.xz pcitool-5ccdcb53a36ed95f08a99863164dc2151e47c2af.zip |
Allow access to implementation context and provide call to set size of internal buffer for IPECamera
Diffstat (limited to 'ipecamera/image.c')
-rw-r--r-- | ipecamera/image.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ipecamera/image.c b/ipecamera/image.c index 8899627..969071d 100644 --- a/ipecamera/image.c +++ b/ipecamera/image.c @@ -38,6 +38,7 @@ struct ipecamera_s { pcilib_register_t n_lines_reg, line_reg; pcilib_register_t exposure_reg; + int started; int buffer_size; int buf_ptr; @@ -140,6 +141,23 @@ void ipecamera_free(void *vctx) { } } +int ipecamera_set_buffer_size(ipecamera_t *ctx, int size) { + if (ctx->started) { + pcilib_error("Can't change buffer size while grabbing"); + return PCILIB_ERROR_INVALID_REQUEST; + } + + if (ctx->size < 1) { + pcilib_error("The buffer size is too small"); + return PCILIB_ERROR_INVALID_REQUEST; + } + + ctx->buffer_size = size; + + return 0; +} + + int ipecamera_reset(void *vctx) { int err; pcilib_t *pcilib; @@ -222,6 +240,11 @@ int ipecamera_start(void *vctx, pcilib_event_t event_mask, pcilib_callback_t cb, return PCILIB_ERROR_NOTINITIALIZED; } + if (ctx->started) { + pcilib_error("IPECamera grabbing is already started"); + return PCILIB_ERROR_INVALID_REQUEST; + } + ctx->cb = cb; ctx->cb_user = user; @@ -429,6 +452,11 @@ int ipecamera_trigger(void *vctx, pcilib_event_t event, size_t trigger_size, voi pcilib_error("IPECamera imaging is not initialized"); return PCILIB_ERROR_NOTINITIALIZED; } + + if (!ctx->started) { + pcilib_error("Can't trigger while not grabbing is not started"); + return PCILIB_ERROR_INVALID_REQUEST; + } err = ipecamera_get_image(ctx); if (!err) err = ctx->cb(event, ctx->event_id, ctx->cb_user); |