Beispiel #1
0
int si4754Radio::beginSearch(int channel,bool isListenTest)
{
    int res = -1;
    if(isFM(channel))//FM的台
    {
        changeChannel(channel);
        if(m_radioMode != RM_FREQ_SECTION_FM)
        {
            qWarning("[%s] FM channel ,but not FM mode",__func__);
            return -1;
        }
        m_isSearching = true;
        // mute();
        changeFM(channel);
        QTimer::singleShot(500,this,SLOT(slotSearchChannel()));
        res =0;
    }
    else
    {
        changeChannel(channel);
        if(m_radioMode != RM_FREQ_SECTION_AM)
        {
            qWarning("[%s] AM channel ,but not AM mode",__func__);
            return -1;
        }
        m_isSearching = true;
        //mute();
        changeAM(channel);
        QTimer::singleShot(500,this,SLOT(slotSearchChannel()));
        res =0;
    }
    return res;

}
/* implement auto-channel-change policy here... */
static void  checkChangeChannel(void)
{
#ifdef FREQUENCY_AGILITY
  int8_t dbm, inARow = 0;

  uint8_t i;

  memset(sSample, 0x0, SSIZE);
  for (i=0; i<SSIZE; ++i)
  {
    /* quit if we need to service an app frame */
    if (sPeerFrameSem || sJoinSem)
    {
      return;
    }
    NWK_DELAY(1);
    SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_RSSI, (void *)&dbm);
    sSample[i] = dbm;

    if (dbm > INTERFERNCE_THRESHOLD_DBM)
    {
      if (++inARow == IN_A_ROW)
      {
        changeChannel();
        break;
      }
    }
    else
    {
      inARow = 0;
    }
  }
#endif
  return;
}
Beispiel #3
0
void ScreenPhone::keypadEvent(const QString &digit)
{
    QVariant actualKeypadText = controller->qmlviewer->rootContext()->contextProperty("keypadText");

    if(digit=="c1")
    {
        setActive_channel(1);
        changeChannel();
        return;
    }

    if(digit=="c2")
    {
        setActive_channel(2);
        changeChannel();
        return;
    }

    if(digit=="backspace")
    {
        QString temp(actualKeypadText.toString());
        controller->qmlviewer->rootContext()->setContextProperty("keypadText", temp.left(temp.length()-1));
        return;
    }

    if(digit=="clear")
    {
        controller->qmlviewer->rootContext()->setContextProperty("keypadText", "");
        return;
    }

    if(active_channel()==1)
    {
        sendDTMF((pjsua_call_id)this->m_c1_call_id , (char*)digit.toStdString().c_str());
    }
    else if(active_channel()==2)
    {
        sendDTMF((pjsua_call_id)this->m_c1_call_id, (char*)digit.toStdString().c_str());
    }

    controller->qmlviewer->rootContext()->setContextProperty("keypadText",actualKeypadText.toString()+digit);
}
Beispiel #4
0
//Callbacks
void onChannelOk(GtkWidget *widget, gpointer user_data)
{
	if(strcmp(globals.channel,(char*)gtk_entry_get_text(GTK_ENTRY(chanDLG.channel)))==0)
	{
		gtk_widget_hide(chanDLG.window);
		return;
	}
	strcpy(globals.channel,gtk_entry_get_text(GTK_ENTRY(chanDLG.channel)));
	changeChannel();
	gtk_widget_hide(chanDLG.window);
}
Beispiel #5
0
void ScreenPhone::setActive_channel(const int channel)
{
    m_active_channel = channel;
    changeChannel();
    emit active_channelChanged(channel);
}
void main (void)
{
  bspIState_t intState;

#ifdef FREQUENCY_AGILITY
  memset(sSample, 0x0, sizeof(sSample));
#endif

  BSP_Init();

  /* If an on-the-fly device address is generated it must be done before the
   * call to SMPL_Init(). If the address is set here the ROM value will not
   * be used. If SMPL_Init() runs before this IOCTL is used the IOCTL call
   * will not take effect. One shot only. The IOCTL call below is conformal.
   */
#ifdef I_WANT_TO_CHANGE_DEFAULT_ROM_DEVICE_ADDRESS_PSEUDO_CODE
  {
    addr_t lAddr;

    createRandomAddress(&lAddr);
    SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &lAddr);
  }
#endif /* I_WANT_TO_CHANGE_DEFAULT_ROM_DEVICE_ADDRESS_PSEUDO_CODE */

  SMPL_Init(sCB);

  /* green and red LEDs on solid to indicate waiting for a Join. */
  if (!BSP_LED2_IS_ON())
  {
    toggleLED(2);
  }
  if (!BSP_LED1_IS_ON())
  {
    toggleLED(1);
  }

  /* main work loop */
  while (1)
  {
    /* manage FHSS schedule if FHSS is active */
    FHSS_ACTIVE( nwk_pllBackgrounder( false ) );
    
    /* Wait for the Join semaphore to be set by the receipt of a Join frame from a
     * device that supports an End Device.
     *
     * An external method could be used as well. A button press could be connected
     * to an ISR and the ISR could set a semaphore that is checked by a function
     * call here, or a command shell running in support of a serial connection
     * could set a semaphore that is checked by a function call.
     */
    if (sJoinSem && (sNumCurrentPeers < NUM_CONNECTIONS))
    {
      /* listen for a new connection */
      while (1)
      { /* SMPL_LinkListen will call nwk_PllBackgrounder for us if FHSS active */
        if (SMPL_SUCCESS == SMPL_LinkListen(&sLID[sNumCurrentPeers]))
        {
          break;
        }
        /* Implement fail-to-link policy here. otherwise, listen again. */
      }

      sNumCurrentPeers++;

      BSP_ENTER_CRITICAL_SECTION(intState);
      sJoinSem--;
      BSP_EXIT_CRITICAL_SECTION(intState);
    }

    /* Have we received a frame on one of the ED connections?
     * No critical section -- it doesn't really matter much if we miss a poll
     */
    if (sPeerFrameSem)
    {
      uint8_t     msg[MAX_APP_PAYLOAD], len, i;

      /* process all frames waiting */
      for (i=0; i<sNumCurrentPeers; ++i)
      {
        if (SMPL_SUCCESS == SMPL_Receive(sLID[i], msg, &len))
        {
          processMessage(sLID[i], msg, len);

          BSP_ENTER_CRITICAL_SECTION(intState);
          sPeerFrameSem--;
          BSP_EXIT_CRITICAL_SECTION(intState);
        }
      }
    }
    if (BSP_BUTTON1())
    {
      SPIN_ABOUT_A_QUARTER_SECOND;  /* debounce */
      changeChannel();
    }
    else
    {
      checkChangeChannel();
    }
    BSP_ENTER_CRITICAL_SECTION(intState);
    if (sBlinky)
    {
      if (++sBlinky >= 0xF)
      {
        sBlinky = 1;
        toggleLED(1);
        toggleLED(2);
      }
    }
    BSP_EXIT_CRITICAL_SECTION(intState);
  }

}