Created
October 13, 2021 21:20
-
-
Save grodansparadis/eba5385eddb861cbaa90025a5d85faf9 to your computer and use it in GitHub Desktop.
Windows: helper lib polling for events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (true) { | |
if (VSCP_ERROR_SUCCESS != (rv = vscphlp_isDataAvailable(handle1, &count))) { | |
printf("Failed to get available data rv = %d\n", rv); | |
Sleep(5000); | |
continue; | |
} | |
if (count) { | |
printf("There is %ud events available\n", rv); | |
vscpEventEx ex; | |
if (VSCP_ERROR_SUCCESS != (rv = vscphlp_receiveEventEx(handle1, &ex))) { | |
printf("Failed to get event rv = %d\n", rv); | |
} | |
printf("Event received: Class=%ud Type=%d\n", ex.vscp_class, ex.vscp_type); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, thats the way I do it.