diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-04-14 05:18:18 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-04-14 05:18:18 +0200 |
commit | d7143e0f1ff45449f5e69adc1a42c72eddf642d8 (patch) | |
tree | ef7b4d90c487527963e9dbe70a5b218530b4932d | |
parent | b70ed8b6ccf17a7c5b4339f05a33471eaf3b33e5 (diff) | |
download | ipecamera-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.tar.gz ipecamera-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.tar.bz2 ipecamera-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.tar.xz ipecamera-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.zip |
Accept timeout parameter to get_next_event call
-rw-r--r-- | ipecamera/image.c | 9 | ||||
-rw-r--r-- | ipecamera/image.h | 2 | ||||
-rw-r--r-- | pci.c | 4 | ||||
-rw-r--r-- | pcilib.h | 4 |
4 files changed, 12 insertions, 7 deletions
diff --git a/ipecamera/image.c b/ipecamera/image.c index 3e320cd..5d2021c 100644 --- a/ipecamera/image.c +++ b/ipecamera/image.c @@ -532,7 +532,7 @@ static int ipecamera_resolve_event_id(ipecamera_t *ctx, pcilib_event_id_t evid) return buf_ptr; } -pcilib_event_id_t ipecamera_next_event(void *vctx, pcilib_event_t event_mask) { +pcilib_event_id_t ipecamera_next_event(void *vctx, pcilib_event_t event_mask, const struct timespec *timeout) { int buf_ptr; pcilib_event_id_t reported; ipecamera_t *ctx = (ipecamera_t*)vctx; @@ -547,7 +547,12 @@ pcilib_event_id_t ipecamera_next_event(void *vctx, pcilib_event_t event_mask) { return PCILIB_EVENT_ID_INVALID; } - if ((!ctx->event_id)||(ctx->reported_id == ctx->event_id)) return PCILIB_EVENT_ID_INVALID; + if ((!ctx->event_id)||(ctx->reported_id == ctx->event_id)) { + if (timeout) { + // We should wait here for the specified timeout + } + return PCILIB_EVENT_ID_INVALID; + } // We had an overflow in event counting if (ctx->reported_id > ctx->event_id) { diff --git a/ipecamera/image.h b/ipecamera/image.h index 513449f..245e450 100644 --- a/ipecamera/image.h +++ b/ipecamera/image.h @@ -13,7 +13,7 @@ int ipecamera_reset(void *ctx); int ipecamera_start(void *ctx, pcilib_event_t event_mask, pcilib_callback_t cb, void *user); int ipecamera_stop(void *ctx); int ipecamera_trigger(void *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data); -pcilib_event_id_t ipecamera_next_event(void *ctx, pcilib_event_t event_mask); +pcilib_event_id_t ipecamera_next_event(void *ctx, pcilib_event_t event_mask, const struct timespec *timeout); void* ipecamera_get(void *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, size_t arg_size, void *arg, size_t *size); int ipecamera_return(void *ctx, pcilib_event_id_t event_id); @@ -688,7 +688,7 @@ int pcilib_stop(pcilib_t *ctx) { return 0; } -pcilib_event_id_t pcilib_get_next_event(pcilib_t *ctx, pcilib_event_t event_mask) { +pcilib_event_id_t pcilib_get_next_event(pcilib_t *ctx, pcilib_event_t event_mask, const struct timespec *timeout) { pcilib_event_api_description_t *api; pcilib_model_t model = pcilib_get_model(ctx); @@ -700,7 +700,7 @@ pcilib_event_id_t pcilib_get_next_event(pcilib_t *ctx, pcilib_event_t event_mask } if (api->next_event) - return api->next_event(ctx->event_ctx, event_mask); + return api->next_event(ctx->event_ctx, event_mask, timeout); pcilib_error("Event enumeration is not suppored by API"); return PCILIB_EVENT_ID_INVALID; @@ -134,7 +134,7 @@ typedef struct { int (*stop)(void *ctx); int (*trigger)(void *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data); - pcilib_event_id_t (*next_event)(void *ctx, pcilib_event_t event_mask); + pcilib_event_id_t (*next_event)(void *ctx, pcilib_event_t event_mask, const struct timespec *timeout); void* (*get_data)(void *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, size_t arg_size, void *arg, size_t *size); int (*return_data)(void *ctx, pcilib_event_id_t event_id); } pcilib_event_api_description_t; @@ -188,7 +188,7 @@ int pcilib_stop(pcilib_t *ctx); int pcilib_trigger(pcilib_t *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data); -pcilib_event_id_t pcilib_get_next_event(pcilib_t *ctx, pcilib_event_t event_mask); +pcilib_event_id_t pcilib_get_next_event(pcilib_t *ctx, pcilib_event_t event_mask, const struct timespec *timeout); void *pcilib_get_data(pcilib_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, size_t *size); void *pcilib_get_data_with_argument(pcilib_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, size_t arg_size, void *arg, size_t *size); /* |