int Switch_Control::ResetAllSwitch()
{
			//遍历切流器
		pthread_mutex_lock(&ManagerFactory::instance()->m_mutexServerList);
		MapSwitchSeverInfo::iterator iterLook = ManagerFactory::instance()->m_mapSwitchServerInfo.begin();
		while(iterLook != ManagerFactory::instance()->m_mapSwitchServerInfo.end())
		{
			//
			SwitchSeverInfo *pTmpSeverInfo = iterLook->second;
			if(pTmpSeverInfo && pTmpSeverInfo->iRunStatus == 0)  //在线的切流器
			{
				int iRet = SendResetMessage(pTmpSeverInfo->strServerIPAddr,pTmpSeverInfo->iListenPort);
				if(iRet == 0)
				{
					LOG_INFO_FORMAT("INFO  - [SWM]:切流器[%s] 重置流成功 \n",pTmpSeverInfo->strServerIPAddr);
					pTmpSeverInfo->iStreamStatus = 0;
				}
				else
				{
					
					LOG_INFO_FORMAT("INFO  - [SWM]:切流器[%s] 重置流失败 \n",pTmpSeverInfo->strServerIPAddr);
					pTmpSeverInfo->iStreamStatus = 1;  //流状态异常
				}
			}
			else
				printf("---切流器 不在线 %s \n",pTmpSeverInfo->strServerIPAddr);
			
			++iterLook;
		}

		pthread_mutex_unlock(&ManagerFactory::instance()->m_mutexServerList);
	return 0;
}
Example #2
0
// *****************************************************
// InitCommros()
//
//  This function is used to initalize commros and the
//  neccessary communication hardware.
// *****************************************************
void InitCommros()
{
	//Initalize commros and reset all internal variables
	InitCore(&commros);

	//Map serial port functions to commros
	SetByteProtocolCallBacks(&commros,&SCIDataAvailable,&SCITransmitByte,&SCIReceiveByte);

	//Initialize the serial port so it is ready for receiving and transmitting data
	SetupSerialPort();

	//Inform anyone listening on the serial port that the we are awake
	SendResetMessage(&commros,0);
}