int main(void)
{
    int result = 1;

    if (!ReadTest(L"C:\\audio\\test.flac")) {
        printf("ReadTest failed\n");
        goto end;
    }

    if (!WriteTest(L"C:\\audio\\testW.flac")) {
        printf("WriteTest failed\n");
        goto end;
    }

    result = 0;
end:

    if (gPcmByChannel) {
        for (int ch=0; ch<gMeta.channels; ++ch) {
            delete [] gPcmByChannel[ch];
            gPcmByChannel[ch] = NULL;
        }
        delete [] gPcmByChannel;
        gPcmByChannel = NULL;
    }

    return result;
}
Beispiel #2
0
int
main(
    int argc,
    char *argv[]
    )
{
    HANDLE handle;
    int i;

    printf("\nStart %s...\n", argv[0]);

    for (i = 1; i < argc; i++) {

        switch ( *argv[i] ) {

        case 'h':
        case '?':
            DisplayUsage( argv[0] );
            break;

        case 'o':
            if ( !OpenMailslot( argv[i] + 1, &handle ) ) {
                return 3;
            }
            break;

        case 'n':
            if ( !NotifyChangeDirectoryTest() ) {
                return 3;
            }
            break;

        case 'c':
            printf( "Closing file\n" );
            NtClose( handle );
            break;

        case 'w':
            if (!WriteTest(handle)) {
                return 3;
            }
            break;

        case 'v':
            if (!QueryVolumeTest()) {
                return 3;
            }
            break;

        default:
            printf( "Unknown test ""%s"" skipped.\n", argv[i] );

        }
    }

    printf( "%s exiting\n", argv[0]);
    return 0;
}
BOOL
WriteTestCycl(
    __in CDevice *pDev,
    __in BOOLEAN ovrl
    )
{
    int ch;
    for (;;)
    {
        if(!WriteTest(pDev, ovrl)) return FALSE;
        ch = getchar();
        if(ch == EOF) break;
        putchar(ch);
    }
    return TRUE;
}
int main(int argc, char *argv[])
{
	if(argc<2)
	{
	err:
		cout << "Arguments: " << endl;
		cout << "           " << argv[0] << " r <uin>  # read test" << endl;
		cout << "           " << argv[0] << " w <uin>  # write test" << endl;
		cout << "           " << argv[0] << " rw <uin> # read and write test" << endl;
		cout << "           " << argv[0] << " wr <uin> # write and read test" << endl;
		cout << "           " << argv[0] << " pc  <subkey_num> <field_num>  # decode/encode pressure test" << endl;
		cout << "           " << argv[0] << " pe  <subkey_num> <field_num>  # extract pressure test" << endl;
		cout << "           " << argv[0] << " f        # test field api" << endl;
		return 1;
	}

	if(strcmp(argv[1], "r")==0)
	{
		if(ReadTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0)
			cout << "Read successfully." << endl;
		return 0;
	}
	if(strcmp(argv[1], "w")==0)
	{
		if(WriteTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0)
			cout << "Write successfully." << endl;
		return 0;
	}
	if(strcmp(argv[1], "rw")==0)
	{
		if(ReadTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0)
		{
			cout << "Read successfully." << endl;

			if(WriteTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0)
				cout << "Write successfully." << endl;
		}
		return 0;
	}
	if(strcmp(argv[1], "wr")==0)
	{
		if(WriteTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0)
		{
			cout << "Write successfully." << endl;

			if(ReadTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0)
				cout << "Read successfully." << endl;
		}
		return 0;
	}
	if(strcmp(argv[1], "pc")==0 && argc==4)
	{
		if(PressTest(atoi(argv[2]), atoi(argv[3]), false)==0)
			cout << "Encode/Decode press test successfully." << endl;
		return 0;
	}
	if(strcmp(argv[1], "pe")==0 && argc==4)
	{
		if(PressTest(atoi(argv[2]), atoi(argv[3]), true)==0)
			cout << "Extract press test successfully." << endl;
		return 0;
	}
	if(strcmp(argv[1], "f")==0)
	{
		if(FieldTest(1)==0)
			cout << "Field test successfully." << endl;
		return 0;
	}
	goto err;
}
Beispiel #5
0
int main(int argc, char **argv)
{
  int i;
  char ts[50];  //timestring
  int cc;       //current counter (9S08QG8)
  int hc[4];    //hour counter (9S08QG8)
  char tv[2];   //temperatur value (LM75)

  if(argc == 2){
    if(strncmp(argv[1],"-V",2) == 0){
      verbose_max = true;
      verbose = true;
    }else if(strncmp(argv[1],"-v",2) == 0){
      verbose = true;
    }else if(strncmp(argv[1],"-r",2) == 0){
      readtest = true;
    }else if(strncmp(argv[1],"-w",2) == 0){
      writetest = true;
    }else if(strncmp(argv[1],"-c",2) == 0){
      verbose = true;
      calibrate_9s08 = true;
    }else if(strncmp(argv[1],"-d",2) == 0){
      ValueToDatabase(false,"2015-07-23 00:00:00",1,2,3,10,11,12,13);
    }else if(strncmp(argv[1],"-t",2) == 0){
      verbose = true;
      ThreadPowerOff();
      return(0);
    }else if(strncmp(argv[1],"-T",2) == 0){
      //verbose_max = true;
      verbose = true;
      restoredata_9S08 = true;
    }
  }else if(argc == 4){
    if(strncmp(argv[1],"-p",2) == 0){
      printf("v1: %s\n",argv[1]);
      printf("v2: %s\n",argv[2]);
      printf("v3: %s\n",argv[3]);
      if(strncmp(argv[2],"1",1) == 0){
        int val = atoi(argv[3]);
        printf("val: %d\n",val);
        SetPWM(1,val);
      }else if(strncmp(argv[2],"2",1) == 0){
        int val = atoi(argv[3]);
        SetPWM(2,val);
      }
      return(0);
    }
  }


  if(readtest){
    ReadTest();
    return(0);
  }
  if(writetest){
    WriteTest();
    return(0);
  }
  if(calibrate_9s08){
    Calibrate9s08();
    return(0);
  }

  if(restoredata_9S08){

    BackupValueFromDatabase(&cc,&hc[0],&hc[1],&hc[2],&hc[3]);

    SetCounterValue_MC9S08QG8(cc);
    if(verbose){
      printf("counter: %d\n",cc);
    }

    for(i=0;i<4;i++){
      SetHourCounterValue_MC9S08QG8(i,hc[i]);
      if(verbose){
        printf("hourcounter [%d]: %d\n",i,hc[i]);
      }
    }

    return(0);
  }

  strcpy(ts,GetDateTimeString());
  if(verbose){
    printf("Uhrzeit: %s\n",ts);
  }

  cc = GetCounterValue_MC9S08QG8();
  if(verbose){
    printf("counter: %d\n",cc);
  }

  for(i=0;i<4;i++){
    hc[i] = GetHourCounterValue_MC9S08QG8(i);
    if(verbose){
      printf("hourcounter [%d]: %d\n",i,hc[i]);
    }
  }

  for(i=0;i<2;i++){
    tv[i] = GetTemperaturValue_LM75_8Bit(i);
    if(verbose){
      printf("LM75.%d temperature: %d\n",i,tv[i]);
    }
  }

  ValueToDatabase(false,ts,cc,tv[0],tv[1],hc[0],hc[1],hc[2],hc[3]);

  return(0);
}