Example #1
0
void CH3CDlg::OnCbnSelchangeCombo1()
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData();
	GetMac(m_deviceNum);

	SaveDevice();

	UpdateData(FALSE);
}
Example #2
0
KSGDeviceNode* KSGDeviceManager::NewDevice(
	int did,
	KSGDeviceNode* parent,
	const std::string& phyid,
	KSGDevice* devtype)
{
	KSGDeviceNode* ret = FindDevice(did);
	if(ret)
		throw DeviceIdAlreadyExists();
	ret = _pool.construct(did,parent,devtype);
	ret->SetPhyId(phyid);
	SaveDevice(ret);
	return ret;
}
Example #3
0
KSGDeviceNode* KSGDeviceManager::NewDevice(
	int did,
	int parentId,
	const std::string& phyid,
	NormalDeviceType devtype)
{
	KSGDeviceNode* ret = FindDevice(did);
	if(ret)
		throw DeviceIdAlreadyExists();
	KSGDevice* dev = FindDeviceType(devtype);
	ret = _pool.construct<int,int,KSGDevice*>(did,parentId,dev);
	ret->SetPhyId(phyid);
	SaveDevice(ret);
	return ret;
}
Example #4
0
void CH3CDlg::SaveConfig()
{
	UpdateData();
	
	// 读取信息
	//std::ofstream out("h3c.conf");
	//
	//out << m_userName << std::endl;
	//out << m_passWord << std::endl;
	//out << m_deviceNum << std::endl;

	//out.close();

	//IniFileProcessor processor(iniFilePath);

	//IniFileProcessor::IniMap map;
	//map["username"] = IniValue(string(m_userName.operator LPCSTR()));
	//map["password"] = IniValue(string(m_passWord.operator LPCSTR()));

	//processor.SetMap(map);
	//processor.Save();

	//string oldPresettingName = profileManager->GetPresettingName();
	SaveDevice();

	Profile profile;
	profile.username = string(cstrtostr(m_userName));
	profile.password = string(cstrtostr(m_passWord));

	if(profile.username.compare("") != 0)
	{
		profileManager->AddOrModify(profile);
		// presetting 的 username 改变了
		profileManager->SetPresetting(profile.username);
	}

	profileManager->Save();

	//m_userName.SetString((map["username"]).GetStrValue().c_str());
	//m_passWord.SetString((map["password"]).GetStrValue().c_str());
	//m_deviceNum = atoi((map["device"]).GetStrValue().c_str());
}
Example #5
0
int KSGDeviceManager::SetupLoopDevice()
{
	int ret = -1;
	KSGDevice* dev = NULL;//= FindDeviceType(KSG_LOOP_DEV_TYPE);
	if(!dev)
	{
		// 从默认Loop设备中查找
		try
		{
			KSG_GET_DEVICE_OBJECT(KSG_LOOP_DEV,KSG_LOOP_DEV_TYPE,dev);
			if(!dev)
				return -1;
		}
		catch (KSGException& )
		{
			// 无法加载 loop 设备
			return -1;
		}
	}
	KSGDeviceNode* node = new KSGLoopDeviceNode(dev);
	SaveDevice(node);
	return 0;
}