vscphlp_isDataAvailable

int vscphlp_isDataAvailable( long handle, 
                                unsigned int *pCount )
int pyvscphlp_isDataAvailable( handle, count )

Parameters

handle

Handle for the communication channel obtained from a call to vscphlp_newsession.

pCount (c/c++)

Pointer to variable that gets the number of events waiting in the queue on a successful call.

count (Python)

Variable that gets the number of events waiting in the queue on a successful call.

Return Value

Return VSCP_ERROR_SUCCESS on success, VSCP_ERROR_ERROR on failure. If the connection is closed VSCP_ERROR_CONNECTION is returned. VSCP_ERROR_PARAMETER is returned if called while in a receive loop.

Description

Check the number of events (if any) that are available in the remote input queue.

Example

// Check queue for events
if ( VSCP_ERROR_SUCCESS == (rv = vscphlp_isDataAvailable( handle2, &count ) ) ) {
     printf( "Command success: vscphlp_isDataAvailable on handle2\n" );
    printf( "count = %d\n", count );
        if ( 3 == count ) printf("Which is correct.\n");
}
else {
    printf("\aCommand error: vscphlp_isDataAvailable on channel 2  Error code=%d\n", rv);
}
print "Waiting for incoming data..."

cntAvailable = ctypes.c_uint(0)
while cntAvailable.value==0:
    print 'Still waiting...'
    time.sleep(1)
    pyvscphlp_isDataAvailable(h1,cntAvailable)

print '%d event(s) is available' % cntAvailable.value

for i in range(0,cntAvailable.value):
    ex = vscpEventEx()
    if VSCP_ERROR_SUCCESS == pyvscphlp_receiveEventEx(h1,ex):
        ex.dump()

Very Simple Control Protocol
This document is licensed under Creative Commons BY 4.0 and can be freely copied, redistributed, remixed, transformed, built upon as long as you give credits to the author((s).

results matching ""

    No results matching ""