コード例 #1
0
void FreeFormPoll::ConfigureRequest(APDU& arAPDU)
{
	LOG_BLOCK(LEV_DEBUG, "FreeFormPoll::ConfigureRequest");

	if (this->GetClassMask() == PC_INVALID) {
		throw InvalidStateException(LOCATION, "Class mask has not been set");
	}

	arAPDU.Set(FC_READ);
	std::lock_guard<std::mutex> guard{ffInputPoints_mutex_};

	if ((this->GetClassMask() & PC_CLASS_0) && ffInputPoints.size() > 0) {

		for (std::pair<apl::DataTypes, std::vector<uint32_t>> element : ffInputPoints)
		{
			if (element.second.size() <= 0)
				continue; //should not come here
			if (element.first == apl::DataTypes::DT_ANALOG) {
				for (int ind=0; ind<element.second.size(); ++ind) {
					size_t index = element.second.at(ind);
					ObjectWriteIterator i = arAPDU.WriteContiguous(Group30Var1::Inst(), index, index, QC_1B_START_STOP );
				}
			}
			if (element.first == apl::DataTypes::DT_BINARY) {
				for (int ind=0; ind<element.second.size(); ++ind) {
					size_t index = element.second.at(ind);
					ObjectWriteIterator i = arAPDU.WriteContiguous(Group1Var2::Inst(), index, index, QC_1B_START_STOP );
				}
			}
			if (element.first == apl::DataTypes::DT_COUNTER) {
				for (int ind=0; ind<element.second.size(); ++ind) {
					size_t index = element.second.at(ind);
					ObjectWriteIterator i = arAPDU.WriteContiguous(Group20Var1::Inst(), index, index, QC_1B_START_STOP );
				}
			}
			if (element.first == apl::DataTypes::DT_CONTROL_STATUS) {
				for (int ind=0; ind<element.second.size(); ++ind) {
					size_t index = element.second.at(ind);
					ObjectWriteIterator i = arAPDU.WriteContiguous(Group10Var2::Inst(), index, index, QC_1B_START_STOP );
				}
			}
			if (element.first == apl::DataTypes::DT_SETPOINT_STATUS) {
				for (int ind=0; ind<element.second.size(); ++ind) {
					size_t index = element.second.at(ind);
					ObjectWriteIterator i = arAPDU.WriteContiguous(Group40Var1::Inst(), index, index, QC_1B_START_STOP );
				}
			}

		}
	}
}
コード例 #2
0
ファイル: StartupTasks.cpp プロジェクト: diverger/dnp3
void ClearRestartIIN::ConfigureRequest(APDU& arAPDU)
{
	arAPDU.Set(FC_WRITE);
	Group80Var1* pObj = Group80Var1::Inst(); // Internal indications object
	ObjectWriteIterator i = arAPDU.WriteContiguous(pObj, 7, 7); // index 7 == device restart
	pObj->Write(*i, 7, 7, false);
}
コード例 #3
0
ファイル: StartupTasks.cpp プロジェクト: diverger/dnp3
void TimeSync::ConfigureRequest(APDU& arAPDU)
{
	if(mDelay < 0) {
		arAPDU.Set(FC_DELAY_MEASURE);
		mStart = mpTimeSrc->GetUTC();
	}
	else {
		arAPDU.Set(FC_WRITE);
		ObjectWriteIterator owi = arAPDU.WriteContiguous(Group50Var1::Inst(), 0, 0, QC_1B_CNT);
		Group50Var1::Inst()->mTime.Set(*owi, mpTimeSrc->GetTimeStampUTC() + mDelay);
	}
}