Beispiel #1
0
/** 
* @brief  Build the GUI
* 
* @return 
*/
GtkWidget* buildVolumeUI() {
    GtkWidget* label;

    volumeFrame=gtk_frame_new("AF Gain");
    //gtk_widget_modify_bg(volumeFrame,GTK_STATE_NORMAL,&background);
    //gtk_widget_modify_fg(gtk_frame_get_label_widget(GTK_FRAME(volumeFrame)),GTK_STATE_NORMAL,&white);

    volumeScale=gtk_hscale_new_with_range(0.0,100.0,10.0);
    g_signal_connect(G_OBJECT(volumeScale),"value-changed",G_CALLBACK(volumeChanged),NULL);
    gtk_range_set_value((GtkRange*)volumeScale,volume);
#ifdef NETBOOK
    gtk_widget_set_size_request(GTK_WIDGET(volumeScale),75,25);
#else
    gtk_widget_set_size_request(GTK_WIDGET(volumeScale),150,25);
#endif
    gtk_widget_show(volumeScale);
    gtk_container_add(GTK_CONTAINER(volumeFrame),volumeScale);

#ifdef NETBOOK
    gtk_widget_set_size_request(volumeFrame,89,70);
#else
    gtk_widget_set_size_request(volumeFrame,200,55);
#endif
    gtk_widget_show(volumeFrame);

    SetRXOutputGain(0,0,volume/100.0);

    return volumeFrame;
  
}
Beispiel #2
0
/**
* @brief  Callback when subrx gain values changes
*
* @param widget
* @param data
*/
void subrxGainChanged(GtkWidget* widget,gpointer data) {
    char command[80];
    subrxGain=gtk_range_get_value((GtkRange*)subrxGainScale);
#ifdef DTTSP
    SetRXOutputGain(0,1,subrxGain/100.0);
#endif
}
Beispiel #3
0
/** 
* @brief Set the speed
* 
* @param speed
*/
void setSpeed(int s) {
fprintf(stderr,"setSpeed %d\n",s);
    speed=s;
    control_out[1]=control_out[1]&0xFC;
    control_out[1]=control_out[1]|s;
    if(s==SPEED_48KHZ) {
        sampleRate=48000;
        output_sample_increment=1;
        SetSampleRate((double)sampleRate);
        SetRXOsc(0,1, LO_OFFSET);			// tweaked by Alex Lee 18 Aug 2010
        setFilter(filter);
        {
            int *m=malloc(sizeof(int));
            *m=mode;
            setMode(m);
        }
        SetRXOutputGain(0,0,volume/100.0);
    } else if(s==SPEED_96KHZ) {
        sampleRate=96000;
        output_sample_increment=2;
        SetSampleRate((double)sampleRate);
        SetRXOsc(0,1, LO_OFFSET);			// tweaked by Alex Lee 18 Aug 2010
        setFilter(filter);
        {
            int *m=malloc(sizeof(int));
            *m=mode;
            setMode(m);
        }
        SetRXOutputGain(0,0,volume/100.0);
    } else if(s==SPEED_192KHZ) {
        sampleRate=192000;
        output_sample_increment=4;
        SetSampleRate((double)sampleRate);
        SetRXOsc(0,1, LO_OFFSET);			// tweaked by Alex Lee 18 Aug 2010
        setFilter(filter);
        {
            int *m=malloc(sizeof(int));
            *m=mode;
            setMode(m);
        }
        SetRXOutputGain(0,0,volume/100.0);
    }
}
Beispiel #4
0
/* ----------------------------------------------------------------------------*/
int main(int argc,char* argv[]) {
    int i;
    char directory[1024];

    strcpy(soundCardName,"HPSDR");
    strcpy(server_address,"127.0.0.1"); // localhost

    processCommands(argc,argv);

    fprintf(stderr,"gHPSDR rx %d (Version %s)\n",receiver,VERSION);

    setSoundcard(getSoundcardId(soundCardName));

    // initialize DttSP
    if(getcwd(directory, sizeof(directory))==NULL) {
        fprintf(stderr,"current working directory path is > 1024 bytes!");
        exit(1);
    }
    Setup_SDR(directory);
    Release_Update();
    SetTRX(0,0); // thread 0 is for receive
    SetTRX(1,1);  // thread 1 is for transmit
    SetRingBufferOffset(0,offset);
    SetThreadProcessingMode(0,2);
    SetThreadProcessingMode(1,2);
    SetSubRXSt(0,0,1);
    SetRXOutputGain(0,0,0.20);

    reset_for_buflen(0,1024);
    reset_for_buflen(1,1024);

    client_init(receiver);
    audio_stream_init(receiver);

    // initialize ozy
    ozy_init();

    while(1) {
        sleep(10000);
    }

    return 0;
}
Beispiel #5
0
Startup::Startup(int argv, char* argc[]) {

    //QString configFileName=Static::getConfigDir()+"/"+APPNAME+".ini";

    // defaults
    receiver=0;

    host="127.0.0.1";
    serverPort=10600;
    localPort=10700;
    clientPort=10800;

    QRegExp rxArg("--receiver=([0-3])");
    QRegExp clientArg("--clientport=(\\d{1,6}$)");
    QRegExp serverArg("--serverport=(\\d{1,6}$)");
    QRegExp hostArg("--server=(\\S+$)");

    for (int i = 1; i < argv; ++i) {
        if (rxArg.indexIn(argc[i]) != -1 ) {
            receiver=rxArg.cap(1).toInt();
        } else if (clientArg.indexIn(argc[i]) != -1 ) {
            clientPort=clientArg.cap(1).toInt();
        } else if (serverArg.indexIn(argc[i]) != -1 ) {
            serverPort=serverArg.cap(1).toInt();
        } else if (hostArg.indexIn(argc[i]) != -1 ) {
            host=hostArg.cap(1);
        }
    }
    qDebug()<<"receiver:"<<receiver;
    qDebug()<<"clientPort:"<<clientPort;
    qDebug()<<"serverPort:"<<serverPort;
    qDebug()<<"host:"<<host;

    // startup the client listener
    connect(Connection::getInstance(),SIGNAL(setSampleRate(int)),this,SLOT(setSampleRate(int)));
    Connection::getInstance()->setConnection(host,serverPort);
    Data::getInstance();
    ClientListener::getInstance()->setup(clientPort,receiver);



    // Configure DttSP
    Setup_SDR();
    Release_Update();
    SetTRX(0,RX); // thread 0 is for receive
    SetTRX(1,TX);  // thread 1 is for transmit
    SetRingBufferOffset(0,0); // 0 for HPSDR
    SetThreadProcessingMode(0,RUN_PLAY);
    SetThreadProcessingMode(1,RUN_PLAY);
    SetSubRXSt(0,0,1);
    SetRXOutputGain(0,0,0.20);
    SetSampleRate(96000.0);
    reset_for_buflen(0,1024);
    reset_for_buflen(1,1024);

    SetRXOsc(0,0,0.0);
    SetRXOsc(0,1,0.0);
    SetTXOsc(1,0.0);


    QString command;
    command.append(QString("attach "));
    command.append(QString::number(receiver));
    Connection::getInstance()->sendCommand(command);

    command.clear();
    command.append(QString("frequency "));
    command.append(QString::number(receiver));
    command.append(QString(" 7056000"));
    Connection::getInstance()->sendCommand(command);

    // startup to receive the I, Q and microphone samples
    Data::getInstance()->setConnection(host,serverPort+receiver,localPort+receiver);

    // start the IQ and microphone samples
    command.clear();
    command.append(QString("start "));
    command.append(QString::number(receiver));
    command.append(QString(" iq "));
    command.append(QString(host));
    command.append(QString(" "));
    command.append(QString::number(localPort+receiver));
    Connection::getInstance()->sendCommand(command);

}
Beispiel #6
0
/** 
* @brief  Callback when volume values changes
* 
* @param widget
* @param data
*/
void volumeChanged(GtkWidget* widget,gpointer data) {
    volume=gtk_range_get_value((GtkRange*)volumeScale);
    SetRXOutputGain(0,0,volume/100.0);
}
Beispiel #7
0
int main(int argc,char* argv[]) {
    struct dspserver_config config;
    memset(&config, 0, sizeof(config));
    // Register signal and signal handler
    signal(SIGINT, signal_shutdown);    
    char directory[MAXPATHLEN];
    strcpy(config.soundCardName,"HPSDR");
    strcpy(config.server_address,"127.0.0.1"); // localhost
    strcpy(config.share_config_file, getenv("HOME"));
    strcat(config.share_config_file, "/dspserver.conf");
    processCommands(argc,argv,&config);
    fprintf(stderr, "Reading conf file %s\n", config.share_config_file);
    init_register(config.share_config_file); // we now read our conf always
	 // start web registration if set
    if  (toShareOrNotToShare) {
        fprintf(stderr, "Activating Web register\n");
    }
    fprintf(stderr,"gHPSDR rx %d (Version %s)\n",receiver,VERSION);
    printversion();
    setSoundcard(getSoundcardId(config.soundCardName));

    // initialize DttSP
    if(getcwd(directory, sizeof(directory))==NULL) {
        fprintf(stderr,"current working directory path is > MAXPATHLEN");
        exit(1);
    }
    Setup_SDR(directory);
    Release_Update();
    SetTRX(0,0); // thread 0 is for receive
    SetTRX(1,1);  // thread 1 is for transmit
    SetRingBufferOffset(0,config.offset);
    SetThreadProcessingMode(0,RUN_PLAY);
    SetThreadProcessingMode(1,RUN_PLAY);
    SetSubRXSt(0,1,1);
    SetRXOutputGain(0,0,0.20);
    SetRXOsc(0,0, -LO_offset);
    SetRXOsc(0,1, -LO_offset);
    reset_for_buflen(0,1024);
    reset_for_buflen(1,1024);

    client_init(receiver);
    audio_stream_init(receiver);
    audio_stream_reset();

    codec2 = codec2_create();
    G711A_init();
    ozy_init(config.server_address);

    SetMode(1, 0, USB);
    SetTXFilter(1, 150, 2850);
    SetTXOsc(1, LO_offset);
    SetTXAMCarrierLevel(1, 0.5);

    tx_init();	// starts the tx_thread

    while(1) {
        sleep(10000);
    }

 //   codec2_destroy(codec2);
    return 0;
}
Beispiel #8
0
int main(int argc,char* argv[]) {
    memset(&config, 0, sizeof(config));
    // Register signal and signal handler
    signal(SIGINT, signal_shutdown);    
    char directory[MAXPATHLEN];
    strcpy(config.soundCardName,"HPSDR");
    strcpy(config.server_address,"127.0.0.1"); // localhost
    strcpy(config.share_config_file, getenv("HOME"));
    strcat(config.share_config_file, "/dspserver.conf");
    processCommands(argc,argv,&config);

#ifdef THREAD_DEBUG
    sdr_threads_init();
#endif /* THREAD_DEBUG */

    fprintf(stderr, "Reading conf file %s\n", config.share_config_file);
    init_register(config.share_config_file); // we now read our conf always
	 // start web registration if set
    if  (toShareOrNotToShare) {
        fprintf(stderr, "Activating Web register\n");
    }
    fprintf(stderr,"gHPSDR rx %d (Version %s)\n",receiver,VERSION);
    printversion();
    setSoundcard(getSoundcardId(config.soundCardName));

    // initialize DttSP
    if(getcwd(directory, sizeof(directory))==NULL) {
        fprintf(stderr,"current working directory path is > MAXPATHLEN");
        exit(1);
    }
    Setup_SDR(directory);
    Release_Update();
    SetTRX(0,0); // thread 0 is for receive
    SetTRX(1,1);  // thread 1 is for transmit
    SetRingBufferOffset(0,config.offset);
    SetThreadProcessingMode(0,RUN_PLAY);
    SetThreadProcessingMode(1,RUN_PLAY);
    SetSubRXSt(0,1,1);
    SetRXOutputGain(0,0,0.20);
    SetRXOsc(0,0, -LO_offset);
    SetRXOsc(0,1, -LO_offset);
    reset_for_buflen(0,1024);
    reset_for_buflen(1,1024);

    client_init(receiver);        // create the main thread responsible for listen TCP socket
                                  // on the read callback:
                                  //    accept and interpret the commands from remote GUI  
                                  //    parse mic data from remote and enque them into Mic_audio_stream queue
                                  //    see client.c
                                  //
                                  // on the write callback:
                                  //    read the audio_stream_queue and send into the TCP socket
                                  //
    audio_stream_init(receiver);
    audio_stream_reset();

    codec2 = codec2_create(CODEC2_MODE_3200);
    G711A_init();
    ozy_init(config.server_address);   // create and starts iq_thread in ozy.c in order to
                                       // receive iq stream from hardware server
                                       // process it in DttSP
                                       // makes the sample rate adaption for resulting audio
                                       // puts audio stream in a queue (via calls to audio_stream_queue_add 
                                       // in audio_stream_put_samples() in audiostream.c)
                                       //
                                       // in case of HPSDR hardware (that is provided with a local D/A converter
                                       // sends via ozy_send() the audio back to the hardware server
    SetMode(1, 0, USB);
    SetTXFilter(1, 150, 2850);
    SetTXOsc(1, LO_offset);
    SetTXAMCarrierLevel(1, 0.5);

    tx_init();	// create and starts the tx_thread (see client.c)
                // the tx_thread reads the Mic_audio_stream queue, makes the sample rate adaption
                // process the data into DttSP in order to get the modulation process done,
                // and sends back to the hardware server process (via ozy_send() )

#ifdef THREAD_DEBUG
    /* Note that some thread interactions will be lost at startup due to
     * the fact that the subsystem threads are all started.  We can't
     * init this until late, though, or we'll catch initializations
     * performed at boot time as errors. */
    if (config.thread_debug) {
        sdr_threads_debug(TRUE);
    }
#endif /* THREAD_DEBUG */

    while(1) {
        sleep(10000);
    }

 //   codec2_destroy(codec2);
    return 0;
}