int main(int argc, char **argv) { int socketFD; ue9CalibrationInfo caliInfo; if(argc < 2) { printf("Please enter an ip address to connect to.\n"); exit(0); } else if(argc > 2) { printf("Too many arguments.\nPlease enter only an ip address.\n"); exit(0); } //Opening TCP connection to UE9 if( (socketFD = openTCPConnection(argv[1], ue9_port)) < 0) goto done; //Getting calibration information from UE9 if(getCalibrationInfo(socketFD, &caliInfo) < 0) goto close; allIO(socketFD, &caliInfo); close: if(closeTCPConnection(socketFD) < 0) { printf("Error: failed to close socket\n"); return 1; } done: return 0; }
int main(int argc, char **argv) { HANDLE hDevice; ue9CalibrationInfo caliInfo; //Opening first found UE9 over USB if( (hDevice = openUSBConnection(-1)) == NULL ) goto done; //Getting calibration information from UE9 if( getCalibrationInfo(hDevice, &caliInfo) < 0 ) goto close; allIO(hDevice, &caliInfo); close: closeUSBConnection(hDevice); done: return 0; }