#include <cdevSystem.h>
#include <cdevRequestObject.h>
#include <cdevDevice.h>
#include <cdevGroup.h>
#include <cdevCommon.h>

int      fouled       = 0;
int      expectedHits = 0;
int      hits         = 0;
unsigned totalCount   = 0;

void callback ( int status, void * arg, cdevRequestObject &, cdevData &)
	{
	hits++;
	if(status!=CDEV_SUCCESS)
		{
		printf("ERROR: Transmission failure of %i\n", (int)arg);
		}
	else 	{
		fprintf(stdout, ".");
		fflush(stdout);
		}
	}
	
	
int main(void)
{
cdevCallback       cb(callback, NULL); 	
cdevRequestObject &treq = cdevRequestObject::attachRef("IPM1S01", "get VAL");


fprintf(stdout, "sending...\n");
for(int i=0; i<1000; i++) treq.sendCallback(NULL, cb);
fprintf(stdout, "waiting...\n");
while(hits<1000) cdevSystem::defaultSystem().pend(.1);
fprintf(stdout, "done.\n");

return 0;
}
