Beispiel #1
0
bool CSMS::SetComm()
{
	DCB dcb;
	dcb.ByteSize = 8;
    dcb.StopBits = ONESTOPBIT;
    dcb.Parity = NOPARITY;
	dcb.BaudRate = CBR_9600;
	
	return SetComm(dcb);
	
}
Beispiel #2
0
void DistMap::StoreOwners
( Int numSources, vector<Int>& localInds, mpi::Comm comm )
{
    DEBUG_ONLY(CSE cse("DistMap::StoreOwners"))
    SetComm( comm );
    Resize( numSources );
    const int commSize = mpi::Size( comm );

    // Exchange via AllToAlls
    vector<int> sendSizes( commSize, 0 );
    const Int numLocalInds = localInds.size();
    for( Int s=0; s<numLocalInds; ++s )
        ++sendSizes[ RowOwner(localInds[s]) ]; 
    vector<int> recvSizes( commSize );
    mpi::AllToAll( sendSizes.data(), 1, recvSizes.data(), 1, comm );
    vector<int> sendOffs, recvOffs;
    const int numSends = Scan( sendSizes, sendOffs );
    const int numRecvs = Scan( recvSizes, recvOffs );
    DEBUG_ONLY(
        if( numRecvs != NumLocalSources() )
            LogicError("Incorrect number of recv indices");
    )
Beispiel #3
0
int main(int argc, char *argv[])
{

	QApplication::addLibraryPath("./plugins");
	QTextCodec::setCodecForTr(   QTextCodec::codecForName("GB2312")   );

	QApplication a(argc, argv);

	StartExceptionReport();
        //添加QT的中文编码库跟ODBC库等
        QApplication::addLibraryPath("./plugins");

	QTextCodec::setCodecForTr(   QTextCodec::codecForName("GB2312")   );

	g_MainThread = QThread::currentThread();

	system("md D:\\开关机日志");
	mkPlayListPath();
	mkMediaPath();
	mkVolumeListPath();

	if(!SetupSocketLib())
	{
		qDebug()<<"Setup socket lib error";
		return 1;
	}

	MainWindow* mainWindow = MainWindow::instance();
	mainWindow->show();
	mainWindow->splitWindow(g_SplitConfigFileName);

//	int no = 1;
//	ValuePacket packet;

//	packet.insert(LocalVideoPlayer::VideoFilePathName, "wildlife.wmv");
//	mainWindow->setSubWindowContent(no, LocalVideo, packet);

//	no = 2;
//	packet.clear();
//	mainWindow->setSubWindowContent(no, LocalTime, packet);

//	no = 3;
//	packet.clear();
//	packet.insert(LocalVideoPlayer::VideoFilePathName, "q.flv");
////	mainWindow->setSubWindowContent(no, LocalVideo, packet);

//	no = 4;
//	packet.clear();
//	packet.insert(TextPlayer::TextFilePathName, "text.txt");
//	mainWindow->setSubWindowContent(no, LocalText, packet);

	try{
		QDate currentDate = QDate::currentDate();
		std::wstring captureFileName = currentDate.toString("yyyy_MM_dd.mkv").toStdWString();
		CaptureAndSendAd::instance(); //让其初始化,防止出现问题
		boost::shared_ptr<CaptureToFileAd> captureToFile = CaptureToFileAd::instance();
		if(!captureToFile->start(captureFileName))
		{
			qDebug()<<"Start capture to file error";
		}
	}catch(...)
	{
		qDebug()<<"Start capture error";
	}

	try
	{
		g_RealTimeVideoReceiveAndPlay = new ReceiveAndPlayAd(true, true);
		g_RealTimeVideoReceiveAndPlay->setPlayMode(1);

		// 		g_RealTimeAudioReceiveAndPlay = new ReceiveAndPlayAd;
		// 		g_RealTimeAudioReceiveAndPlay->setPlayMode(1);

		g_RealTimeAudioReceiveAndPlay = g_RealTimeVideoReceiveAndPlay;
	}catch(...)
	{
		qDebug()<<"Create receive and play error";
	}

	//读取云台串口,并配置云台参数
	int comNo = ReadCameraCom(g_xmlFileName);
	if(comNo == -1)
		qDebug()<<"Camera com configure error";
	else
	{
		if(!InitComInfo(2,PROTOCOL_P,40,comNo,BSPEED_9600,NONE,DATA_8,STOP_ONE)) //云台初始化
			qDebug()<<"Fail to open Camera Com, ComNo is COM"<<comNo+1;
		else
			qDebug()<<"Camera ComNo is"<<comNo + 1;
	}

	//读取单片机串口
	QString singlechipCom = ReadSingleChipCom(g_xmlFileName);
	if(singlechipCom == NULL)
		qDebug()<<"Singlechip com configure error";
	else
	{
		qDebug()<<"Singlechip ComNo is:"<<singlechipCom;
		SetComm(singlechipCom.toLocal8Bit().data());
	}

	g_PlayScheduler = new Scheduler;
	g_VolumeScheduler = new Scheduler;

	Reloader reloader;
	reloader.reloadPlayList();
	reloader.reloadVolumeList();

	CheckMediaFilesReferenced();

	FileServerThread* fileServerThread = FileServerThread::instance();
	fileServerThread->start();
	fileServerThread->waitForStart(); //等待文件服务线程初始化完毕

	RealTimeServerThread* realTimeServerThread = RealTimeServerThread::instance();
	realTimeServerThread->start();
	realTimeServerThread->waitForStart(); //等到实时播放服务线程初始化完毕


	//TimingSwitch::createTimingSwitch()->start();
	ConnectServer::createConnectServer()->start();
	//TimingSwitch::createTimingSwitch()->terminate();

    return a.exec();
}
Beispiel #4
0
DistMap::DistMap( Int numSources, mpi::Comm comm )
: numSources_(numSources), comm_(mpi::COMM_WORLD)
{ SetComm( comm ); }
Beispiel #5
0
DistMap::DistMap( mpi::Comm comm )
: numSources_(0), comm_(mpi::COMM_WORLD)
{ SetComm( comm ); }
DistMultiVec<T>::DistMultiVec( Int height, Int width, mpi::Comm comm )
: height_(height), width_(width), comm_(mpi::COMM_WORLD)
{ 
    SetComm( comm );
}
DistMultiVec<T>::DistMultiVec( mpi::Comm comm )
: height_(0), width_(0), comm_(mpi::COMM_WORLD), 
  blocksize_(0), firstLocalRow_(0)
{ 
    SetComm( comm );
}