예제 #1
0
template<> void exchangeTable<StorageDeviceInformationAll>(CConfigTable &table, StorageDeviceInformationAll  &config, int state)
{
	CKeyExchange exchanger;

	exchanger.setState(state);
	if (state == CKeyExchange::ES_LOADING)
	{
		config.iDiskNumber = table.size();
	}

	if (config.iDiskNumber)
	{
		for (int i = 0; i < config.iDiskNumber; i++)
		{
			exchangeTable(table[i], config.vStorageDeviceInfoAll[i], state);
		}
	}
	else
	{
		// 当没有硬盘时,table表为空,WEB端解析时会挂掉,考虑到兼容性
		// 这里使用一个容量为0的硬盘信息表示没有安装磁盘
		memset(&config.vStorageDeviceInfoAll[0], 0, sizeof(StorageDeviceInformation));
		exchangeTable(table[0u], config.vStorageDeviceInfoAll[0u], state);
	}
}
예제 #2
0
//  云台状态
template<> void exchangeTable<PtzState>(CConfigTable& table, PtzState& config, int state)
{
	CKeyExchange exchanger;

	exchanger.setState(state);
	exchangeTable(table[Json::StaticString("TourState")],    config.tourState, state);
	exchangeTable(table[Json::StaticString("PatternState")], config.patternState, state);
	exchangeTable(table[Json::StaticString("ScanState")],    config.scanState, state);
	exchangeTable(table[Json::StaticString("PanonState")],   config.panonState, state);
}
예제 #3
0
template<> void exchangeTableV2<AlarmConfigAll>(CConfigTable &table, AlarmConfigAll &config, int state, int nSize)
{
	for (int i = 0; i < nSize; i++)
	{
		exchangeTable(table[i], config.vAlarmConfigAll[i], state);
	}
}
예제 #4
0
template<> void exchangeTableV2<LossShowStrConfigALL>(CConfigTable &table, LossShowStrConfigALL &config, int state, int nSize)
{
	for (int i = 0; i < nSize; i++)
	{
		exchangeTable(table[i], config.vLossShowStrAll[i], state);
	}
}
예제 #5
0
template<> void exchangeTableV2<GenericEventConfigAll>(CConfigTable &table, GenericEventConfigAll &config, int state, int nSize)
{
	for (int i = 0; i < nSize; i++)
	{
		exchangeTable(table[i], config.vGenericEventConfig[i], state);
	}
}
예제 #6
0
template<> void exchangeTable<CommConfigAll>(CConfigTable& table, CommConfigAll& config, int state)
{
	for (int i = 0; i < COM_TYPES; i++)
	{
		exchangeTable(table[i], config.vCommConfig[i], state);
	}
}
예제 #7
0
template<> void exchangeTable<AlarmOutConfigAll>(CConfigTable &table, AlarmOutConfigAll &config, int state)
{
	for (int i = 0; i < N_ALM_OUT; i++)
	{
		exchangeTable(table[i], config.vAlarmOutConfigAll[i], state);
	}
}
예제 #8
0
template<> void exchangeTableV2<BlindDetectConfigAll>(CConfigTable &table, BlindDetectConfigAll &config, int state, int nSize)
{
	for (int i = 0; i < nSize; i++)
	{
		exchangeTable(table[i], config.vBlindDetectAll[i], state);
	}
}
예제 #9
0
template<> void exchangeTable<NetWifiDeviceAll>(CConfigTable& table, NetWifiDeviceAll& config, int state)
{
	CKeyExchange exchanger;

	exchanger.setState(state);
	exchanger.exchange(table, "Numbers", config.nDevNumber);
	for (int i = 0; (i < config.nDevNumber) && (i < MAX_AP_NUMBER); i++)
	{
		exchangeTable(table["WifiAP"][i], config.vNetWifiDeviceAll[i], state);
	}
}
예제 #10
0
template<> void exchangeTable<CarStatusExchangeAll>(CConfigTable& table, CarStatusExchangeAll& config, int state)
{
	for (int i = 0; i < CAR_STATUS_NR; i++)
	{
		if (table[i].type() == Json::nullValue && state == CKeyExchange::ES_LOADING)
		{
			continue;
		}
		exchangeTable(table[i], config.exchangeAll[i], state);
	}
}
예제 #11
0
template<> void exchangeTable<StorageDeviceInformation>(CConfigTable &table, StorageDeviceInformation &config, int state)
{
	CKeyExchange exchanger;

	exchanger.setState(state);
	exchanger.exchange(table, "PlysicalNo", config.iPhysicalNo);
	exchanger.exchange(table, "PartNumber", config.iPartNumber);
	for (int i = 0; i < MAX_DRIVER_PER_DISK; i++)
	{
		exchangeTable(table["Partition"][i], config.diPartitions[i], state);
	}
}
예제 #12
0
template<> void exchangeTableV2<AnalyzeConfigAll>(CConfigTable &table, AnalyzeConfigAll &configAll, int state, int nSize)
{
	for(int i = 0; i < nSize; i++)
	{
		/*const CConfigTable &tableValue = table[i];

		if (tableValue.type() == Json::nullValue && state == CKeyExchange::ES_LOADING)
		{
			continue;
		}*/
		exchangeTable(table[i], configAll.vAnalyzeAll[i], state);
	}
}
예제 #13
0
template<> void exchangeTableV2<RS485ConfigAll>(CConfigTable& table, RS485ConfigAll& config, int state, int nSize)
{
	for (int i = 0; i < nSize; i++)
	{
		const CConfigTable &tableValue = table[i];

		if (tableValue.type() == Json::nullValue && state == CKeyExchange::ES_LOADING)
		{
			continue;
		}
		exchangeTable(table[i], config.rs485All[i], state);
	}
}
예제 #14
0
template<> void exchangeTable<PTZConfigAll>(CConfigTable& table, PTZConfigAll& config, int state)
{
	for (int i = 0; i < N_SYS_CH; i++)
	{
		const CConfigTable &tableValue = table[i];

		if (tableValue.type() == Json::nullValue && state == CKeyExchange::ES_LOADING)
		{
			continue;
		}
		exchangeTable(table[i], config.ptzAll[i], state);
	}
}
예제 #15
0
//  恢复云台状态
template<> void exchangeTable<ResumePtzState>(CConfigTable& table, ResumePtzState& config, int state)
{
	CKeyExchange exchanger;

	exchanger.setState(state);
	exchanger.exchange(table, "Enable", config.bEnable);
	for(int i = 0; i < N_SYS_CH; i++)
	{
//		trace("i = %d\n", i);
		if (table[Json::StaticString("PtzState")][i].type() == Json::nullValue && state == CKeyExchange::ES_LOADING)
		{
			continue;
		}
		exchangeTable(table[Json::StaticString("PtzState")][i], config.ptzStateAll[i], state);
	}
}
예제 #16
0
void Bank::transferFrom(TransferInfo& info) {
    auto account = accounts[info.getFrom().second];
    account->money -= info.getMoney();
    account->_history
             .push_back(HistoryEntryTransfer(info.getMoney(),
                                             info.getCurrency(),
                                             OperationType::TRANSFER,
                                             info.getTitle(), info.getFrom(),
                                             info.getTo()));
    double charge = account->info.getTransferCharge();

    if (charge != 0) {
        account->money -= charge / exchangeTable()
                                   .getBuyRate(account->currency);
        account->_history.push_back(HistoryEntry(charge, Currency::ENC,
                                                 OperationType::CHARGE));
    }
}
예제 #17
0
template<> void exchangeTable<WorkState>(CConfigTable &table, WorkState &config, int state)
{
	CKeyExchange exchanger;

	exchanger.setState(state);
	for (int i = 0; i < N_SYS_CH; i++)
	{
		exchangeTable(table["ChannelState"][i], config.vChnState[i], state);
	}

	CConfigTable& tb = table["AlarmState"];
	exchanger.exchange(tb, "VideoMotion", config.vAlarmState.iVideoMotion);
	exchanger.exchange(tb, "VideoBlind", config.vAlarmState.iVideoBlind);
	exchanger.exchange(tb, "VideoLoss", config.vAlarmState.iVideoLoss);
	exchanger.exchange(tb, "AlarmIn", config.vAlarmState.iAlarmIn);
	exchanger.exchange(tb, "AlarmOut", config.vAlarmState.iAlarmOut);
	//ExChgDebug("iVideoMotion: %d, iVideoBlind: %d, iVideoLoss: %d, iAlarmIn: %d, iAlarmOut: %d\n",
	//	config.vAlarmState.iVideoMotion, config.vAlarmState.iVideoBlind, config.vAlarmState.iVideoLoss,
	//	config.vAlarmState.iAlarmIn, config.vAlarmState.iAlarmOut);
}
예제 #18
0
void Bank::transferTo(TransferInfo& info) {
    auto account = accounts[info.getTo().second];
    if (account->currency == info.getCurrency()) {
        account->money += info.getMoney();
        account->_history
                 .push_back(HistoryEntryTransfer(info.getMoney(),
                                                 info.getCurrency(),
                                                 OperationType::TRANSFER,
                                                 info.getTitle(),
                                                 info.getFrom(), info.getTo()));
    } else {
        double toAdd = info.getMoneyENC() / exchangeTable()
                                            .getSellRate(account->currency);
        account->money += toAdd;
        account->_history
                 .push_back(HistoryEntryTransfer(toAdd, Currency::ENC,
                                                 OperationType::TRANSFER,
                                                 info.getTitle(),
                                                 info.getFrom(), info.getTo()));
    }
}