⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appfactory.cpp

📁 It s a tool designed to extract as much information as possible from Bluetooth devices without the r
💻 CPP
字号:
/* -*- c++ -*- ---------------------------------------------------------------   Copyright (C) 2005, SWECO, All Rights Reserved.   AppFactory implentation.   Author: Zsolt Molnar (Zsolt.Molnar@ieee.org)   ---------------------------------------------------------------------------*/#include "CmdBasedDeviceRecovery.hh"#include "DeviceManager.hh"#include "HardcodedDeviceTypeExtractor.hh"#include "OBEXSender.hh"#include "OBEXCommInitiator.hh"#include "NetHandler.hh"#include "DeviceManager.hh"#include "CmdBasedRFCommHandler.hh"#include "AppFactory.hh"#ifdef __TEST__#include "DummyDeviceManager.hh"#include "DummyNetHandler.hh"#include "DummyCommInitiator.hh"#include "DummyRFCommHandler.hh"#include "DummyOBEXSender.hh"#endif // #ifdef __TEST__namespace { 	const char rcs_id[] = "$Id$"; };bool AppFactory::_isInited = false;voidAppFactory::setup(){	if (!_isInited) {		// Trigger static initialization		getCommInitiator();		getRFCommHandler();		getNetHandler();		_isInited = true;	}}IDeviceRecovery* AppFactory::newDeviceRecoveryC(IDeviceManager& aDeviceManager){#ifndef __TEST__	return new CmdBasedDeviceRecovery(aDeviceManager);#else // #ifndef __TEST__	return new DeviceRecoveryLogic(aDeviceManager);#endif // #ifndef __TEST__}IDeviceManager* AppFactory::newDeviceManagerC(){#ifndef __TEST__	return new DeviceManager;#else // #ifndef __TEST__	return new DummyDeviceManager;#endif // #ifndef __TEST__}IDeviceTypeExtractor* AppFactory::newDeviceTypeExtractorC(){	return new HardcodedDeviceTypeExtractor;}ICommInitiator&AppFactory::getCommInitiator(){#ifndef __TEST__    static OBEXCommInitiator obc;	return obc;#else // #ifndef __TEST__	return *(new DummyCommInitiator((DeviceState)testHint_CommInitiator));#endif // #ifndef __TEST__}INetHandler&AppFactory::getNetHandler(){#ifndef __TEST__    static NetHandler nh;	return nh;#else // #ifndef __TEST__	// Yes, memory leak... but only for testing.	if (testHint_NetHandler == TEST_DNH_FALSE) {		return *(new DummyNetHandler(false));	} else {		return *(new DummyNetHandler(true));	}#endif // #ifndef __TEST__}IRFCommHandler&AppFactory::getRFCommHandler(){    static CmdBasedRFCommHandler rfcomh;	return rfcomh;}IOBEXSender* AppFactory::newOBEXSenderC(){	return new OBEXSender();}voidAppFactory::cleanup(){    /* EMPTY */}#ifdef __TEST__int AppFactory::testHint_CommInitiator;int AppFactory::testHint_NetHandler;#endif // #ifdef __TEST__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -