📄 input.cpp
字号:
cAnswer.AddMessage("Unable to suspend program "+strPgrmName); cAnswer.AddMessage(e.Dump()); } return cAnswer;}//------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------C_Answer C_Input::UpdateProgram(C_String strProgram, C_String strFileName, C_String strType){ C_Answer cAnswer(GetName()); try { OnUpdateProgram(strProgram, strFileName, strType); LogDbg(m_hLog, "Program "+strProgram+" added."); // Build the answer cAnswer.SetStatus(NO_ERR); cAnswer.AddMessage("Program " + strProgram + " added."); } catch(E_Exception e) { // Build the answer cAnswer.SetStatus(e.GetCode()); cAnswer.AddMessage("Unable to add program "+strProgram); cAnswer.AddMessage(e.Dump()); } return cAnswer;}//------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------C_Answer C_Input::DeleteProgram(C_String strProgram){ C_Answer cAnswer(GetName()); try { OnDeleteProgram(strProgram); LogDbg(m_hLog, "Configuration Program "+strProgram+" removed."); // Build the answer cAnswer.SetStatus(NO_ERR); cAnswer.AddMessage("Configuration Program " + strProgram + " removed."); } catch(E_Exception e) { // Build the answer cAnswer.SetStatus(e.GetCode()); cAnswer.AddMessage("Unable to delete program "+strProgram); cAnswer.AddMessage(e.Dump()); } return cAnswer;}//------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------C_Answer C_Input::StopStreaming(C_Broadcast* pBroadcast){ C_Answer cAnswer(GetName()); cAnswer.SetStatus(NO_ERR); const C_Program* pPgrm = pBroadcast->GetProgram(); const C_String strPgrmName = pPgrm->GetName(); try { // Ask the child to stop the streaming if((pBroadcast->GetStatus() == BROADCAST_RUNNING)) { LogDbg(m_hLog, "Stopping reception of pgrm "+strPgrmName); OnStopStreaming(pBroadcast); pBroadcast->SetStatus(BROADCAST_STOPPED); LogDbg(m_hLog, "Pgrm "+strPgrmName+" stopped"); // Build the answer cAnswer.SetStatus(NO_ERR); cAnswer.AddMessage("Program " + strPgrmName + " stopped"); } else { cAnswer.AddMessage("Program " + strPgrmName + " not broadcasted"); } } catch(E_Exception e) { LogDbg(m_hLog, "Error when stopping program "+strPgrmName); cAnswer.AddMessage("Error when stopping program " + strPgrmName); cAnswer.SetStatus(e.GetCode()); } // Mark as free again ASSERT(!m_bIsFree); m_bIsFree = true; return cAnswer;}//------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------C_List<C_Program> C_Input::GetAvailablePgrms(){ return OnGetAvailablePgrms();}//------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------/*C_Answer C_Input::BrowsePgrmTable(){ C_Answer cAnswer(m_strName); cAnswer.SetStatus(NO_ERR); cAnswer.AddMessage("Program Table"); m_cDirectory.Lock(); for(unsigned int i = 0; i < m_cDirectory.GetSize(); i++) { C_Program& cPgrm = (m_cDirectory)[i]; C_String strPgrmName = cPgrm.GetName(); ASSERT(strPgrmName != ""); C_Answer* pPgrmDescr = new C_Answer(strPgrmName); ASSERT(pPgrmDescr); pPgrmDescr->SetStatus(cPgrm.GetStatus()); pPgrmDescr->AddMessage(cPgrm.GetDescription()); cAnswer.Add(pPgrmDescr); } m_cDirectory.UnLock(); return cAnswer;}*///------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------/*int C_Input::CancelStreaming(const C_Broadcast& cBroadcast){ LogDbg(m_hLog, "Received internal stop command for pgrm "+iPgrmNumber); // Just lock the pgrm before asking the child to do the job C_Program* pPgrm = m_cDirectory.GetPgrm(iPgrmNumber); ASSERT(pPgrm); int iRc = StopReception(pPgrm); m_cDirectory.ReleasePgrm(pPgrm); return iRc;}*///------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------/*int C_Input::UpdatePgrmTable(){ LogDbg(m_hLog, "Updating pgrm table"); // Just lock the pgrm table before asking the child to do the job m_cDirectory.Lock(); int iRc = OnUpdatePgrmTable(); m_cDirectory.UnLock(); return iRc;}*///------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------/*int C_Input::Fail(int iError, const C_String& strMsg){ LogDbg(m_hLog, "Input failure: " + strMsg); // Lock the pgrm table before recording the error and asking the child to // handle the pb m_cDirectory.Lock(); m_iStatus = iError; m_strErrorMsg = strMsg; int iRc = OnFailure(iError); m_cDirectory.UnLock(); return iRc;}*///------------------------------------------------------------------------------////------------------------------------------------------------------------------////------------------------------------------------------------------------------/*int C_Input::Recover(){ LogDbg(m_hLog, "Input recovery"); // Lock the pgrm table before recording the recovery and asking the child to // handle it m_cDirectory.Lock(); m_iStatus = NO_ERR; m_strErrorMsg = ""; int iRc = OnRecovery(); m_cDirectory.UnLock(); return iRc;}*///------------------------------------------------------------------------------////-----------------------------------------------------------------------------/*int C_Input::StartReception(C_Program* pPgrm, const C_Broadcast& cBroadcast){ ASSERT(pPgrm); u16 iPgrmNumber = pPgrm.GetPgrmNumber(); LogDbg(m_hLog, "Starting reception of pgrm "+iPgrmNumber); int iRc = OnStartReception(cBroadcast); if(!iRc) { LogDbg(m_hLog, "Reception of pgrm "+iPgrmNumber+" started"); pPgrm->SetStatus(PGRM_BROADCASTED); } else { LogDbg(m_hLog, "Reception of pgrm "+iPgrmNumber+" failed"); pPgrm->SetStatus(PGRM_ERROR); pOutput->Close(); } return iRc;}*///------------------------------------------------------------------------------////------------------------------------------------------------------------------/*int C_Input::StopReception(C_Program* pPgrm, const C_Broadcast& cBroadcast){ ASSERT(pPgrm); int iRc = NO_ERR; if(pPgrm->GetStatus() != PGRM_BROADCASTED) { // Program has already been stopped, there is nothing to do u16 iPgrmNumber = pPgrm->GetPgrmNumber(); LogDbg(m_hLog, "Pgrm "+iPgrmNumber+" not broadcasted, no need to stop it"); } else { u16 iPgrmNumber = pPgrm->GetPgrmNumber(); LogDbg(m_hLog, "Stopping pgrm "+iPgrmNumber); iRc = OnStopReception(iPgrmNumber); if(!iRc) pPgrm->SetStatus(PGRM_AVAILABLE); else pPgrm->SetStatus(PGRM_ERROR); LogDbg(m_hLog, "Closing output for pgrm "+iPgrmNumber); } return iRc;}*///------------------------------------------------------------------------------////------------------------------------------------------------------------------const C_String& C_Input::GetName() const{ return m_strName;}bool C_Input::operator == (const C_Input& cInput) const{ // The test is made on the input address: since all remote input have a local // instance of the C_RemoteInput class, this will work in all cases return (this == &cInput);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -