int main(int argc, const char **argv) {
	OptionsParser parser;
	if (parser.ParseOptions(argc, argv) < 0 || parser.m_Help) {
		parser.Usage(argv[0]);
		return -1;
	}

	Sid::SkypePCMInterfaceServer *pcmif_server = new Sid::SkypePCMInterfaceServer();
	Sid::SkypePCMCallbackInterfaceClient *pcmif_cb_client = new Sid::SkypePCMCallbackInterfaceClient();

	SkypePCMInterface* pcmif = SkypePCMInterfaceGet(pcmif_cb_client);
	pcmif_server->set_if(pcmif);


	Sid::String fromskypekitkey;
	Sid::String toskypekitkey;

	fromskypekitkey.Format( "%spcm_from_skypekit_key", parser.m_IpcPrefix);
	toskypekitkey.Format( "%spcm_to_skypekit_key", parser.m_IpcPrefix);

	pcmif_server->Connect(fromskypekitkey.data(), 0);
	pcmif_cb_client->Connect(toskypekitkey.data(), 500);

	if(parser.m_OutFile)
	{
	  Sid::String cmd;
	  Sid::String response;
	  cmd.Format("OUT:%s",parser.m_OutFile);
	  pcmif->CustomCommand(cmd, response);
	}
	if(parser.m_InFile)
	{
	  Sid::String cmd;
	  Sid::String response;
	  cmd.Format("IN:%s",parser.m_InFile);
	  pcmif->CustomCommand(cmd,response);
	}
	if(parser.m_Loop)
	{
	  Sid::String cmd = "LOOP:1";
	  Sid::String response;
	  pcmif->CustomCommand("LOOP:1", response);
	}
	
	Sid::Protocol::Status status;
	do {
		status =pcmif_server->ProcessCommands();
	} while (status == Sid::Protocol::OK);

	SkypePCMInterfaceRelease(pcmif);
	pcmif_server->Disconnect();
	pcmif_cb_client->Disconnect();

	delete pcmif_server;
	delete pcmif_cb_client;

	printf("PCMServerTransport disconnected, exiting from pcmtesthost\n");
}
示例#2
0
int main(int argc, const char * argv[])
{
	OptionsParser parser;
	if (parser.ParseOptions(argc, argv) < 0 || parser.m_Help) {
		parser.Usage(argv[0]);
		return -1;
	}

	if (parser.m_List) {
		CPPUNIT_NS::Test *test = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
		for (int i = 0; i < test->getChildTestCount(); i++) {
		  printf("test %s\n", test->getChildTestAt(i)->getName().c_str());
			for (int j = 0; j < test->getChildTestAt(i)->getChildTestCount(); j++) {
			  printf("test %s\n", test->getChildTestAt(i)->getChildTestAt(j)->getName().c_str());
			}
		}
		return 0;
	}

	CPPUNIT_NS::TestResult controller;

	// Add a listener that colllects test result
	CPPUNIT_NS::TestResultCollector result;
	controller.addListener( &result );

	// Add a listener that print dots as test run.
	CPPUNIT_NS::BriefTestProgressListener progress;
	controller.addListener( &progress );

	CPPUNIT_NS::TestRunner runner;
	// Add the single test to the test runner
	if (parser.m_RunSingle) {
		runner.addTest(
				CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest()->findTest(parser.m_TestName));
	// Add the top suite to the test runner
	} else {
		runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
	}

	runner.run( controller );

	// Print test in a compiler compatible format.
	CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
	outputter.write();

	return result.wasSuccessful() ? 0 : 1;
}