#include #include #include #include #include #include #include #include #include void callback ( int status, void * arg, cdevRequestObject & req, cdevData & data ) { } const int DEVICE_COUNT = 9; const int MESSAGE_COUNT = 9; int main ( int argc, char ** argv ) { cdevDevice * deviceList[DEVICE_COUNT]; cdevRequestObject * reqList[DEVICE_COUNT*MESSAGE_COUNT]; cdevCallback cb(callback, NULL); cdevData data; float values[DEVICE_COUNT][MESSAGE_COUNT]; char msg[255]; int deviceCnt; int msgCnt; // ********************************************************************* // * First get all of the values from the devices and install monitors. // ********************************************************************* for(deviceCnt=0; deviceCntsend(msg, NULL, data)==CDEV_SUCCESS) { data->get("value", &values[deviceCnt][msgCnt]); } else values[deviceCnt][msgCnt] = 0; sprintf(msg, "monitorOn attrib%i", msgCnt); deviceList[deviceCnt]->sendCallback(msg, cb, NULL); sprintf(msg, "set attrib%i", msgCnt); reqList[deviceCnt*MESSAGE_COUNT+msgCnt] = deviceList[deviceCount]->getRequestObject(msg); } } // ********************************************************************* // * Finally, remove all monitors. // ********************************************************************* for(deviceCnt=0; deviceCntsendCallback(msg, cb, NULL); } } cdevSystem::defaultSystem().pend(); }