/alps/ipecamera

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to ipecamera/events.c

  • Committer: Suren A. Chilingaryan
  • Date: 2011-12-13 17:54:51 UTC
  • Revision ID: csa@dside.dyndns.org-20111213175451-xf1h4kvsme91otd5
Do not call the normall callback in the raw-data-only mode

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        do_stop = 1;
47
47
    }
48
48
    
49
 
        // This loop iterates while the generation
50
 
    while ((run_flag)&&((ctx->run_streamer)||(ctx->reported_id != ctx->event_id))) {
 
49
    if (ctx->parse_data) {
 
50
            // This loop iterates while the generation
 
51
        while ((run_flag)&&((ctx->run_streamer)||(ctx->reported_id != ctx->event_id))) {
51
52
#ifdef IPECAMERA_ANNOUNCE_READY
52
 
        while (((!ctx->preproc)&&(ctx->reported_id != ctx->event_id))||((ctx->preproc)&&(ctx->reported_id != ctx->preproc_id))) {
 
53
            while (((!ctx->preproc)&&(ctx->reported_id != ctx->event_id))||((ctx->preproc)&&(ctx->reported_id != ctx->preproc_id))) {
53
54
#else /* IPECAMERA_ANNOUNCE_READY */
54
 
        while (ctx->reported_id != ctx->event_id) {
 
55
            while (ctx->reported_id != ctx->event_id) {
55
56
#endif /* IPECAMERA_ANNOUNCE_READY */
56
 
            if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1) - IPECAMERA_RESERVE_BUFFERS;
57
 
            else ++ctx->reported_id;
58
 
 
59
 
            memcpy(&info, ctx->frame + ((ctx->reported_id-1)%ctx->buffer_size), sizeof(ipecamera_event_info_t));
60
 
 
61
 
            if ((ctx->event_id - ctx->reported_id) < ctx->buffer_size) {
62
 
                res = callback(ctx->reported_id, (pcilib_event_info_t*)&info, user);
63
 
                if (res <= 0) {
64
 
                    if (res < 0) err = -res;
65
 
                    run_flag = 0;
66
 
                    break;
 
57
                if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1) - IPECAMERA_RESERVE_BUFFERS;
 
58
                else ++ctx->reported_id;
 
59
 
 
60
                memcpy(&info, ctx->frame + ((ctx->reported_id-1)%ctx->buffer_size), sizeof(ipecamera_event_info_t));
 
61
 
 
62
                if ((ctx->event_id - ctx->reported_id) < ctx->buffer_size) {
 
63
                    res = callback(ctx->reported_id, (pcilib_event_info_t*)&info, user);
 
64
                    if (res <= 0) {
 
65
                        if (res < 0) err = -res;
 
66
                        run_flag = 0;
 
67
                        break;
 
68
                    }
67
69
                }
68
70
            }
69
 
        }
70
 
        usleep(IPECAMERA_NOFRAME_SLEEP);
 
71
            usleep(IPECAMERA_NOFRAME_SLEEP);
 
72
        }
 
73
    } else {
 
74
        while ((run_flag)&&(ctx->run_streamer)) {
 
75
            usleep(IPECAMERA_NOFRAME_SLEEP);
 
76
        }
71
77
    }
72
78
 
73
79
    ctx->streaming = 0;
93
99
        pcilib_error("IPECamera is not in grabbing mode");
94
100
        return PCILIB_ERROR_INVALID_REQUEST;
95
101
    }
 
102
    
 
103
    if (!ctx->parse_data) {
 
104
        pcilib_error("RAWData only mode is requested");
 
105
        return PCILIB_ERROR_INVALID_REQUEST;
 
106
    }
96
107
 
97
108
#ifdef IPECAMERA_ANNOUNCE_READY
98
109
    if (((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id))) {