Skip to content

Instantly share code, notes, and snippets.

@grodansparadis
Created October 13, 2021 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grodansparadis/eba5385eddb861cbaa90025a5d85faf9 to your computer and use it in GitHub Desktop.
Save grodansparadis/eba5385eddb861cbaa90025a5d85faf9 to your computer and use it in GitHub Desktop.
Windows: helper lib polling for events
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);
}
}
@BlueAndi
Copy link

Yes, thats the way I do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment