diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-08-05 19:27:19 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-08-05 19:27:19 +0200 |
commit | 5edb8d14272ea2ecd9784a26e150a45954d67e2e (patch) | |
tree | f769aca2c7fc78ccb3a291623ca5c60c124413bb /events.c | |
parent | f290bdc333b01dbc5f695236e0b72db1ac2a67d5 (diff) | |
download | ipecamera-5edb8d14272ea2ecd9784a26e150a45954d67e2e.tar.gz ipecamera-5edb8d14272ea2ecd9784a26e150a45954d67e2e.tar.bz2 ipecamera-5edb8d14272ea2ecd9784a26e150a45954d67e2e.tar.xz ipecamera-5edb8d14272ea2ecd9784a26e150a45954d67e2e.zip |
Introduce API debugging
Diffstat (limited to 'events.c')
-rw-r--r-- | events.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -32,6 +32,8 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v return PCILIB_ERROR_NOTINITIALIZED; } + ipecamera_debug(API, "ipecamera: start streaming"); + ctx->streaming = 1; ctx->run_streamer = 1; @@ -77,10 +79,11 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v ctx->streaming = 0; + ipecamera_debug(API, "ipecamera: streaming finished"); + if (do_stop) { ipecamera_stop(vctx, PCILIB_EVENT_FLAGS_DEFAULT); } - return err; } @@ -104,6 +107,8 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcili return PCILIB_ERROR_INVALID_REQUEST; } + ipecamera_debug(API, "ipecamera: next_event"); + #ifdef IPECAMERA_ANNOUNCE_READY if (((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id))) { #else /* IPECAMERA_ANNOUNCE_READY */ @@ -133,6 +138,7 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcili } if (ctx->reported_id == ctx->event_id) { + ipecamera_debug(API, "ipecamera: next_event timed out"); return PCILIB_ERROR_TIMEOUT; } @@ -149,12 +155,16 @@ retry: memcpy(info, ctx->frame + ((ctx->reported_id-1)%ctx->buffer_size), sizeof(ipecamera_event_info_t)); else if (info_size >= sizeof(pcilib_event_info_t)) memcpy(info, ctx->frame + ((ctx->reported_id-1)%ctx->buffer_size), sizeof(pcilib_event_info_t)); - else + else { + ipecamera_debug(API, "ipecamera: next_event returned a error"); return PCILIB_ERROR_INVALID_ARGUMENT; + } } if ((ctx->event_id - ctx->reported_id) >= ctx->buffer_size) goto retry; + ipecamera_debug(API, "ipecamera: next_event returned"); + return 0; } |