void CSystemStateMachine::onAuthenticationAppAvailable()
{
   LOG4CPLUS_TRACE(sLogger, "onAuthenticationAppAvailable()");
   LOG4CPLUS_INFO(sLogger, "OK!!! AuthenticationApp  started and ready for communication");
}
CTongshiDVBSource::~CTongshiDVBSource()
{
  LOG4CPLUS_INFO(logger, "CTongshiDVBSource::dtor()");

  LOG4CPLUS_INFO(logger, "CTongshiDVBSource::dtor() completed");
}
Exemple #3
0
void CScreenSharingViewer::handleError(BaseError const & error)
{
   LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
   LOG4CPLUS_INFO(msLogger,static_cast<std::string>(error));
}
Exemple #4
0
 void Channel::OnDecreaseBandwidth()
 {
     LOG4CPLUS_INFO(Loggers::Channel(), "Decreasing sessions limit for channel "<<channel_id_);
     size_t current_sessions_count = session_manager_->GetChannelSessionsCount(channel_id_);
     channel_sessions_count_constraint_.DecreaseLimit(current_sessions_count);
 }
void PmpComponentManager::endInitialization()
{
    LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__ );

    assert(mIpcProtocol);
    assert(mAmpClient);

    if (mInitializationDone)
    {
        LOG4CPLUS_WARN(mLogger, "Initialization done");
        return;
    }
    mInitializationDone = true;

    if (!mIpcProtocol->connect())
    {
        LOG4CPLUS_FATAL(mLogger, "Can't connect IPC protocol");
        killProcess(1);
    }

    LOG4CPLUS_INFO(mLogger, "IPC protocol connected");

    if (mSCMsg)
    {
        mSCMsg->requestConnected();
        LOG4CPLUS_INFO(mLogger, "Sent request to SC");
    }
    else
    {
        LOG4CPLUS_WARN(mLogger, "Started without SC connection possibility");
    }

    bool res = false;
    for(int i=0; i<30; ++i)
    {
        LOG4CPLUS_INFO(mLogger, "Connecting to AMP...");
        if (mAmpClient->connect())
        {
            res = true;
            break;
        }
        usleep(250000);
    }
    if (!res)
    {
        LOG4CPLUS_FATAL(mLogger, "No AMP connection");
        killProcess(1);
    }
    LOG4CPLUS_INFO(mLogger, "AMP connected");

    char macAddr[13] = "";

    bool mres = get_mac(macAddr);
    int mac = mres ? atoi(macAddr) : 0;
    srand(mac + time(NULL) + getpid());
    negotiateRole();
    if (-1 != mOtherRoleNumber)
    {
    	onNegotiateRole(mOtherRoleNumber);
    }
}
	void TrackeragStatistic::OnDumpInfo()
	{
		LOG4CPLUS_INFO(g_logger,"OnDumpInfo");

		int tmptotal = 0;
		for(map<int,int>::iterator it = list_count_times_.begin();it != list_count_times_.end();++it)
		{
			tmptotal += fabs((double)it->second);
			LOG4CPLUS_INFO(g_logger,"list_"<<it->first<<" "<<it->second);
		}
		LOG4CPLUS_INFO(g_logger,"total list count:"<<tmptotal);
		//list_count_times_.clear();

		tmptotal = 0;
		for(map<int,int>::iterator it = tracker_list_count_times_.begin();it != tracker_list_count_times_.end();++it)
		{
			tmptotal += fabs((double)it->second);
			LOG4CPLUS_INFO(g_logger,"list_"<<it->first<<" "<<it->second);
		}
		LOG4CPLUS_INFO(g_logger,"tracker list count:"<<tmptotal);
		//tracker_list_count_times_.clear();

		double ratio = 0.0;
		double request_times = 0.0;
		double response_times = 0.0;

		tmptotal = 0;
		for(map<int,int>::iterator it = list_response_num_.begin();it != list_response_num_.end();++it)
		{
			tmptotal += fabs((double)it->second);
			LOG4CPLUS_INFO(g_logger,"tracker response num:"<<it->first<<" times:"<<it->second);
		}
		LOG4CPLUS_INFO(g_logger,"total tracker response num:"<<tmptotal);
		//list_response_num_.clear();

		int tmp_request_total = 0;
		int tmp_response_total = 0;
		int tmp_response_total_0 = 0;

		map<boost::asio::ip::udp::endpoint,int> list_endpoint_request = TrackerRequestHandler::Instance()->ClearListEndRequest();
		for(map<boost::asio::ip::udp::endpoint,int>::iterator it = list_endpoint_request.begin();it != list_endpoint_request.end();++it)
		{
			tmp_request_total += fabs((double)it->second);
			LOG4CPLUS_INFO(g_logger,it->first<<" times:"<<it->second);
			request_times = (double)it->second;
			//tmp_response_total += (double)list_endpoint_response_[it->first];
			tmp_response_total_0 += (double)list_endpoint_response_0[it->first];
		}
		if (tmp_request_total != 0)
		{
			ratio = (1.0*timeout_response_)/tmp_request_total;
			//LOG4CPLUS_INFO(g_stat_logger,"total request times: "<<tmp_request_total<<", total timeout response: "<<timeout_response_<<", loss ratio: "<<ratio<<", total response times with 0 peer: "<<tmp_response_total_0);
			LOG4CPLUS_INFO(g_logger,"total tracker list request count:"<<tmptotal);
		}
		else
		{
			//LOG4CPLUS_INFO(g_stat_logger,"total request times: 0, "<<"total timeout response: 0, "<<"loss ratio: 0");
			LOG4CPLUS_INFO(g_logger,"total tracker list request count:"<<tmptotal);
		}
		timeout_response_ = 0;
		//list_endpoint_request.clear();
		//list_endpoint_response_.clear();
		//list_endpoint_response_0.clear();

		tmptotal = 0;
		ratio = 0;
		for(map<boost::asio::ip::udp::endpoint,int>::iterator it = list_endpoint_response_.begin();it != list_endpoint_response_.end();++it)
		{        
			tmptotal += fabs((double)it->second);
			LOG4CPLUS_INFO(g_logger,it->first<<" times:"<<it->second);
		}
		LOG4CPLUS_INFO(g_logger,"total tracker list response count:"<<tmptotal);
		//list_endpoint_response_.clear();

		LOG4CPLUS_INFO(g_logger,"unexpected_response_:"<<unexpected_response_);
		unexpected_response_ = 0;

		LOG4CPLUS_INFO(g_logger,"use_cache_result_:"<<use_cache_result_);
		if (total_result_ != 0)
		{
			ratio = (1.0*use_cache_result_)/total_result_;
			//LOG4CPLUS_INFO(g_stat_logger,"total success result:"<<total_result_<<",use_cache_result_:"<<use_cache_result_<<",use cache ratio:"<<ratio);
		}
		else
		{
			//LOG4CPLUS_INFO(g_stat_logger, "total_result_ is 0");
		}
		use_cache_result_ = 0;
		total_result_ = 0;

		//日志记录RID的查询次数
		for(map<RID,int>::iterator it = rid_times_.begin();it != rid_times_.end();++it )
		{
			const static int REQ_TIMES = 100;
			//只打出查询次数大于REQ_TIMES次的RID
			if(it->second > REQ_TIMES)
				LOG4CPLUS_INFO(g_logger,"Rid:"<<it->first.to_string()<<" times:"<<it->second);
		}
		LOG4CPLUS_INFO(g_logger,"rid times size:"<<rid_times_.size());
		//rid_times_.clear();

	}
void CMediaControlServerProfile::onBufferReceived(const iviLink::Channel::tChannelId channel, iviLink::CBuffer const& buffer) {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    if (mChannelID != channel)
    {
        LOG4CPLUS_INFO(msLogger, "mChannelID != channel_id");
        return;
    }
    else
    {
        LOG4CPLUS_INFO(msLogger, "mChannelID == channel_id");
    }

    UInt8 *incomingData = buffer.getBuffer();
    int read_size = buffer.getSize();

    LOG4CPLUS_INFO(msLogger, "Procedure ID = " + convertIntegerToString(incomingData[0]));

    if(incomingData[0] == STOP)
    {
        LOG4CPLUS_INFO(msLogger, "case STOP");
        mpAppCallbacks->onServerStop();
        mpServControl->sendCommand(mpServControl->mStop);

    }
    else if(incomingData[0] == SERVERSTOP)
    {
        LOG4CPLUS_INFO(msLogger, "case SERVERSTOP");
        serverStop();
    }
    else if(incomingData[0] == PAUSE)
    {
        LOG4CPLUS_INFO(msLogger, "case PAUSE");
        mpAppCallbacks->onServerPause();
        mpServControl->sendCommand(mpServControl->mPause);
    }
    else if(incomingData[0] == RESUME)
    {
        LOG4CPLUS_INFO(msLogger, "case RESUME");
        resume();
    }
    else if(incomingData[0] == SYNC)
    {
        LOG4CPLUS_INFO(msLogger, "case SYNC");
        mpAppCallbacks->onServerSync();
    }
    else if(incomingData[0] == UNSYNC)
    {
        LOG4CPLUS_INFO(msLogger, "case UNSYNC");
        mpAppCallbacks->onServerUnsync();
    }
    else if(incomingData[0] == TOGGLE)
    {
        LOG4CPLUS_INFO(msLogger, "case TOGGLE");
        mpAppCallbacks->onServerToggle();
    }
    else if(incomingData[0] == PLAY)
    {
        LOG4CPLUS_INFO(msLogger, "case PLAY");
        std::string message((char*)(incomingData + 1), read_size - 1);
        LOG4CPLUS_INFO(msLogger, "message  = " + message);
        vector<string> parse_result;
        split(message, ";", parse_result);
        if (parse_result.size() == 3)
        {
            LOG4CPLUS_INFO(msLogger, parse_result[0]);
            LOG4CPLUS_INFO(msLogger, parse_result[1]);
            LOG4CPLUS_INFO(msLogger, parse_result[2]);
            LOG4CPLUS_INFO(msLogger, "get message:" + parse_result[0] + " ; " + parse_result[1] + " ; " + parse_result[2]);
            play(parse_result[0], parse_result[1], parse_result[2]);
        }
        else
        {
            LOG4CPLUS_INFO(msLogger, "cannot parse message");
        }

    }
    else
    {
        LOG4CPLUS_INFO(msLogger, "unknown procedure ID");
    }

}
Exemple #8
0
CPMALError CPIM::loadProfile(iviLink::Profile::Uid const& profileUid,
            iviLink::Service::Uid const& sid,
            iviLink::Profile::IProfileCallbackProxy* const pProxy,
            Profile::CProfile*& pProfile)
{
   LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__ + (" uid" + profileUid.value()));

   Profile::CProfile* pProf = NULL;

   std::string path;

   // prepearing

   CPMALComponentMgr* pMgr = CPMALComponentMgr::getInstance();
   if (!pMgr)
   {
      return CPMALError(CPMALError::ERROR_PIM_INTERNAL, gModuleName, "no instance of CPMALComponentMgr. Something is very wrong");
   }

   IPMALCoreToPIM* pCore = pMgr->getCoreToPIM();
   if (!pCore)
   {
      return CPMALError(CPMALError::ERROR_PIM_INTERNAL, gModuleName, "no instance of PMAL Core");
   }

   bool profileEnabled = false;
   CError err = pCore->isEnabledProfile(profileUid, profileEnabled);
   if (!err.isNoError())
   {
      LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));
      return CPMALError(CPMALError::ERROR_PIM_INTERNAL, gModuleName, "unable to get state of profile");
   }

   if (!profileEnabled)
   {
      LOG4CPLUS_ERROR(logger, "profile is disabled");
      return CPMALError(CPMALError::ERROR_UNKNOWN_PROFILE_UID, gModuleName, "profile is disabled or unknown");
   }

   err = pCore->getProfileLibPath(profileUid, path);
   if (!err.isNoError())
   {
      LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));
      return CPMALError(CPMALError::ERROR_UNKNOWN_PROFILE_UID, gModuleName, "no profile library path");
   }

   Profile::IUid piuid;
   {
      CPMALError err = generatePIUID(profileUid, sid, piuid);
      if (!err.isNoError())
         return err;
   }

   // creating
   LOG4CPLUS_INFO(logger, "creating profile '" + path + "'with piuid '" + piuid.value() + "'");
   Profile::CProfileInternal* pProfInt = NULL;
   PIM::ProfileInitData initData(piuid, sid, pProxy);
   err = PIM::createProfileImpl(path.c_str(), initData, pProfInt);

   if (!err.isNoError())
   {
      PIM::releasePIUID(piuid);

      LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));
      return CPMALError(CPMALError::ERROR_PIM_INTERNAL, gModuleName, "unable to create profile object");
   }

   assert(pProfInt);

   err = pProfInt->getError();
   if (!err.isNoError())
   {
      PIM::releasePIUID(piuid);
      err = pProfInt->getError();
      LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));

      PIM::CProfileDestroyer::destroy(pProfInt);
      return CPMALError(CPMALError::ERROR_PROFILE_INIT, gModuleName, "profile implementation init error");
   }

   // registering

   pProf = static_cast<Profile::CProfile*>(pProfInt);
   err = mInstanceMap.registerProfile(piuid, pProf);
   if (!err.isNoError())
   {
      PIM::CProfileDestroyer::destroy(pProf);

      LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));

      return CPMALError(CPMALError::ERROR_PIM_INTERNAL, gModuleName, "unable to register profile object");
   }

   // messaging
   IPMALIpcToPIM* ipc = pMgr->getIpcToPIM();
   assert(ipc);
   err = ipc->createProfile(profileUid, piuid, sid);
   if (!err.isNoError())
   {
      /// @todo what error handling can be here?
      LOG4CPLUS_INFO(logger, "todo what error handling can be here?");

      LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));
   }

   // enabling

   PIM::CProfileEnabler::enable(pProf);

   pProfile = pProf;

   return CPMALError::NoPMALError(gModuleName);
}
Exemple #9
0
void DBmgrTask::run()
{
    ConfigureParser& config = SingletonConfigureParser::instance();
    
    std::string host;
    std::string user;
    std::string passwd;
    std::string db;
    int port;

    if ( config.get("mysql", "host").empty() ) {
        throw std::runtime_error("Configure file no mysql-host");
    }
    host = config.get("mysql", "host");

    if ( config.get("mysql", "user").empty() ) {
        throw std::runtime_error("Configure file no mysql-user");
    }
    user = config.get("mysql", "user");

    if ( config.get("mysql", "passwd").empty() ) {
        throw std::runtime_error("Configure file no mysql-passwd");
    }
    passwd = config.get("mysql", "passwd");

    if ( config.get("mysql", "db").empty() ) {
        throw std::runtime_error("Configure file no mysql-db");
    }
    db = config.get("mysql", "db");

    if ( config.get("mysql", "port").empty() ) {
        throw std::runtime_error("Configure file no mysql-port");
    }
    port = config.getInt("mysql", "port");

    if ( m_mysql.connect(host, user, passwd, db, port) == NULL ) {
        LOG4CPLUS_ERROR(LOGGER, m_mysql.error());
        return;
    }

    char buf[2048];
    int ret = m_client.recv(buf, 2048);
    if ( ret == -1 ) {
        LOG4CPLUS_ERROR(LOGGER, "Recieve message from client "
                                << m_client.getHost() << ":"
                                << m_client.getPort()
                                << " failure, error code is ["
                                << errno << "]");
        return;
    } else if ( ret == 0 ) {
        LOG4CPLUS_ERROR(LOGGER, "Client " << m_client.getHost()
                                << ":" << m_client.getPort()
                                << " has shutdown the connection");
        return;
    }

    LOG4CPLUS_INFO(LOGGER, "Recieve message: [" << buf << "]"
                            << " from client " << m_client.getHost()
                            << ":" << m_client.getPort());

    std::vector<std::string> msgs;
    boost::algorithm::split(msgs, buf, boost::algorithm::is_any_of("\t"));
    if ( msgs.size() != 2 ) {
        LOG4CPLUS_WARN(LOGGER, "The message format is wrong");
        m_client.send(ERROR_FORMAT, strlen(ERROR_FORMAT));
        return;
    }

    std::string sql = "";
    if ( msgs[0] == "login" ) {
        std::vector<std::string> user_info;
        boost::algorithm::split(user_info, msgs[1], boost::algorithm::is_any_of(" "));
        sql += "select * from users where user='******' and passwd='" + user_info[1] + "'";
    }

    MYSQL_RESULT result = m_mysql.query(sql);
    if ( result.size() ) {
        std::cout << result << std::endl;
        m_client.send("Login success", 13);
    } else {
        m_client.send(m_mysql.error(), strlen(m_mysql.error()));
    }
}
Exemple #10
0
int CPlayer::actuallyPlay(const std::string& source, const std::string& avform)
{

    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    LOG4CPLUS_INFO(msLogger, "args: " + source + " " + avform);
    mVideoWidget->video_hide();
    usleep(2000);
    mMutex->lockWrite();
    LOG4CPLUS_INFO(msLogger, "source: " + source);
    mPath = libvlc_media_new_path(mInst, source.c_str());
    LOG4CPLUS_INFO(msLogger, "Player now!");
    if (hasPlayerInstance == false)
    {
        mMediaPlayer = libvlc_media_player_new_from_media(mPath);
    }
    else
    {
        libvlc_media_player_set_media(mMediaPlayer,mPath);
    }
    hasPlayerInstance = true;
    libvlc_media_release (mPath);
    int res = ERROR_PLAY;
    if (avform == VIDEO)
    {
        LOG4CPLUS_INFO(msLogger, "get video source");
        assert(mMediaPlayer);
        mVideoWidget->setMediaPlayer(mMediaPlayer);
        mVideoWidget->show();
        res = libvlc_media_player_play(mMediaPlayer);
        mMutex->unlockWrite();
        if (res == ERROR_PLAY)
        {
            LOG4CPLUS_WARN(msLogger, "vlc player cannot start playing media");
        }
        else
        {
            if(mPlaybackStartedCallback)
            {
                mPlaybackStartedCallback->onPlaybackStarted();
            }
        }
        return res;
    }
    else if (avform == AUDIO)
    {
        LOG4CPLUS_INFO(msLogger, "get audio source");
        res = libvlc_media_player_play(mMediaPlayer);
        mMutex->unlockWrite();
        if (res == ERROR_PLAY)
        {
            LOG4CPLUS_WARN(msLogger, "vlc player cannot start playing media");
        }
        else
        {
            if(mPlaybackStartedCallback)
            {
                mPlaybackStartedCallback->onPlaybackStarted();
            }
        }
        return res;
    }
    LOG4CPLUS_WARN(msLogger, "unknown source format");
    mMutex->unlockWrite();
    return ERROR_PLAY;
}
PlayWithStrings::~PlayWithStrings() {
	LOG4CPLUS_INFO(PlayWithStrings_logger, LOG4CPLUS_TEXT("PlayWithStrings::~PlayWithStrings"));
}
Exemple #12
0
void ChiikaApi::Log::info(const std::string& src, const std::string& msg, const char *file, int line, const char *fn)
{
	LOG4CPLUS_INFO(log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("Chiika")),
		fn << " - " << msg.c_str());
}
Exemple #13
0
void CUnixSocket::threadFunc()
{
   LOG4CPLUS_TRACE(logger, "CUnixSocket::threadFunc() this = "
                          + convertIntegerToString((intptr_t)this));
   UInt32 size = 0;

   assert(mpSubscriber);

   if (mIncomingListen)
   {
      assert(mSock != -1);

      while (!getStopFlag())
      {
         int newSock = accept(mSock, NULL, NULL);
         assert(newSock != -1);
         LOG4CPLUS_INFO(logger, "CUnixSocket::threadFunc() new socket accepted this = "
                               + convertIntegerToString((intptr_t)this));
         mpSubscriber->onIncomingConnection(this, new CUnixSocket(false, mpSubscriber, newSock, mAskForReadiness));
         /*
         fd_set readfds;
         FD_ZERO(&readfds);
         FD_SET(mSock, &readfds);

         int ret = select(0, &readfds, NULL, NULL, &tv);
         if (ret > 0)
         {
            if (FD_ISSET(mSock, &readfds))
            {
               int newSock = accept(mSock, NULL, NULL);
               assert(newSock != -1);
               Log("CUnixSocket::threadFunc() new socket accepted this = %p", this);
               mpSubscriber->onIncomingConnection(this, new CUnixSocket(false, mpSubscriber, newSock));
            }
         }
         */
      }
   }
   else
   {
      ERROR_CODE err;
      bool canRecv = true;
      while (!getStopFlag())
      {
         if (mAskForReadiness)
         {
            err = receive(size, true);

            if (err == ERR_CONNECTION_LOST)
            {
               mpSubscriber->onConnectionLost(this);
               break;
            }
            else
            {
               mReceiveMutex.lock();

               if (size > 0)
               {
                  canRecv = mpSubscriber->isReadyToReceiveData(this, size);
                  if (!canRecv)
                     CThread::sleep(100);
               }
               else
                  canRecv = false;

               mReceiveMutex.unlock();
            }
         }

         if (canRecv)
         {
            if (receive(size) == ERR_CONNECTION_LOST)
            {
               mpSubscriber->onConnectionLost(this);
               break;
            }
            else if (!mDestroyed)
            {
               mReceiveMutex.lock();

               if (size > 0)
                  mpSubscriber->onReceive(this, mBuffer, size);

               mReceiveMutex.unlock();
            }
         }

      }
   }
}
Exemple #14
0
void CScreenSharingViewer::onIncomingServiceBeforeLoading(const iviLink::Service::Uid &service)
{
   LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
   LOG4CPLUS_INFO(msLogger, "Registering profile callbacks");
   registerProfileCallbacks(iviLink::Profile::ApiUid("ScreenSharingProfile_PAPI_UID"), this);
}
void CSystemStateMachine::startTriggerHandler()
{
   LOG4CPLUS_TRACE(sLogger, "startTriggerHandler()");

   LOG4CPLUS_INFO(sLogger, "Trigger handler is now running...");

   eSSMTriggers trigger;

   while(true)
   {
      LOG4CPLUS_INFO(sLogger, "read trigger");

      trigger = CTriggerQueue::receiveTrigger();

      switch(trigger)
      {
      case EMPTY_TRIGGER_QUEUE:
         LOG4CPLUS_INFO(sLogger, "No incoming triggers");
         break;
      case INITIALIZED:
         LOG4CPLUS_INFO(sLogger, "INITIALIZED trigger");
         mSystemState->launchPhysicalLayer(this);
         break;
      case CONNECTIVITY_AGENT_STARTED:
         LOG4CPLUS_INFO(sLogger, "CONNECTIVITY_AGENT_STARTED trigger");
         break;
      case PHISYCAL_CONNECTION_ESTABLISHED:
         LOG4CPLUS_INFO(sLogger, "PHISYCAL_CONNECTION_ESTABLISHED trigger");
         mSystemState->launchChannelLayer(this);
         break;
      case PHISYCAL_CONNECTION_LOST:
         LOG4CPLUS_WARN(sLogger, "PHISYCAL_CONNECTION_LOST trigger");
         break;
      case CHANNEL_SUPERVISOR_STARTED:
         LOG4CPLUS_INFO(sLogger, "CHANNEL_SUPERVISOR_STARTED trigger");
         break;
      case CHANNEL_CONNECTION_ESTABLISHED:
         LOG4CPLUS_INFO(sLogger, "CHANNEL_CONNECTION_ESTABLISHED trigger");
         mSystemState->launchProfileManager(this);
         break;
      case CHANNEL_CONNECTION_LOST:
         LOG4CPLUS_WARN(sLogger, "CHANNEL_CONNECTION_LOST trigger");
         break;
      case PROFILE_MANAGER_STARTED:
         LOG4CPLUS_INFO(sLogger, "PROFILE_MANAGER_STARTED trigger");
         break;
      case PROFILE_MANAGER_CONNECTION_ESTABLISHED:
         LOG4CPLUS_INFO(sLogger, "PROFILE_MANAGER_CONNECTION_ESTABLISHED trigger");
         mSystemState->launchApplicationManager(this);
         break;
      case APPLICATION_MANAGER_STARTED:
         LOG4CPLUS_INFO(sLogger, "APPLICATION_MANAGER_STARTED trigger");
         break;
      case APPLICATION_MANAGER_CONNECTION_ESTABLISHED:
         LOG4CPLUS_INFO(sLogger, "APPLICATION_MANAGER_CONNECTION_ESTABLISHED trigger");
         if(authOn)
         {
            unlockAuthenticationProfile();
            mSystemState->startAuthentication(this);
         }
         else
         {
            mSystemState->finishAuthentication(this);
         }
         break;
      case AUTHENTICATION_ESTABLISHED:
         LOG4CPLUS_INFO(sLogger, "AUTHENTICATION_ESTABLISHED trigger");
         LOG4CPLUS_WARN(sLogger, "Unlock all profiles and switch to idle state");
         unlockProfiles();
         AuthenticationAppMsgProxy::requestShutDown();
         break;
      case AUTHENTICATION_CANCELED:
         AuthenticationAppMsgProxy::requestShutDown();
         hardReset(true);
         break;
      }
   }
}
 virtual void onConnectivityAgentNotAvailable()
 {
    LOG4CPLUS_TRACE_METHOD(sLogger, __PRETTY_FUNCTION__);
    LOG4CPLUS_INFO(sLogger, __PRETTY_FUNCTION__);
 };
Exemple #17
0
//from CChannelHandler
void CSeatHUProfile::bufferReceived(const iviLink::Channel::tChannelId channel, iviLink::CBuffer const& buffer)
{
   LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
   if (mChannelID != channel)
   {
      LOG4CPLUS_INFO(msLogger, "mChannelID != channel_id");
      return;
   }
   else
   {
      LOG4CPLUS_INFO(msLogger, "mChannelID == channel_id");
   }

   bool res = true;
   UInt16 tmp;
   res = res && buffer.read(tmp);
   if (!res)
   {
      LOG4CPLUS_WARN(msLogger, "Unable to read request type from buffer");
      return;
   }
   EReqType reqType = static_cast<EReqType>(tmp);

   switch(reqType)
   {
   case REQ_TYPE_INIT:
      {
         LOG4CPLUS_INFO(msLogger, "case REQ_TYPE_INIT");
         mpAppCallbacks->onInitRequest();
      }
      break;
   case REQ_TYPE_TAB:
      {
         LOG4CPLUS_INFO(msLogger, "case REQ_TYPE_TAB");
         res = res && buffer.read(tmp);
         if (res)
            mpAppCallbacks->onTabRequest(static_cast<EPersonEvent>(tmp));

      }
      break;
   case REQ_TYPE_HEATER:
      {
         LOG4CPLUS_INFO(msLogger, "case REQ_TYPE_HEATER");
         res = res && buffer.read(tmp);
         if (res)
            mpAppCallbacks->onHeaterRequest(static_cast<EPersonEvent>(tmp));
      }
      break;
   case REQ_TYPE_MOVE:
      {
         LOG4CPLUS_INFO(msLogger, "case REQ_TYPE_MOVE");
         res = res && buffer.read(tmp);
         if (res)
            mpAppCallbacks->onMoveRequest(static_cast<EMoveEvent>(tmp));
      }
      break;
   default:
      {
         LOG4CPLUS_WARN(msLogger, "Unknown request type");
         return;
      }
      break;
   }

   if (!res)
   {
      LOG4CPLUS_WARN(msLogger, "Unable to read event from buffer");
      return;
   }
}
 virtual void onChannelSupervisorNotAvailable()
 {
    LOG4CPLUS_TRACE_METHOD(sLogger, __PRETTY_FUNCTION__);
    LOG4CPLUS_INFO(sLogger, __PRETTY_FUNCTION__);
 };
	void TrackeragStatistic::OutputStatisticData()
	{
		float hit_rate = 0.0;
		int request_times = 0;
		int hit_times = 0;
		std::pair< std::string, int > max_ip_pair = GetMaxQuery(query_ip_times_);
		std::pair< RID, int > max_Rid_pair = GetMaxQuery(rid_times_);
		ComputeQueryHitRate(hit_rate, request_times, hit_times);
		if (request_times)
		{
			LOG4CPLUS_INFO(g_stat_logger, "Request_times:"<< request_times 
				<<" Hit_times:" << hit_times <<" hit_rate:" << hit_rate
				<<" Max_ip:" << max_ip_pair.first <<" Times:" << max_ip_pair.second
				<<" Max RID:" << max_Rid_pair.first << " Times:" << max_Rid_pair.second );
		}
		else
		{
			LOG4CPLUS_INFO(g_stat_logger, "Request_times:"<< request_times);
		}

		std::ostringstream oss;

		for (map<int, std::pair< int, int > >::iterator it = cmd_times_v2_.begin();it != cmd_times_v2_.end();++it)
		{
			oss<<" Cmd :0x" << std::hex <<it->first<<" count:"<<std::dec<< it->second.first;
		}
		if (cmd_times_v2_.size() == 0)
		{
			oss<<"Cmd count: "<<0;
		}

		//rid_times_.clear();

		if (oss.str().length() > 0)
		{
			LOG4CPLUS_INFO(g_stat_logger,oss.str());
		}

		LOG4CPLUS_INFO(g_stat_logger, this->ReportStatistic());

		int tmp_request_total = 0;
		int tmp_response_total = 0;
		int tmp_response_total_0 = 0;
		double ratio = 0.0;
		map<boost::asio::ip::udp::endpoint,int> list_endpoint_request = TrackerRequestHandler::Instance()->ClearListEndRequest();
		for(map<boost::asio::ip::udp::endpoint,int>::iterator it = list_endpoint_request.begin();it != list_endpoint_request.end();++it)
		{
			tmp_request_total += fabs((double)it->second);
			//LOG4CPLUS_INFO(g_logger,it->first<<" times:"<<it->second);
			request_times = (double)it->second;
			//tmp_response_total += (double)list_endpoint_response_[it->first];
			tmp_response_total_0 += (double)list_endpoint_response_0[it->first];
		}
		if (tmp_request_total != 0)
		{
			ratio = (1.0*timeout_response_)/tmp_request_total;
			LOG4CPLUS_INFO(g_stat_logger,"total request times: "<<tmp_request_total<<", total timeout response: "<<timeout_response_<<", loss ratio: "<<ratio<<", total response times with 0 peer: "<<tmp_response_total_0);
			//LOG4CPLUS_INFO(g_logger,"total tracker list request count:"<<tmptotal);
		}
		else
		{
			LOG4CPLUS_INFO(g_stat_logger,"total request times: 0, "<<"total timeout response: 0, "<<"loss ratio: 0");
			//LOG4CPLUS_INFO(g_logger,"total tracker list request count:"<<tmptotal);
		}
	}
 virtual void onProfileManagerNotAvailable()
 {
    LOG4CPLUS_TRACE_METHOD(sLogger, __PRETTY_FUNCTION__);
    LOG4CPLUS_INFO(sLogger, __PRETTY_FUNCTION__);
 };
Exemple #21
0
void CLogger::stopSystem()
{
	log4cplus::Logger _logger = log4cplus::Logger::getRoot();
	LOG4CPLUS_INFO(_logger, "Logger System Stop.");
}
 virtual void onAuthenticationAppNotAvailable()
 {
    LOG4CPLUS_TRACE_METHOD(sLogger, __PRETTY_FUNCTION__);
    LOG4CPLUS_INFO(sLogger, __PRETTY_FUNCTION__);
 };
void PmpComponentManager::initPmp()
{
    LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__ );

    assert(mConfig);
    assert(mProfileRepository);
    assert(mServiceRepository);
    assert(mCore);
    assert(mPim);
    assert(mInteractionProtocol);
    assert(mIpcProtocol);
    assert(mAmpClient);
    assert(mEventHandler);
    assert(mEventFactory);
    assert(mSessionManager);
    if (! mSCMsg)
    {
        LOG4CPLUS_WARN(mLogger, "No CS MSG!!!");
    }

    mCore->init(mPim, mInteractionProtocol->coreProtocol(), mEventFactory);
    mCore->reloadProfilesFromRepository();
    mCore->print();
    mPim->setIpc(mIpcProtocol);
    mPim->setCore(mCore);
    mPim->setEventFactory(mEventFactory);
    mPim->setPimProtocol(mInteractionProtocol->pimProtocol());
    mPim->setAmp(mAmpClient);
    mInteractionProtocol->init(mEventFactory);

    LOG4CPLUS_INFO(mLogger, "initPmp - subcomponents inited");

    if (mSCMsg)
    {
        mSCMsg->init(mEventFactory);
    }

    LOG4CPLUS_INFO(mLogger, "initPmp - SC inited");

    std::string ipcAddr;
    if (mConfig)
    {
        ipcAddr = mConfig->getParam("pmp_ipc_address");
    }

    LOG4CPLUS_INFO(mLogger, "initPmp - subcomponents inited");

    mIpcProtocol->init(mEventFactory->getIpcPimHandler(),
    mEventFactory->getIpcCoreHandler(), ipcAddr.empty() ? NULL : ipcAddr.c_str());
    mAmpClient->init(mEventFactory->getAmpHandler());

    if (!mInteractionProtocol->connect())
    {
        LOG4CPLUS_FATAL(mLogger, "Can't connect interaction protocol");
        killProcess(1);
    }

    if (!mInteractionProtocol->ready())
    {
        LOG4CPLUS_FATAL(mLogger, "Can't send ready");
        killProcess(1);
    }

    mSessionManager->init(mEventFactory,mInteractionProtocol->sessionProtocol(),
            mServiceRepository, mAmpClient);
    mEventHandler->init();
}
Exemple #24
0
void IpcServer::OnConnectionLost(iviLink::Ipc::DirectionID dirID)
{
    LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__);
    LOG4CPLUS_INFO(mLogger, "Lost connection with: " + convertIntegerToString(dirID));
}
Exemple #25
0
	bool TestManager::RunMethod(const Method *method, pair<string, string>* defaultParameters, size_t defaultParametersCount)
	{
		m_isBusy = true;

		Logger logger = Logger::getInstance(TESTER_LOGGER_NAME);
		if (materialMonitor == NULL)
		{
			m_isBusy = false;
			LOG4CPLUS_ERROR(logger, "Material monitor is not set.");
			return false;
		}

		bool ok;

		TestParameters* testParameters = new TestParameters;
		testParameters->Parameters = method->Parameters;
		testParameters->ParametersCount = method->ParametersCount;
		testParameters->DefaultParameters = defaultParameters;
		testParameters->DefaultParametersCount = defaultParametersCount;

		char* pcEnd;
		testParameters->ExpectedResult = (int)strtol(method->ExpectedResult.c_str(), &pcEnd, 16);
		if (*pcEnd != 0)
		{
			m_isBusy = false;
			LOG4CPLUS_ERROR(logger, "Invalid expected results (" << method->ExpectedResult << ").");
			return false;
		}

		tostringstream toss;
		toss << "Running " << method->Name << "(";
		for (size_t i = 0; i < method->ParametersCount; i++)
		{
			toss << method->Parameters[i].first << " = " << method->Parameters[i].second;
			if (i < method->ParametersCount - 1)
			{
				toss << ", ";
			}
		}

		toss << "), expecting " << hex << testParameters->ExpectedResult << "...";
		LOG4CPLUS_INFO(logger, toss.str());

		try
		{
			if (method->Name.compare("AuthenticateCartridge") == 0)
			{
				ok = RunAuthenticateCartridge(testParameters);
			}
			else if (method->Name.compare("UpdateConsumption") == 0)
			{
				ok = RunUpdateConsumption(testParameters);
			}
			else if (method->Name.compare("BurnIDC") == 0)
			{
				ok = RunBurnIDC(testParameters);
			}
			else if (method->Name.compare("RemoveCartridge") == 0)
			{
				ok = RunRemoveCartridge(testParameters);
			}
			else if (method->Name.compare("GetInPlaceStatus") == 0)
			{
				ok = RunGetInPlaceStatus(testParameters);
			}
			else if (method->Name.compare("InPlaceStatusModified") == 0)
			{
				ok = RunInPlaceStatusModified(testParameters);
			}
			else
			{
				ok = false;
			}

			tostringstream endToss;
			endToss << method->Name << " finished, return value: " << ((testParameters->Result == IDTLIB_SUCCESS) ? "" : "0x") << hex << (short)testParameters->Result << ".";
			string str = endToss.str();
			if (ok)
			{
				LOG4CPLUS_INFO(logger, str);
			}
			else
			{
				LOG4CPLUS_ERROR(logger, str);
			}
		}
		catch (exception& e)
		{
			LOG4CPLUS_ERROR(logger, "Exception caught: " << e.what() << ".");
			ok = false;
		}

		delete testParameters;
		m_isBusy = false;
		return ok;
	}
Exemple #26
0
LoggerModule::~LoggerModule()
{
	
 	log4cplus::Logger _logger = log4cplus::Logger::getRoot();
 	LOG4CPLUS_INFO(_logger, "Logger System Stop Finish.");
}
STDMETHODIMP CTongshiDVBSource::TuneDVBS (FrequencySettings fSettings, DigitalDemodulator2Settings dSettings, LnbInfoSettings lSettings, DiseqcSatelliteSettings sSettings){
  CAutoLock lock(&m_Lock);
  LOG4CPLUS_INFO(logger,"TuneDVBS - Start");
  int result = ERROR_SUCCESS;
  try{
    if(m_cardHandle==NULL){
      return S_FALSE;
    }
    if(m_modType!=DVB_S){
      return S_FALSE;
    }
    TSDVB_TUNERPARAM  tuneParam;
    memset( &tuneParam, 0, sizeof(tuneParam) );
    tuneParam.m_nModulationType = DVB_S;
    tuneParam.m_dwFrequency = fSettings.Frequency*fSettings.Multiplier/1000;
    tuneParam.m_dwSymbalRate=dSettings.SymbolRate;
    tuneParam.m_DVB_S.m_dwLNBFreq1 = lSettings.LowOscillator*fSettings.Multiplier/1000;
    tuneParam.m_DVB_S.m_dwLNBFreq2 = lSettings.HighOscillator*fSettings.Multiplier/1000;
    tuneParam.m_DVB_S.m_dwUniversalSwichFreq = lSettings.LnbSwitchFrequency*fSettings.Multiplier/1000;
    tuneParam.m_DVB_S.m_nPolar = fSettings.Polarity==BDA_POLARISATION_LINEAR_H ? POLAR_HORIZONTAL : POLAR_VERTICAL;
    tuneParam.m_DVB_S.m_nTunerType = DVBS_TUNER_TYPE_UNIVERSAL;

    if(fSettings.Frequency*fSettings.Multiplier/1000 > lSettings.LnbSwitchFrequency*fSettings.Multiplier/1000){
      tuneParam.m_DVB_S.m_dwFlags = tuneParam.m_DVB_S.m_dwFlags & TSDVBS_FREQ22KHZ_ON;
    }
    if(sSettings.Enabled!=1){
      tuneParam.m_DVB_S.m_dwFlags = 0;
    }else{
      if(sSettings.ToneBurstEnabled==1){
        tuneParam.m_DVB_S.m_dwFlags = tuneParam.m_DVB_S.m_dwFlags & TSDVBS_TONE_BURSE_ON;
      }
    }
    result =  TSDVB_Tune(m_cardHandle,&tuneParam);
    if(result == ERROR_SUCCESS){
      if(sSettings.Enabled==1){
        BYTE par[4];
        ULONG responseId;
        if(sSettings.Diseq10Selection != BDA_LNB_SOURCE_NOT_SET){
          par[0] = 0xE0; par[1] = 0x10; par[2] = 0x38;
          par[3] = DISEQC_HIGH_NIBLE;
          par[3] |= (fSettings.Frequency*fSettings.Multiplier/1000>=lSettings.LnbSwitchFrequency) ? DISEQC_HIGH_BAND : DISEQC_LOW_BAND;
          par[3] |= (fSettings.Polarity==BDA_POLARISATION_LINEAR_V) ? DISEQC_VERTICAL : DISEQC_HORIZONTAL;
          par[3] |= (sSettings.Diseq10Selection==BDA_LNB_SOURCE_B) ? DISEQC_POSITION_B : ((sSettings.Diseq10Selection==BDA_LNB_SOURCE_D) ? DISEQC_POSITION_B : DISEQC_POSITION_A);
          par[3] |= (sSettings.Diseq10Selection==BDA_LNB_SOURCE_D) ? DISEQC_OPTION_B : ((sSettings.Diseq10Selection==BDA_LNB_SOURCE_C) ? DISEQC_POSITION_B : DISEQC_OPTION_A);
          result = SendDiseqCMessage(DiseqCMessageType_MessageOnly,4,par,&responseId);
          if (result != ERROR_SUCCESS)
          { 
            LOG4CPLUS_DEBUG(logger,"Error while sending DiseqC message - Multi case");
            return S_FALSE;
          }
        }
        if(sSettings.Diseq11Selection != DiseqC11Switch_NOT_SET){
          par[0] = 0xE0; // Framming byte = Command from Master no reply required, first transmission
          par[1] = 0x10; // Address byte = Any LNB switcher or SMATV
          par[2] = 0x39; // Command byte = Write port group 1
          par[3] = DISEQC_HIGH_NIBLE | sSettings.Diseq11Selection; // Data byte = Clear + Switch 1
          result = SendDiseqCMessage(DiseqCMessageType_MessageOnly,4,par,&responseId);
          if (result != ERROR_SUCCESS)
          { 
            LOG4CPLUS_DEBUG(logger,"Error while sending DiseqC message - Multi case");
            return S_FALSE;
          }
        }
      }
    }
  }catch(...){
    return S_FALSE;
  }
  LOG4CPLUS_INFO(logger,"TuneDVBS - Finish");
  if(result == ERROR_SUCCESS){
    return S_OK;
  }
  return S_FALSE;
}
 void ServerListAsker::Stop()
 {
     LOG4CPLUS_TRACE_METHOD(Loggers::RemoteCache(), "ServerListAsker::Stop()");
     LOG4CPLUS_INFO(Loggers::RemoteCache(), "ServerListAsker Stopped.");
 }