/**
 * @fn void Query_Current_Status(s_AppRadio * pRadio, PayloadFrame *payload)
 *
 * @brief This function checks if its the time to report the status. If yes, 
 *        It populates the status information in its own node structure.
 *
 * @param pRadio an s_AppRadio structure pointer
 * @param payload a PayloadFrame structure pointer
 */
void Query_Current_Status(s_AppRadio * pRadio, PayloadFrame *payload)
{
  unsigned char i;
  i = NodeIsInMyNet(payload->NodeID);                                           // Check if the node is in my net
  if (i) {                                                                      // Load status bytes into my  node structure
    #ifdef INCLUDE_FRAMECOUNTER_STATUS
      Nodes[i].FrameCounter++;
    #endif
      Nodes[0].LastRSSI = RadioReadRegister(pCurrentFrameworkRadio(pRadio), CCXXX_STAT_RSSI);
      Nodes[i].LastRSSI = RadioLocal.RxFrameStruct.frameHeader[RSSI_RECEIVER];
    #ifdef INCLUDE_LQI_STATUS
      Nodes[i].LastLocalLQI  = RadioReadRegister(pCurrentFrameworkRadio(pRadio), CCXXX_STAT_LQI) & 0x7F;
      Nodes[i].LastRemoteLQI = RadioLocal.RxFrameStruct.frameHeader[LQI_RECEIVER] & 0x7F;
    #endif
    #ifdef INCLUDE_FREQOFF_STATUS
      Nodes[i].LastLocalFoff  = ~(RadioReadRegister(pCurrentFrameworkRadio(pRadio), CCXXX_STAT_FREQEST) - 1);
      Nodes[i].LastRemoteFoff = ~(RadioLocal.RxFrameStruct.frameHeader[FREQ_OFFSET_RECEIVER] - 1);
    #endif
    #ifdef INCLUDE_POWER_STATUS
      Nodes[i].LastLocalPower  = CurrentPower();
      Nodes[i].LastRemotePower = RadioLocal.RxFrameStruct.frameHeader[CURRENT_POWER_INDEX];
    #endif
    #ifdef INCLUDE_CHANNEL_STATUS
      Nodes[i].LastUsedChannel = CurrentChannel();
    #endif
  }
}
Beispiel #2
0
void cDvbHdFfDevice::SetAudioTrackDevice(eTrackType Type)
{
    //printf("SetAudioTrackDevice %d\n", Type);
    const tTrackId *TrackId = GetTrack(Type);
    if (TrackId && TrackId->id) {
        int streamType = 0;
        cChannel * channel = Channels.GetByNumber(CurrentChannel());
        if (channel) {
            if (IS_AUDIO_TRACK(Type))
                streamType = channel->Atype(Type - ttAudioFirst);
            else if (IS_DOLBY_TRACK(Type))
                streamType = channel->Dtype(Type - ttDolbyFirst);
        }
        //printf("SetAudioTrackDevice new %d %d, current %d\n", TrackId->id, streamType, pidHandles[ptAudio].pid);
        if (pidHandles[ptAudio].pid && pidHandles[ptAudio].pid != TrackId->id) {
            DetachAll(pidHandles[ptAudio].pid);
            if (CamSlot())
                CamSlot()->SetPid(pidHandles[ptAudio].pid, false);
            pidHandles[ptAudio].pid = TrackId->id;
            pidHandles[ptAudio].streamType = streamType;
            SetPid(&pidHandles[ptAudio], ptAudio, true);
            if (CamSlot()) {
                CamSlot()->SetPid(pidHandles[ptAudio].pid, true);
                CamSlot()->StartDecrypting();
            }
        }
    }
}