// ----------------------------------------------------------------------------------
// CSSYChannel::ForceBufferFilledL()
// ----------------------------------------------------------------------------------
// 
void CSSYChannel::ForceBufferFilledL( const TSensrvChannelId aChannelId )
    {
    SSY_TRACE_IN();
    SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

    if ( ChannelId() != aChannelId )
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: StartChannelDataL wrong channelId!" );
        User::Leave( KErrArgument );
        }

    if( iChannelState & KChannelCanBeFilled )
        {
        SetChannelState( EChannelForceBufferFilled );
        IssueRequest();
        }
    else
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: ForceBufferFilledL called in incorrected state! channelId: %d, state: %S",
                   aChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

        User::Leave( KErrGeneral );
        }

    SSY_TRACE_OUT();
    }
// ----------------------------------------------------------------------------------
// CSSYChannel::OpenChannel()
// ----------------------------------------------------------------------------------
// 
TInt CSSYChannel::OpenChannel()
	{
	SSY_TRACE_IN();
	SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

	TInt err( KErrNone );

	if ( iChannelState & KChannelCanBeOpened )
	    {
        TRAP( err, iOrientationHandler->OpenChannelL() );
        if ( err == KErrNone )
            {
            SetChannelState( EChannelOpening );
            IssueRequest();
            }
	    }
	else
	    {	    
        SSY_TRACE( EExtended, "ORIENTATIONSSY:ERROR: Trying to open a channel in a wrong state! channelId: %d, state: %S",
                   iChannelInfo.iChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

	    err = KErrGeneral;
	    }

	SSY_TRACE_OUT();
	return err;
	}
Beispiel #3
0
void initReceiveChannel() {
    setRXMode(modeAM);
    SetRXABandpassFreqs(CHANNEL_RX, (double)filterLow, (double)filterHigh);
	setFilter(filterLow, filterHigh);
    setAGCMode(AGC_MEDIUM);

    SetRXAAMDSBMode(CHANNEL_RX, 0);
    SetRXAShiftRun(CHANNEL_RX, 0);

    SetRXAEMNRPosition(CHANNEL_RX, nr_agc);
    SetRXAEMNRgainMethod(CHANNEL_RX, nr2_gain_method);
    SetRXAEMNRnpeMethod(CHANNEL_RX, nr2_npe_method);
    SetRXAEMNRRun(CHANNEL_RX, nr2);
    SetRXAEMNRaeRun(CHANNEL_RX, nr2_ae);

    SetRXAANRVals(CHANNEL_RX, 64, 16, 16e-4, 10e-7); // defaults
    SetRXAANRRun(CHANNEL_RX, nr);
    SetRXAANFRun(CHANNEL_RX, anf);
    SetRXASNBARun(CHANNEL_RX, snb);

    SetRXAPanelGain1(CHANNEL_RX, 0.9);//volume
	
	SetRXAShiftFreq(CHANNEL_RX, 0.0);
    SetRXAShiftRun(CHANNEL_RX, 0);
	
	SetChannelState(CHANNEL_RX,1,0);
}
// ----------------------------------------------------------------------------------
// CSSYChannel::StopChannelDataL()
// ----------------------------------------------------------------------------------
// 
void CSSYChannel::StopChannelDataL( const TSensrvChannelId aChannelId )
    {
    SSY_TRACE_IN();
    SSY_TRACE( EExtended, "ORIENTATIONSSY::ChannelId %d", iChannelInfo.iChannelId ); 

    if ( ChannelId() != aChannelId )
        {
        SSY_TRACE( EError, "ORIENTATIONSSY::ERROR: StartChannelDataL wrong channelId!" );
        User::Leave( KErrArgument );
        }

    if ( iChannelState & KChannelCanBeStopped )
        {
        iOrientationHandler->StopListeningL();
        SetChannelState( EChannelStopListening );
        IssueRequest();
        }
    else
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: Trying to stop listening a channel that is not listened! channelId: %d, state: %S",
                   aChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

        User::Leave( KErrGeneral );
        }

    SSY_TRACE_OUT();
    }
Beispiel #5
0
void setMox(int state) {
fprintf(stderr,"setMox: protocol=%d\n", protocol);
  if(mox!=state) {
    mox=state;
    if(protocol==NEW_PROTOCOL) {
      schedule_high_priority(3);
    }
    if(mox) {
      SetChannelState(CHANNEL_RX0,0,1);
      SetChannelState(CHANNEL_TX,1,0);
    } else {
      SetChannelState(CHANNEL_TX,0,1);
      SetChannelState(CHANNEL_RX0,1,0);
    }
  }
}
Beispiel #6
0
static void setupTX(int tx) {
    setTXMode(tx,mode);
    SetTXABandpassFreqs(tx, (double)filterLow, (double)filterHigh);
    SetTXABandpassWindow(tx, 1);
    SetTXABandpassRun(tx, 1);

    SetTXACFIRRun(tx, 1);
    SetTXAEQRun(tx, 0);
    SetTXACTCSSRun(tx, 0);
    SetTXAAMSQRun(tx, 0);
    SetTXACompressorRun(tx, 0);
    SetTXAosctrlRun(tx, 0);
    SetTXAPreGenRun(tx, 0);
    SetTXAPostGenRun(tx, 0);

    SetChannelState(tx,1,0);
    SetChannelState(tx,1,0);
}
Beispiel #7
0
/** 
* @brief Enabled button Callback 
* 
* @param widget -- pointer to the parent widget, 
* @param data -- pointer to the data.
*/
void subrxEnabledButtonCallback(GtkWidget* widget,gpointer data) {
    GtkWidget* label;
    char c[80];
    gboolean state;

    if(subrx) {
        state=0;
    } else {
        state=1;
    }    

    label=gtk_bin_get_child((GtkBin*)widget);
    if(state) {
        gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &buttonSelected);
        gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &buttonSelected);
    } else {
        gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
        gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &black);
    }

    subrx=state;

    if(subrx) {
        subrxFrequencyLO=frequencyALO;
        long long diff=subrxFrequency-frequencyA;
        if(diff<0) diff=-diff;
        if(diff>sampleRate/2) {
            setSubrxFrequency(frequencyA);
        } else {
            setSubrxFrequency(subrxFrequency);
        }
        if(running) {
            SetRXAShiftRun(CHANNEL_SUBRX, 1);
            SetChannelState(CHANNEL_SUBRX, 1, 0);
        }
    } else {
        if(running) {
            SetRXAShiftRun(CHANNEL_SUBRX, 0);
            SetChannelState(CHANNEL_SUBRX, 0, 0);
        }
    }
    updateSubrxDisplay();
}
void DrChannelDescription::CopyFrom(DrChannelDescriptionPtr src, bool includeLengths)
{
    DrAssert(m_isInputChannel == src->m_isInputChannel);

    SetChannelURI(src->GetChannelURI());
    SetChannelState(src->GetChannelState());
    SetChannelMetaData(src->GetChannelMetaData());
    if (includeLengths)
    {
        SetChannelProcessedLength(src->GetChannelProcessedLength());
        SetChannelTotalLength(src->GetChannelTotalLength());
    }
}
Beispiel #9
0
void setTune(int state) {
fprintf(stderr,"setTune: protocol=%d\n", protocol);
  if(tune!=state) {
    tune=state;
    if(tune) {
      if(OCmemory_tune_time!=0) {
        struct timeval te;
        gettimeofday(&te,NULL);
        tune_timeout=(te.tv_sec*1000LL+te.tv_usec/1000)+(long long)OCmemory_tune_time;
      }
    }
    if(protocol==NEW_PROTOCOL) {
      schedule_high_priority(4);
      schedule_general();
    }
    if(tune) {
      SetChannelState(CHANNEL_RX0,0,1);
      SetChannelState(CHANNEL_TX,1,0);
    } else {
      SetChannelState(CHANNEL_TX,0,1);
      SetChannelState(CHANNEL_RX0,1,0);
    }
  }
}
Beispiel #10
0
// ----------------------------------------------------------------------------------
// CSSYChannel::StartChannelDataL()
// ----------------------------------------------------------------------------------
// 
void CSSYChannel::StartChannelDataL( const TSensrvChannelId aChannelId, 
                                     TUint8* aBuffer, 
                                     TInt aCount )
    {
    SSY_TRACE_IN();
    SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

    if ( ChannelId() != aChannelId )
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: StartChannelDataL wrong channelId!" );
        User::Leave( KErrArgument );
        }

    ASSERT_DEBUG_SSY( aBuffer );
    ASSERT_DEBUG_SSY( aCount );

    if ( !aBuffer || !aCount )
        {
        User::Leave( KErrArgument );
        }

    iBuffer = aBuffer;
    iCount  = aCount;

    SSY_TRACE( EExtended, "ORIENTATIONSSY:New data buffer: 0x%x", iBuffer );
    SSY_TRACE( EExtended, "ORIENTATIONSSY:New data count : %d", iCount );

    if ( iChannelState & KChannelCanBeListened )
        {
        iOrientationHandler->StartListeningL();
        SetChannelState( EChannelListening );
        IssueRequest();
        }
    else
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: Trying to listen a channel that is not open! channelId: %d, state: %S", 
                   aChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

        User::Leave( KErrGeneral );
        }

    SSY_TRACE_OUT();
    }
Beispiel #11
0
// ----------------------------------------------------------------------------------
// CSSYChannel::CloseChannel()
// ----------------------------------------------------------------------------------
// 
TInt CSSYChannel::CloseChannel()
	{
	SSY_TRACE_IN();
	SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

	TInt err( KErrNone );

	if( iChannelState & KChannelCanBeClosed )
	    {
        TRAP( err, iOrientationHandler->CloseChannelL() ); 
        if ( err == KErrNone )
            {
            iBuffer        = NULL; // Reassigned in data listening
            iCount         = 0;
            iCountReceived = 0;
            SetChannelState( EChannelClosing );
            IssueRequest();
            }
        else
            {
            SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: Trying to close a channel! err: %d, channelId: %d, state: %S",
                       err,
                       iChannelInfo.iChannelId,
                       ConvertChannelStateIntoString( iChannelState ) );
            }
	    }
	else
	    {
	    SSY_TRACE( EExtended, "ORIENTATIONSSY:ERROR: Trying to close a channel in a wrong state! channelId: %d, state: %S",
                   iChannelInfo.iChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

	    err = KErrGeneral;
	    }

	SSY_TRACE_OUT();
	return err;
	}
Beispiel #12
0
gint init(void* arg) {

  gint x;
  gint y;

  DISCOVERED* d;

  char *res;
  char wisdom_directory[1024];
  char wisdom_file[1024];

  fprintf(stderr,"init\n");

  audio_get_cards(0);
  audio_get_cards(1);

  cursor_arrow=gdk_cursor_new(GDK_ARROW);
  cursor_watch=gdk_cursor_new(GDK_WATCH);

  GdkWindow *gdk_splash_window = gtk_widget_get_window(splash_window);
  gdk_window_set_cursor(gdk_splash_window,cursor_watch);

  init_radio();

  // check if wisdom file exists
  res=getcwd(wisdom_directory, sizeof(wisdom_directory));
  strcpy(&wisdom_directory[strlen(wisdom_directory)],"/");
  strcpy(wisdom_file,wisdom_directory);
  strcpy(&wisdom_file[strlen(wisdom_file)],"wdspWisdom");
  splash_status("Checking FFTW Wisdom file ...");
  if(access(wisdom_file,F_OK)<0) {
      int rc=sem_init(&wisdom_sem, 0, 0);
      rc=pthread_create(&wisdom_thread_id, NULL, wisdom_thread, (void *)wisdom_directory);
      while(sem_trywait(&wisdom_sem)<0) {
        splash_status(wisdom_get_status());
        while (gtk_events_pending ())
          gtk_main_iteration ();
        usleep(100000); // 100ms
      }
  }

  while(!start) {
      gdk_window_set_cursor(gdk_splash_window,cursor_watch);
      selected_device=0;
      devices=0;
      splash_status("Old Protocol ... Discovering Devices");
      old_discovery();
      splash_status("New Protocol ... Discovering Devices");
      new_discovery();
#ifdef LIMESDR
      splash_status("LimeSDR ... Discovering Devices");
      lime_discovery();
#endif
      splash_status("Discovery");
      if(devices==0) {
          gdk_window_set_cursor(gdk_splash_window,cursor_arrow);
          fprintf(stderr,"No devices found!\n");
          GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
          discovery_dialog = gtk_message_dialog_new (GTK_WINDOW(splash_window),
                                 flags,
                                 GTK_MESSAGE_ERROR,
                                 GTK_BUTTONS_OK_CANCEL,
                                 "No devices found! Retry Discovery?");
          gtk_widget_override_font(discovery_dialog, pango_font_description_from_string("FreeMono 18"));
          gint result=gtk_dialog_run (GTK_DIALOG (discovery_dialog));
          gtk_widget_destroy(discovery_dialog);
          if(result==GTK_RESPONSE_CANCEL) {
               _exit(0);
          }
      } else {
          fprintf(stderr,"%s: found %d devices.\n", (char *)arg, devices);
          gdk_window_set_cursor(gdk_splash_window,cursor_arrow);
          GtkDialogFlags flags=GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
          discovery_dialog = gtk_dialog_new_with_buttons ("Discovered",
                                      GTK_WINDOW(splash_window),
                                      flags,
#ifdef GPIO
                                      "Configure GPIO",
                                      GTK_RESPONSE_YES,
#endif
                                      "Discover",
                                      GTK_RESPONSE_REJECT,
                                      "Exit",
                                      GTK_RESPONSE_CLOSE,
                                      NULL);

          gtk_widget_override_font(discovery_dialog, pango_font_description_from_string("FreeMono 18"));
          GtkWidget *content;

          content=gtk_dialog_get_content_area(GTK_DIALOG(discovery_dialog));

          GtkWidget *grid=gtk_grid_new();
          gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
          gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
          gtk_grid_set_row_spacing (GTK_GRID(grid),10);

          int i;
          char version[16];
          char text[128];
          for(i=0;i<devices;i++) {
              d=&discovered[i];
fprintf(stderr,"%p protocol=%d name=%s\n",d,d->protocol,d->name);
              if(d->protocol==ORIGINAL_PROTOCOL) {
                  sprintf(version,"%d.%d",
                        d->software_version/10,
                        d->software_version%10);
              } else {
                  sprintf(version,"%d.%d.%d",
                        d->software_version/100,
                        (d->software_version%100)/10,
                        d->software_version%10);
              }
              switch(d->protocol) {
                case ORIGINAL_PROTOCOL:
                case NEW_PROTOCOL:
                  sprintf(text,"%s (%s %s) %s (%02X:%02X:%02X:%02X:%02X:%02X) on %s\n",
                        d->name,
                        d->protocol==ORIGINAL_PROTOCOL?"old":"new",
                        version,
                        inet_ntoa(d->info.network.address.sin_addr),
                        d->info.network.mac_address[0],
                        d->info.network.mac_address[1],
                        d->info.network.mac_address[2],
                        d->info.network.mac_address[3],
                        d->info.network.mac_address[4],
                        d->info.network.mac_address[5],
                        d->info.network.interface_name);
                  break;
#ifdef LIMESDR
                case LIMESDR_PROTOCOL:
/*
                  sprintf(text,"%s (%s %s)\n",
                        d->name,
                        "lime",
                        version);
*/
                  sprintf(text,"%s\n",
                        d->name);
                  break;
#endif
              }

              GtkWidget *label=gtk_label_new(text);
              gtk_widget_override_font(label, pango_font_description_from_string("FreeMono 12"));
              gtk_widget_show(label);
              gtk_grid_attach(GTK_GRID(grid),label,0,i,3,1);

              GtkWidget *start_button=gtk_button_new_with_label("Start");
              gtk_widget_override_font(start_button, pango_font_description_from_string("FreeMono 18"));
              gtk_widget_show(start_button);
              gtk_grid_attach(GTK_GRID(grid),start_button,3,i,1,1);
              g_signal_connect(start_button,"pressed",G_CALLBACK(start_cb),(gpointer)d);

              // if not available then cannot start it
              if(d->status!=STATE_AVAILABLE) {
                gtk_button_set_label(GTK_BUTTON(start_button),"In Use");
                gtk_widget_set_sensitive(start_button, FALSE);
              }

              // if not on the same subnet then cannot start it
              if((d->info.network.interface_address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr) != (d->info.network.address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr)) {
                gtk_button_set_label(GTK_BUTTON(start_button),"Subnet!");
                gtk_widget_set_sensitive(start_button, FALSE);
              }

          }

          gtk_container_add (GTK_CONTAINER (content), grid);
          gtk_widget_show_all(discovery_dialog);
          gint result=gtk_dialog_run(GTK_DIALOG(discovery_dialog));

          if(result==GTK_RESPONSE_CLOSE) {
              _exit(0);
          }
         
          if(!start) {
            gtk_widget_destroy(discovery_dialog);
          }
#ifdef GPIO
          if(result==GTK_RESPONSE_YES) {
              configure_gpio(splash_window);
          }
#endif
      }
  }

  gdk_window_set_cursor(gdk_splash_window,cursor_watch);

  splash_status("Initializing wdsp ...");

fprintf(stderr,"selected radio=%p device=%d\n",radio,radio->device);

  protocol=radio->protocol;
  device=radio->device;


  switch(radio->protocol) {
    case ORIGINAL_PROTOCOL:
    case NEW_PROTOCOL:
      sprintf(property_path,"%02X-%02X-%02X-%02X-%02X-%02X.props",
                        radio->info.network.mac_address[0],
                        radio->info.network.mac_address[1],
                        radio->info.network.mac_address[2],
                        radio->info.network.mac_address[3],
                        radio->info.network.mac_address[4],
                        radio->info.network.mac_address[5]);
      break;
#ifdef LIMESDR
    case LIMESDR_PROTOCOL:
      sprintf(property_path,"limesdr.props");
      break;
#endif
  }

  radioRestoreState();

  fprintf(stderr,"malloc samples\n");
  if(radio->protocol==NEW_PROTOCOL) {
    samples=malloc(display_width*sizeof(float)*2*4); // 192 -> 48
  } else {
    samples=malloc(display_width*sizeof(float)*2);
  }

  //splash_status("Initializing wdsp ...");
  fprintf(stderr,"wdsp_init\n");
  wdsp_init(0,display_width,radio->protocol);

  switch(radio->protocol) {
    case ORIGINAL_PROTOCOL:
      splash_status("Initializing old protocol ...");
  fprintf(stderr,"old_protocol_init\n");
      old_protocol_init(0,display_width);
      break;
    case NEW_PROTOCOL:
      splash_status("Initializing new protocol ...");
  fprintf(stderr,"new_protocol_init\n");
      new_protocol_init(0,display_width);
      break;
#ifdef LIMESDR
    case LIMESDR_PROTOCOL:
      splash_status("Initializing lime protocol ...");
      lime_protocol_init(0,display_width);
      break;
#endif
  }

  fprintf(stderr,"gpio_init\n");
  splash_status("Initializing GPIO ...");
#ifdef GPIO
  if(gpio_init()<0) {
  }
#endif

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "pihpsdr");
  gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER_ALWAYS);
  gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
  g_signal_connect (window, "delete-event", G_CALLBACK (main_delete), NULL);

  fixed=gtk_fixed_new();
  gtk_container_add(GTK_CONTAINER(window), fixed);
  y=0;

fprintf(stderr,"vfo_height=%d\n",VFO_HEIGHT);
  vfo = vfo_init(VFO_WIDTH,VFO_HEIGHT,window);
  gtk_fixed_put(GTK_FIXED(fixed),vfo,0,0);



  rit_control = rit_init(RIT_WIDTH,MENU_HEIGHT,window);
  gtk_fixed_put(GTK_FIXED(fixed),rit_control,VFO_WIDTH,y);

fprintf(stderr,"menu_height=%d\n",MENU_HEIGHT);
  //menu = menu_init(MENU_WIDTH,MENU_HEIGHT,window);
  menu = new_menu_init(MENU_WIDTH-RIT_WIDTH,MENU_HEIGHT,window);
  gtk_fixed_put(GTK_FIXED(fixed),menu,VFO_WIDTH+((MENU_WIDTH/3)*2),y);

fprintf(stderr,"meter_height=%d\n",METER_HEIGHT);
  meter = meter_init(METER_WIDTH,METER_HEIGHT,window);
  gtk_fixed_put(GTK_FIXED(fixed),meter,VFO_WIDTH+MENU_WIDTH,y);
  y+=VFO_HEIGHT;

  if(display_panadapter) {
    int height=PANADAPTER_HEIGHT;
    if(!display_waterfall) {
      height+=WATERFALL_HEIGHT;
      if(!display_sliders) {
        height+=SLIDERS_HEIGHT;
      }
      if(!display_toolbar) {
        height+=TOOLBAR_HEIGHT;
      }
    } else {
      if(!display_sliders) {
        height+=SLIDERS_HEIGHT/2;
      }
    }
fprintf(stderr,"panadapter_height=%d\n",height);
    panadapter = panadapter_init(display_width,height);
    gtk_fixed_put(GTK_FIXED(fixed),panadapter,0,VFO_HEIGHT);
    y+=height;
  }

  if(display_waterfall) {
    int height=WATERFALL_HEIGHT;
    if(!display_panadapter) {
      height+=PANADAPTER_HEIGHT;
    }
    if(!display_sliders) {
      if(display_panadapter) {
        height+=SLIDERS_HEIGHT/2;
      } else {
        height+=SLIDERS_HEIGHT;
      }
    }
    if(!display_toolbar) {
      height+=TOOLBAR_HEIGHT;
    }
fprintf(stderr,"waterfall_height=%d\n",height);
    waterfall = waterfall_init(display_width,height);
    gtk_fixed_put(GTK_FIXED(fixed),waterfall,0,y);
    y+=height;

  }

#ifdef PSK
    int psk_height=PSK_WATERFALL_HEIGHT;
    if(!display_sliders) {
      psk_height+=SLIDERS_HEIGHT/2;
    }
    if(!display_toolbar) {
      psk_height+=TOOLBAR_HEIGHT/2;
    }
    psk_waterfall = psk_waterfall_init(display_width,psk_height);
    gtk_fixed_put(GTK_FIXED(fixed),psk_waterfall,0,VFO_HEIGHT);
    psk = init_psk();
    gtk_fixed_put(GTK_FIXED(fixed),psk,0,VFO_HEIGHT+psk_height);
#endif

  if(display_sliders) {
fprintf(stderr,"sliders_height=%d\n",SLIDERS_HEIGHT);
    sliders = sliders_init(display_width,SLIDERS_HEIGHT,window);
    gtk_fixed_put(GTK_FIXED(fixed),sliders,0,y);
    y+=SLIDERS_HEIGHT;
  }

  if(display_toolbar) {
fprintf(stderr,"toolbar_height=%d\n",TOOLBAR_HEIGHT);
    toolbar = toolbar_init(display_width,TOOLBAR_HEIGHT,window);
    gtk_fixed_put(GTK_FIXED(fixed),toolbar,0,y);
    y+=TOOLBAR_HEIGHT;
  }

  splash_close();

  gtk_widget_show_all (window);

  if(full_screen) {
    gtk_window_fullscreen(GTK_WINDOW(window));
  }

  GdkWindow *gdk_window = gtk_widget_get_window(window);
  gdk_window_set_cursor(gdk_window,cursor_arrow);

  // start the receiver
  SetChannelState(CHANNEL_RX0,1,1);

  //update_timer_id=gdk_threads_add_timeout(1000/updates_per_second, update, NULL);
  update_timer_id=gdk_threads_add_timeout_full(G_PRIORITY_HIGH_IDLE,1000/updates_per_second, update, NULL, NULL);

  // save every 30 seconds
  save_timer_id=gdk_threads_add_timeout(30000, save_cb, NULL);


  if(protocol!=NEW_PROTOCOL) {
    setFrequency(getFrequency());
  }

#ifdef PSK
  if(mode==modePSK) {
    show_psk();
  } else {
    show_waterfall();
  }
#endif

  g_idle_add(vfo_update,(gpointer)NULL);

  return 0;
}
Beispiel #13
0
// ----------------------------------------------------------------------------------
// CSSYChannel::RunL()
// ----------------------------------------------------------------------------------
// 
void CSSYChannel::RunL()
    {
    SSY_TRACE_IN();

    SSY_TRACE( EMust, "ORIENTATIONSSY:RunL in state %S", ConvertChannelStateIntoString(iChannelState) );

    switch ( iChannelState )
        {
        case EChannelIdle:
            break;
        case EChannelOpening:
            {
            SetChannelState( EChannelOpen );
            iCallback->ChannelOpened( iChannelInfo.iChannelId, iStatus.Int(), this, this );
            break;
            }
        case EChannelOpen:
            break;
        case EChannelClosing:
            SetChannelState( EChannelIdle );
            iCallback->ChannelClosed( iChannelInfo.iChannelId );
            break;
        case EChannelListening:
            SetChannelState( EChannelDataReceived );
            iOrientationHandler->GetDataFromHardware( this );
            break;
        case EChannelDataReceived:

            // Channel excepted data, increase the receive counter
            iCountReceived++;

            if( iCountReceived == iCount )
                {
                SetChannelState( EChannelBufferFilled );
                }
            else
                {
                SetChannelState( EChannelListening );
                }

            IssueRequest();
            break;
        case EChannelStopListening:
            SetChannelState( EChannelOpen );
            iBuffer        = NULL;
            iCount         = 0;
            iCountReceived = 0;
            break;
        case EChannelForceBufferFilled:
            // Intentional flowthrough
        case EChannelBufferFilled:

            iBuffer = NULL;
            iCount  = 0;

            iCallback->BufferFilled( iChannelInfo.iChannelId, iCountReceived, iBuffer, iCount );

            // Check that client did not change the state in the callback function
            if ( iChannelState == EChannelForceBufferFilled ||
                 iChannelState == EChannelBufferFilled )
                {
                iCountReceived = 0;

                if ( iBuffer && iCount )
                    {
                    SetChannelState( EChannelListening );
                    }
                else
                    {
                    SSY_TRACE( EError, "ORIENTATIONSSY:ERROR:New buffer and/or count values are wrong!" );
                    iOrientationHandler->StopListeningL();
                    SetChannelState( EChannelStopListening );
                    }

                IssueRequest();
                }
            break;
        default:
            ASSERT_DEBUG_SSY( 0 );
            break;
        }

    SSY_TRACE_OUT();
    }
Beispiel #14
0
void stopRadio(){
	DestroyAnalyzer(CHANNEL_RX);
	SetChannelState(CHANNEL_RX,0,0);
	CloseChannel(CHANNEL_RX);
}