bool AAGCloudWatcher::Connect() { if (cwc == NULL) { ITextVectorProperty *tvp = getText("serial"); if (!tvp) { return false; } // IDLog("%s\n", tvp->tp[0].text); cwc = new CloudWatcherController(tvp->tp[0].text, false); int check = cwc->checkCloudWatcher(); if (check) { IDMessage(getDefaultName(), "Connected to AAG Cloud Watcher\n"); sendConstants(); IEAddTimer(1., ISPoll, this); // Create a timer to send parameters } else { IDMessage(getDefaultName(), "Could not connect to AAG Cloud Watcher. Check port and / or cable.\n"); delete cwc; cwc = NULL; return false; } } return true; }
int main(void) { BYTE init[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; #ifdef SW init_pipe_handler(); PTHREAD_DECL(Daemon); PTHREAD_CREATE(Daemon); #endif sendConstants(); int i, run; long long t1[10], t2[10]; for (run = 0; run < 10; run++) { fprintf(stderr," run %d.\n", run); for (i = 0; i < 16; i++) { write_uint8("input_block_pipe", init[i]); fprintf(stderr," wrote %x \n", init[i]); } for (i = 0; i < 16; i++) { uint8_t rV = read_uint8("output_block_pipe"); fprintf(stderr," read-back %x \n", rV); } } #ifdef SW close_pipe_handler(); PTHREAD_CANCEL(Daemon); #endif return 0; }