Ejemplo n.º 1
0
int main(int argc, char **argv)
{
    HANDLE hDevice;
    u6CalibrationInfo caliInfo;

    //Opening first found U6 over USB
    if( (hDevice = openUSBConnection(-1)) == NULL )
        goto done;

    //Getting calibration information from U6
    if( getCalibrationInfo(hDevice, &caliInfo) < 0 )
        goto close;

    if( ConfigIO_example(hDevice) != 0 )
        goto close;

    //Stopping any previous streams
    StreamStop(hDevice);

    if( StreamConfig_example(hDevice) != 0 )
        goto close;

    if( StreamStart(hDevice) != 0 )
        goto close;

    StreamData_example(hDevice, &caliInfo);
    StreamStop(hDevice);

close:
    closeUSBConnection(hDevice);
done:
    return 0;
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
  int socketFDA, socketFDB;
  ue9CalibrationInfo caliInfo;
  socketFDA = -1;
  socketFDB = -1;

  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);
  }

  ipAddress = argv[1];

  if( (socketFDA = openTCPConnection(ipAddress, ue9_portA)) < 0)
    goto exit;

  doFlush(socketFDA);

  if( (socketFDB = openTCPConnection(ipAddress, ue9_portB)) < 0)
    goto close;

  if(getCalibrationInfo(socketFDA, &caliInfo) < 0)
    goto close;

  if(StreamConfig_example(socketFDA) != 0)
    goto close;

  if(StreamStart(socketFDA) != 0)
    goto close;

  StreamData_example(socketFDA, socketFDB, &caliInfo);
  StreamStop(socketFDA, 1);

close:
  if(closeTCPConnection(socketFDA) < 0)
    printf("Error: failed to close socket (portA)\n");
  if(closeTCPConnection(socketFDB) < 0)
    printf("Error: failed to close socket (portB)\n");
exit:
  return 0;
}