Ejemplo n.º 1
0
NjbMediaDevice::NjbMediaDevice(): MediaDevice()
{

    //	listPanaPlayLists = new QListView();
    m_name = i18n("NJB Media device");
    m_njb = 0;
    m_connected = false;
    m_libcount = 0;
    m_connected = false;
    m_customButton = true;
    m_td = 0;
    NJB_Set_Debug(0); // or try DD_SUBTRACE
    KToolBarButton* customButton = MediaBrowser::instance()->getToolBar()->getButton( MediaBrowser::CUSTOM );
    customButton->setText( i18n("Special device functions") );
    QToolTip::remove( customButton );
    QToolTip::add( customButton, i18n( "Special functions of your jukebox" ) );
}
Ejemplo n.º 2
0
int main (int argc, char **argv)
{
  njb_t njbs[NJB_MAX_DEVICES], *njb;
  u_int32_t id;
  int n, debug, syntax, opt;
  extern int optind;
  extern char *optarg;
  char *endptr;
  
  debug = 0;
  syntax = 0;
  
  while ( (opt = getopt(argc, argv, "D:")) != -1 ) {
    switch (opt) {
    case 'D':
      debug= atoi(optarg);
      break;
    default:
      usage();
    }
  }
  argc -= optind;
  argv += optind;
  
  if ( argc != 1 ) usage();
  
  id = strtoul(argv[0], &endptr, 10);
  if ( endptr[0] != '\0' ) {
    fprintf(stderr, "invalid file id %s\n", argv[0]);
    return 1;
  }
  
  if ( debug ) NJB_Set_Debug(debug);
  
  if ( NJB_Discover(njbs, 0, &n) == -1 ) {
    fprintf(stderr, "could not probe for NJB devices\n");
    return 1;
  }
  if ( n == 0 ) {
    fprintf(stderr, "no NJB devices found\n");
    return 0;
  }
  
  njb = njbs;
  
  if ( NJB_Open(njb) == -1 ) {
    NJB_Error_Dump(njb, stderr);
    return 1;
  }
  
  if ( NJB_Capture(njb) == -1 ) {
    NJB_Error_Dump(njb, stderr);
    return 1;
  }
  
  if ( NJB_Delete_Datafile(njb, id) == -1 ) {
    NJB_Error_Dump(njb, stderr);
  }
  
  NJB_Release(njb);
  
  NJB_Close(njb);
  
  return 0;
}
Ejemplo n.º 3
0
int main (int argc, char **argv)
{
  njb_t njbs[NJB_MAX_DEVICES], *njb;
  extern char *optarg;
  int opt;
  int n, debug;
  njb_datafile_t *filetag;
  char *lang;
  
  debug= 0;
  while ( (opt= getopt(argc, argv, "D:")) != -1 ) {
    switch (opt) {
    case 'D':
      debug= atoi(optarg);
      break;
    default:
      fprintf(stderr, "usage: tracks [ -D debuglvl ]\n");
      return 1;
    }
  }
  
  if ( debug ) NJB_Set_Debug(debug);
  
  /*
   * Check environment variables $LANG and $LC_CTYPE
   * to see if we want to support UTF-8 unicode
   * $LANG = "xx_XX.UTF-8" or $LC_CTYPE = "?"
   * trigger unicode support.
   */
  lang = getenv("LANG");
  if (lang != NULL) {
    if (strlen(lang) > 5) {
      if (!strcmp(&lang[strlen(lang)-5], "UTF-8")) {
	NJB_Set_Unicode(NJB_UC_UTF8);
      }
    }
  }

  if (NJB_Discover(njbs, 0, &n) == -1) {
    fprintf(stderr, "could not locate any jukeboxes\n");
    return 1;
  }
  
  if ( n == 0 ) {
    fprintf(stderr, "no NJB devices found\n");
    return 0;
  } 
  
  njb = njbs;
  
  if ( NJB_Open(njb) == -1 ) {
    NJB_Error_Dump(njb, stderr);
    return 1;
  }
  
  if ( NJB_Capture(njb) == -1 ) {
    NJB_Error_Dump(njb, stderr);
    return 1;
  }
  
  NJB_Reset_Get_Datafile_Tag(njb);
  while ( (filetag = NJB_Get_Datafile_Tag (njb)) ) {
    datafile_dump(filetag, stdout);
    printf("----------------------------------\n");
    NJB_Datafile_Destroy(filetag);
  }

  /* Dump any pending errors */
  if (NJB_Error_Pending(njb)) {
    NJB_Error_Dump(njb, stderr);
  }
  
  NJB_Release(njb);
  
  NJB_Close(njb);
  return 0;
}
Ejemplo n.º 4
0
int main(int argc, char **argv)
{
  njb_t njbs[NJB_MAX_DEVICES], *njb;
  extern char *optarg;
  int opt;
  int n, debug;
  njb_time_t *time;
  char *pnum;
  char num[80];
  
  debug = 0;
  while ((opt = getopt(argc, argv, "D:")) != -1) {
    switch (opt) {
    case 'D':
      debug = atoi(optarg);
      break;
    default:
      fprintf(stderr, "usage: settime [ -D debuglvl ]\n");
      return 1;
    }
  }
  
  if (debug)
    NJB_Set_Debug(debug);

  if (NJB_Discover(njbs, 0, &n) == -1) {
    fprintf(stderr, "could not locate any jukeboxes\n");
    return 1;
  } 
  
  if (n == 0) {
    fprintf(stderr, "no NJB devices found\n");
    return 0;
  }
  
  njb = njbs;
  
  if (NJB_Open(njb) == -1) {
    NJB_Error_Dump(njb,stderr);
    return 1;
  }

  if (NJB_Capture(njb) == -1) {
    NJB_Error_Dump(njb,stderr);
    return 1;
  }
  
  time = NJB_Get_Time(njb);
  
  printf("The time on the jukebox is:\n");
  dumptime(time);
  
  printf("\nNew time (old values preserved if left blank):\n");
  
  if ( (pnum= prompt("Year:", num, 80, 0)) == NULL ) return 1;
  if ( strlen(pnum) ) {
    time->year= (u_int16_t) strtoul(pnum, 0, 10);
  }
  
  if ( (pnum= prompt("Month (1-12):", num, 80, 0)) == NULL ) return 1;
  if ( strlen(pnum) ) {
    time->month= (u_int16_t) strtoul(pnum, 0, 10);
  }
  
  if ( (pnum= prompt("Day:", num, 80, 0)) == NULL ) return 1;
  if ( strlen(pnum) ) {
    time->day= (u_int16_t) strtoul(pnum, 0, 10);
  }
  
  if ( (pnum= prompt("Weekday (0-6):", num, 80, 0)) == NULL ) return 1;
  if ( strlen(pnum) ) {
    time->weekday= (u_int16_t) strtoul(pnum, 0, 10);
  }
  
  if ( (pnum= prompt("Hours (0-23):", num, 80, 0)) == NULL ) return 1;
  if ( strlen(pnum) ) {
    time->hours= (u_int16_t) strtoul(pnum, 0, 10);
  }
  
  if ( (pnum= prompt("Minutes (0-59):", num, 80, 0)) == NULL ) return 1;
  if ( strlen(pnum) ) {
    time->minutes= (u_int16_t) strtoul(pnum, 0, 10);
  }
  
  if ( (pnum= prompt("Seconds (0-59):", num, 80, 0)) == NULL ) return 1;
  if ( strlen(pnum) ) {
    time->seconds= (u_int16_t) strtoul(pnum, 0, 10);
  }
  
  printf("The time on the jukebox is being set to:\n");
  dumptime(time);
  
  if (NJB_Set_Time(njb, time) == -1) {
    NJB_Error_Dump(njb,stderr);
  }
  
  NJB_Destroy_Time(time);
  
  NJB_Release(njb);
  
  NJB_Close(njb);
  return 0;
}
Ejemplo n.º 5
0
int main(int argc, char **argv)
{
  njb_t njbs[NJB_MAX_DEVICES], *njb;
  extern char *optarg;
  int opt;
  int i, n, debug;
  njb_eax_t *eax;
  
  debug = 0;
  while ((opt = getopt(argc, argv, "D:")) != -1) {
    switch (opt) {
    case 'D':
      debug = atoi(optarg);
      break;
    default:
      fprintf(stderr, "usage: dumpeax [ -D debuglvl ]\n");
      return 1;
    }
  }
  
  if (debug)
    NJB_Set_Debug(debug);
  
  if (NJB_Discover(njbs, 0, &n) == -1) {
    fprintf(stderr, "could not locate any jukeboxes\n");
    exit(1);
  }
  
  if (n == 0) {
    fprintf(stderr, "no NJB devices found\n");
    return 0;
  }
  
  njb = njbs;
  
  if (NJB_Open(njb) == -1) {
    NJB_Error_Dump(njb, stderr);
    return 1;
  }
  
  if (NJB_Capture(njb) == -1) {
    NJB_Error_Dump(njb, stderr);
    return 1;
  }
  
  NJB_Reset_Get_EAX_Type (njb);
  
  while ((eax = NJB_Get_EAX_Type (njb)) != NULL) {
    printf("------------------------------------------\n");
    printf("Effect number: %04X\n", eax->number);
    printf("Effect name: %s\n", eax->name);
    printf("Effect group %d\n", eax->group);
    if (eax->exclusive != 0x00) {
      printf("Effect is exclusive\n");
    }
    if (eax->type == NJB_EAX_FIXED_OPTION_CONTROL) {
      printf("Effect has fixed options:\n");
      printf("    Current selection: %d\n", eax->current_value);
      for(i = 0; i < eax->max_value - eax->min_value + 1; i++) {
	printf("    %d. %s\n", eax->min_value+i, eax->option_names[i]);
      }
    }
    if (eax->type == NJB_EAX_SLIDER_CONTROL) {
      printf("Effect is a slider:\n");
      printf("    Current value: %d\n", eax->current_value);
      printf("    Min value: %d\n", eax->min_value);
      printf("    Max value %d\n", eax->max_value);
    }	  
    NJB_Destroy_EAX_Type (eax);
  }
  
  /* Dump any pending errors */
  NJB_Error_Dump(njb, stderr);
  
  NJB_Release(njb);
  
  NJB_Close(njb);
  return 0;
}