Esempio n. 1
0
/* ----------------------------------------------------------------------------*/
void processCommands(int argc,char** argv,struct dspserver_config *config) {
    int c;
    while((c=getopt_long(argc,argv,shortOptions,longOptions,NULL))!=-1) {
        printf("%d\n", c);
        switch(c) {
            case OPT_SOUNDCARD:
                if (strlen(optarg) > sizeof(config->soundCardName) - 1) {
                    fprintf(stderr, "Warning: Sound card name will be truncated\n");
                }
                strncpy(config->soundCardName,optarg,sizeof(config->soundCardName));
                break;
            case OPT_RECEIVER:
                /* FIXME: global */
                receiver=atoi(optarg);
                break;
            case OPT_SERVER:
                /* FIXME: global */
                if (strlen(optarg) > sizeof(config->server_address) - 1) {
                    fprintf(stderr, "Warning: server address will be truncated\n");
                }
                strncpy(config->server_address, optarg, sizeof(config->server_address));
                break;
            case OPT_OFFSET:
                config->offset=atoi(optarg);
                break;
            case OPT_TIMING:
                client_set_timing();
                break;
            case OPT_LOOKUPCOUNTRY:
                setprintcountry();
                break;
            case OPT_SHARE:
                toShareOrNotToShare = 1;
                break;
            case OPT_SHARECONFIG:
                if (strlen(optarg) > sizeof(config->share_config_file) - 1) {
                    fprintf(stderr, "Warning: share config file path is too long for this system\n");
                }
                strncpy(config->share_config_file,optarg, sizeof(config->share_config_file));
                break;
            case OPT_LO:
                /* global */
                LO_offset=atoi(optarg);
                break;
            case OPT_HPSDR:
                ozy_set_hpsdr();
                break;
            case OPT_DEBUG:
                ozy_set_debug(1);
                break;

       default:
                fprintf(stderr,"Usage: \n");
                fprintf(stderr,"  dspserver --receivers N (default 1)\n");
                fprintf(stderr,"            --server 0.0.0.0 (default 127.0.0.1)\n");
                fprintf(stderr,"            --soundcard (machine dependent)\n");
                fprintf(stderr,"            --offset 0 \n");
                fprintf(stderr,"            --share (will register this server for other users \n");
                fprintf(stderr,"                     use the default config file ~/.dspserver.conf) \n");
		fprintf(stderr,"            --lo 0 (if no LO offset desired in DDC receivers, or 9000 in softrocks\n");
		fprintf(stderr,"            --hpsdr (if using hpsdr hardware)\n");
                exit(1);

        }
    }
}
Esempio n. 2
0
/* ----------------------------------------------------------------------------*/
void processCommands(int argc,char** argv,struct dspserver_config *config) {
    int c;
    while((c=getopt_long(argc,argv,shortOptions,longOptions,NULL))!=-1) {
        switch(c) {
            case OPT_SOUNDCARD:
                if (strlen(optarg) > sizeof(config->soundCardName) - 1) {
                    fprintf(stderr, "Warning: Sound card name will be truncated\n");
                }
                strncpy(config->soundCardName,optarg,sizeof(config->soundCardName));
                break;
            case OPT_RECEIVER:
                /* FIXME: global */
                receiver=atoi(optarg);
                break;
            case OPT_SERVER:
                /* FIXME: global */
                if (strlen(optarg) > sizeof(config->server_address) - 1) {
                    fprintf(stderr, "Warning: server address will be truncated\n");
                }
                strncpy(config->server_address, optarg, sizeof(config->server_address));
                break;
            case OPT_OFFSET:
                config->offset=atoi(optarg);
                break;
            case OPT_TIMING:
                client_set_timing();
                break;
            case OPT_LOOKUPCOUNTRY:
                setprintcountry();
                break;
            case OPT_SHARE:
                toShareOrNotToShare = 1;
                break;
            case OPT_SHARECONFIG:
                if (strlen(optarg) > sizeof(config->share_config_file) - 1) {
                    fprintf(stderr, "Warning: share config file path is too long for this system\n");
                }
                strncpy(config->share_config_file,optarg, sizeof(config->share_config_file));
                break;
            case OPT_LO:
                /* global */
                LO_offset=atoi(optarg);
                break;
            case OPT_HPSDR:
                ozy_set_hpsdr();
                break;
            case OPT_HPSDRLOC:
                ozy_set_hpsdr_local();
                break;
            case OPT_NOCORRECTIQ:
                config->no_correct_iq = 1;
                break;
            case OPT_DEBUG:
                ozy_set_debug(1);
                break;
            case OPT_THREAD_DEBUG:
                config->thread_debug = 1;
                break;

       default:
                fprintf(stderr,"Usage: \n");
                fprintf(stderr,"  dspserver --receiver N (default 0)\n");
                fprintf(stderr,"            --server 0.0.0.0 (default 127.0.0.1)\n");
                fprintf(stderr,"            --soundcard (machine dependent)\n");
                fprintf(stderr,"            --offset 0 \n");
                fprintf(stderr,"            --share (will register this server for other users \n");
                fprintf(stderr,"                     use the default config file ~/.dspserver.conf) \n");
		fprintf(stderr,"            --lo 0 (if no LO offset desired in DDC receivers, or 9000 in softrocks\n");
		fprintf(stderr,"            --hpsdr (if using hpsdr hardware with no local mike and headphone)\n");
		fprintf(stderr,"            --hpsdrloc (if using hpsdr hardware with LOCAL mike and headphone)\n");
		fprintf(stderr,"            --nocorrectiq (select if using non QSD receivers, like Hermes, Perseus, HiQSDR, Mercury)\n");
#ifdef THREAD_DEBUG
                fprintf(stderr,"            --debug-threads (enable threading assertions)\n");
#endif /* THREAD_DEBUG */
                exit(1);

        }
    }
}