/src/opendnp3/cpp/lib/src/outstation/CommandResponseHandler.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2013-2022 Step Function I/O, LLC |
3 | | * |
4 | | * Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O |
5 | | * LLC (https://stepfunc.io) under one or more contributor license agreements. |
6 | | * See the NOTICE file distributed with this work for additional information |
7 | | * regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license |
8 | | * this file to you under the Apache License, Version 2.0 (the "License"); you |
9 | | * may not use this file except in compliance with the License. You may obtain |
10 | | * a copy of the License at: |
11 | | * |
12 | | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | | * |
14 | | * Unless required by applicable law or agreed to in writing, software |
15 | | * distributed under the License is distributed on an "AS IS" BASIS, |
16 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 | | * See the License for the specific language governing permissions and |
18 | | * limitations under the License. |
19 | | */ |
20 | | #ifndef OPENDNP3_COMMANDRESPONSEHANDLER_H |
21 | | #define OPENDNP3_COMMANDRESPONSEHANDLER_H |
22 | | |
23 | | #include "app/APDUResponse.h" |
24 | | #include "app/parsing/IAPDUHandler.h" |
25 | | #include "outstation/ICommandAction.h" |
26 | | |
27 | | #include "opendnp3/logging/Logger.h" |
28 | | |
29 | | namespace opendnp3 |
30 | | { |
31 | | |
32 | | class CommandResponseHandler : public IAPDUHandler |
33 | | { |
34 | | public: |
35 | | CommandResponseHandler(uint32_t maxCommands_, ICommandAction* pCommandAction_, HeaderWriter* pWriter_); |
36 | | |
37 | | bool AllCommandsSuccessful() const |
38 | 291 | { |
39 | 291 | return numRequests == numSuccess; |
40 | 291 | } |
41 | | |
42 | | virtual bool IsAllowed(uint32_t headerCount, GroupVariation gv, QualifierCode qc) override final; |
43 | | |
44 | | private: |
45 | | virtual IINField ProcessHeader(const PrefixHeader& header, |
46 | | const ICollection<Indexed<ControlRelayOutputBlock>>& meas) override final; |
47 | | virtual IINField ProcessHeader(const PrefixHeader& header, |
48 | | const ICollection<Indexed<AnalogOutputInt16>>& meas) override final; |
49 | | virtual IINField ProcessHeader(const PrefixHeader& header, |
50 | | const ICollection<Indexed<AnalogOutputInt32>>& meas) override final; |
51 | | virtual IINField ProcessHeader(const PrefixHeader& header, |
52 | | const ICollection<Indexed<AnalogOutputFloat32>>& meas) override final; |
53 | | virtual IINField ProcessHeader(const PrefixHeader& header, |
54 | | const ICollection<Indexed<AnalogOutputDouble64>>& meas) override final; |
55 | | |
56 | | IINField ProcessIndexPrefixTwoByte(const HeaderRecord& record, |
57 | | const ICollection<Indexed<ControlRelayOutputBlock>>& meas); |
58 | | IINField ProcessIndexPrefixTwoByte(const HeaderRecord& record, const ICollection<Indexed<AnalogOutputInt16>>& meas); |
59 | | IINField ProcessIndexPrefixTwoByte(const HeaderRecord& record, const ICollection<Indexed<AnalogOutputInt32>>& meas); |
60 | | IINField ProcessIndexPrefixTwoByte(const HeaderRecord& record, |
61 | | const ICollection<Indexed<AnalogOutputFloat32>>& meas); |
62 | | IINField ProcessIndexPrefixTwoByte(const HeaderRecord& record, |
63 | | const ICollection<Indexed<AnalogOutputDouble64>>& meas); |
64 | | |
65 | | IINField ProcessIndexPrefixOneByte(const HeaderRecord& record, |
66 | | const ICollection<Indexed<ControlRelayOutputBlock>>& meas); |
67 | | IINField ProcessIndexPrefixOneByte(const HeaderRecord& record, const ICollection<Indexed<AnalogOutputInt16>>& meas); |
68 | | IINField ProcessIndexPrefixOneByte(const HeaderRecord& record, const ICollection<Indexed<AnalogOutputInt32>>& meas); |
69 | | IINField ProcessIndexPrefixOneByte(const HeaderRecord& record, |
70 | | const ICollection<Indexed<AnalogOutputFloat32>>& meas); |
71 | | IINField ProcessIndexPrefixOneByte(const HeaderRecord& record, |
72 | | const ICollection<Indexed<AnalogOutputDouble64>>& meas); |
73 | | |
74 | | ICommandAction* pCommandAction; |
75 | | uint32_t numRequests; |
76 | | uint32_t numSuccess; |
77 | | const uint32_t maxCommands; |
78 | | HeaderWriter* pWriter; |
79 | | |
80 | | template<class T> IINField ProcessAny(const HeaderRecord& record, const ICollection<Indexed<T>>& meas); |
81 | | |
82 | | template<class Target, class IndexType> |
83 | | IINField RespondToHeader(QualifierCode qualifier, |
84 | | const DNP3Serializer<Target>& serializer, |
85 | | const ICollection<Indexed<Target>>& values); |
86 | | |
87 | | template<class Target, class IndexType> |
88 | | IINField RespondToHeaderWithIterator(QualifierCode qualifier, |
89 | | const DNP3Serializer<Target>& serializer, |
90 | | const ICollection<Indexed<Target>>& values, |
91 | | PrefixedWriteIterator<IndexType, Target>* pIterator = nullptr); |
92 | | |
93 | | template<class Target> CommandStatus ProcessCommand(const Target& command, uint16_t index); |
94 | | }; |
95 | | |
96 | | template<class T> |
97 | | IINField CommandResponseHandler::ProcessAny(const HeaderRecord& record, const ICollection<Indexed<T>>& meas) |
98 | 9.50k | { |
99 | 9.50k | if (record.GetQualifierCode() == QualifierCode::UINT8_CNT_UINT8_INDEX) |
100 | 5.81k | { |
101 | 5.81k | return ProcessIndexPrefixOneByte(record, meas); |
102 | 5.81k | } |
103 | 3.69k | else |
104 | 3.69k | { |
105 | 3.69k | return ProcessIndexPrefixTwoByte(record, meas); |
106 | 3.69k | } |
107 | 9.50k | } opendnp3::IINField opendnp3::CommandResponseHandler::ProcessAny<opendnp3::ControlRelayOutputBlock>(opendnp3::HeaderRecord const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> > const&) Line | Count | Source | 98 | 1.57k | { | 99 | 1.57k | if (record.GetQualifierCode() == QualifierCode::UINT8_CNT_UINT8_INDEX) | 100 | 787 | { | 101 | 787 | return ProcessIndexPrefixOneByte(record, meas); | 102 | 787 | } | 103 | 785 | else | 104 | 785 | { | 105 | 785 | return ProcessIndexPrefixTwoByte(record, meas); | 106 | 785 | } | 107 | 1.57k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::ProcessAny<opendnp3::AnalogOutputInt16>(opendnp3::HeaderRecord const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt16> > const&) Line | Count | Source | 98 | 2.60k | { | 99 | 2.60k | if (record.GetQualifierCode() == QualifierCode::UINT8_CNT_UINT8_INDEX) | 100 | 1.69k | { | 101 | 1.69k | return ProcessIndexPrefixOneByte(record, meas); | 102 | 1.69k | } | 103 | 904 | else | 104 | 904 | { | 105 | 904 | return ProcessIndexPrefixTwoByte(record, meas); | 106 | 904 | } | 107 | 2.60k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::ProcessAny<opendnp3::AnalogOutputInt32>(opendnp3::HeaderRecord const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt32> > const&) Line | Count | Source | 98 | 1.68k | { | 99 | 1.68k | if (record.GetQualifierCode() == QualifierCode::UINT8_CNT_UINT8_INDEX) | 100 | 852 | { | 101 | 852 | return ProcessIndexPrefixOneByte(record, meas); | 102 | 852 | } | 103 | 837 | else | 104 | 837 | { | 105 | 837 | return ProcessIndexPrefixTwoByte(record, meas); | 106 | 837 | } | 107 | 1.68k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::ProcessAny<opendnp3::AnalogOutputFloat32>(opendnp3::HeaderRecord const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputFloat32> > const&) Line | Count | Source | 98 | 1.82k | { | 99 | 1.82k | if (record.GetQualifierCode() == QualifierCode::UINT8_CNT_UINT8_INDEX) | 100 | 1.12k | { | 101 | 1.12k | return ProcessIndexPrefixOneByte(record, meas); | 102 | 1.12k | } | 103 | 701 | else | 104 | 701 | { | 105 | 701 | return ProcessIndexPrefixTwoByte(record, meas); | 106 | 701 | } | 107 | 1.82k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::ProcessAny<opendnp3::AnalogOutputDouble64>(opendnp3::HeaderRecord const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputDouble64> > const&) Line | Count | Source | 98 | 1.82k | { | 99 | 1.82k | if (record.GetQualifierCode() == QualifierCode::UINT8_CNT_UINT8_INDEX) | 100 | 1.35k | { | 101 | 1.35k | return ProcessIndexPrefixOneByte(record, meas); | 102 | 1.35k | } | 103 | 464 | else | 104 | 464 | { | 105 | 464 | return ProcessIndexPrefixTwoByte(record, meas); | 106 | 464 | } | 107 | 1.82k | } |
|
108 | | |
109 | | template<class Target, class IndexType> |
110 | | IINField CommandResponseHandler::RespondToHeaderWithIterator(QualifierCode qualifier, |
111 | | const DNP3Serializer<Target>& serializer, |
112 | | const ICollection<Indexed<Target>>& values, |
113 | | PrefixedWriteIterator<IndexType, Target>* pIterator) |
114 | 9.50k | { |
115 | 9.50k | IINField ret; |
116 | | |
117 | 53.1k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { |
118 | 53.1k | Target response(pair.value); |
119 | 53.1k | response.status = this->ProcessCommand(pair.value, pair.index); |
120 | | |
121 | 53.1k | switch (response.status) |
122 | 53.1k | { |
123 | 39.4k | case (CommandStatus::SUCCESS): |
124 | 39.4k | ++this->numSuccess; |
125 | 39.4k | break; |
126 | 1.97k | case (CommandStatus::NOT_SUPPORTED): |
127 | 1.97k | ret.SetBit(IINBit::PARAM_ERROR); |
128 | 1.97k | break; |
129 | 11.7k | default: |
130 | 11.7k | break; |
131 | 53.1k | } |
132 | | |
133 | 53.1k | if (pIterator) |
134 | 35.7k | { |
135 | 35.7k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); |
136 | 35.7k | } |
137 | 53.1k | }; opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::ControlRelayOutputBlock, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::ControlRelayOutputBlock>*)::{lambda(opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> const&)#1}::operator()(opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> const&) constLine | Count | Source | 117 | 2.04k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 2.04k | Target response(pair.value); | 119 | 2.04k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 2.04k | switch (response.status) | 122 | 2.04k | { | 123 | 774 | case (CommandStatus::SUCCESS): | 124 | 774 | ++this->numSuccess; | 125 | 774 | break; | 126 | 670 | case (CommandStatus::NOT_SUPPORTED): | 127 | 670 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 670 | break; | 129 | 597 | default: | 130 | 597 | break; | 131 | 2.04k | } | 132 | | | 133 | 2.04k | if (pIterator) | 134 | 1.33k | { | 135 | 1.33k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 1.33k | } | 137 | 2.04k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt16, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt16> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputInt16>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputInt16> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputInt16> const&) constLine | Count | Source | 117 | 3.95k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 3.95k | Target response(pair.value); | 119 | 3.95k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 3.95k | switch (response.status) | 122 | 3.95k | { | 123 | 2.15k | case (CommandStatus::SUCCESS): | 124 | 2.15k | ++this->numSuccess; | 125 | 2.15k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 1.80k | default: | 130 | 1.80k | break; | 131 | 3.95k | } | 132 | | | 133 | 3.95k | if (pIterator) | 134 | 2.71k | { | 135 | 2.71k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 2.71k | } | 137 | 3.95k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt32, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputInt32>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputInt32> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputInt32> const&) constLine | Count | Source | 117 | 2.92k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 2.92k | Target response(pair.value); | 119 | 2.92k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 2.92k | switch (response.status) | 122 | 2.92k | { | 123 | 2.39k | case (CommandStatus::SUCCESS): | 124 | 2.39k | ++this->numSuccess; | 125 | 2.39k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 523 | default: | 130 | 523 | break; | 131 | 2.92k | } | 132 | | | 133 | 2.92k | if (pIterator) | 134 | 2.41k | { | 135 | 2.41k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 2.41k | } | 137 | 2.92k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputFloat32, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputFloat32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputFloat32>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputFloat32> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputFloat32> const&) constLine | Count | Source | 117 | 2.66k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 2.66k | Target response(pair.value); | 119 | 2.66k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 2.66k | switch (response.status) | 122 | 2.66k | { | 123 | 1.83k | case (CommandStatus::SUCCESS): | 124 | 1.83k | ++this->numSuccess; | 125 | 1.83k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 838 | default: | 130 | 838 | break; | 131 | 2.66k | } | 132 | | | 133 | 2.66k | if (pIterator) | 134 | 1.92k | { | 135 | 1.92k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 1.92k | } | 137 | 2.66k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputDouble64, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputDouble64> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputDouble64>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputDouble64> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputDouble64> const&) constLine | Count | Source | 117 | 2.00k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 2.00k | Target response(pair.value); | 119 | 2.00k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 2.00k | switch (response.status) | 122 | 2.00k | { | 123 | 1.41k | case (CommandStatus::SUCCESS): | 124 | 1.41k | ++this->numSuccess; | 125 | 1.41k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 588 | default: | 130 | 588 | break; | 131 | 2.00k | } | 132 | | | 133 | 2.00k | if (pIterator) | 134 | 1.16k | { | 135 | 1.16k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 1.16k | } | 137 | 2.00k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::ControlRelayOutputBlock, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::ControlRelayOutputBlock>*)::{lambda(opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> const&)#1}::operator()(opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> const&) constLine | Count | Source | 117 | 3.58k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 3.58k | Target response(pair.value); | 119 | 3.58k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 3.58k | switch (response.status) | 122 | 3.58k | { | 123 | 1.88k | case (CommandStatus::SUCCESS): | 124 | 1.88k | ++this->numSuccess; | 125 | 1.88k | break; | 126 | 1.30k | case (CommandStatus::NOT_SUPPORTED): | 127 | 1.30k | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 1.30k | break; | 129 | 393 | default: | 130 | 393 | break; | 131 | 3.58k | } | 132 | | | 133 | 3.58k | if (pIterator) | 134 | 2.32k | { | 135 | 2.32k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 2.32k | } | 137 | 3.58k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt16, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt16> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputInt16>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputInt16> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputInt16> const&) constLine | Count | Source | 117 | 20.7k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 20.7k | Target response(pair.value); | 119 | 20.7k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 20.7k | switch (response.status) | 122 | 20.7k | { | 123 | 17.4k | case (CommandStatus::SUCCESS): | 124 | 17.4k | ++this->numSuccess; | 125 | 17.4k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 3.27k | default: | 130 | 3.27k | break; | 131 | 20.7k | } | 132 | | | 133 | 20.7k | if (pIterator) | 134 | 11.5k | { | 135 | 11.5k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 11.5k | } | 137 | 20.7k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt32, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputInt32>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputInt32> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputInt32> const&) constLine | Count | Source | 117 | 2.92k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 2.92k | Target response(pair.value); | 119 | 2.92k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 2.92k | switch (response.status) | 122 | 2.92k | { | 123 | 1.91k | case (CommandStatus::SUCCESS): | 124 | 1.91k | ++this->numSuccess; | 125 | 1.91k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 1.00k | default: | 130 | 1.00k | break; | 131 | 2.92k | } | 132 | | | 133 | 2.92k | if (pIterator) | 134 | 2.16k | { | 135 | 2.16k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 2.16k | } | 137 | 2.92k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputFloat32, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputFloat32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputFloat32>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputFloat32> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputFloat32> const&) constLine | Count | Source | 117 | 5.98k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 5.98k | Target response(pair.value); | 119 | 5.98k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 5.98k | switch (response.status) | 122 | 5.98k | { | 123 | 4.65k | case (CommandStatus::SUCCESS): | 124 | 4.65k | ++this->numSuccess; | 125 | 4.65k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 1.33k | default: | 130 | 1.33k | break; | 131 | 5.98k | } | 132 | | | 133 | 5.98k | if (pIterator) | 134 | 4.94k | { | 135 | 4.94k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 4.94k | } | 137 | 5.98k | }; |
opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputDouble64, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputDouble64> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputDouble64>*)::{lambda(opendnp3::Indexed<opendnp3::AnalogOutputDouble64> const&)#1}::operator()(opendnp3::Indexed<opendnp3::AnalogOutputDouble64> const&) constLine | Count | Source | 117 | 6.30k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 6.30k | Target response(pair.value); | 119 | 6.30k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 6.30k | switch (response.status) | 122 | 6.30k | { | 123 | 4.90k | case (CommandStatus::SUCCESS): | 124 | 4.90k | ++this->numSuccess; | 125 | 4.90k | break; | 126 | 0 | case (CommandStatus::NOT_SUPPORTED): | 127 | 0 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 0 | break; | 129 | 1.39k | default: | 130 | 1.39k | break; | 131 | 6.30k | } | 132 | | | 133 | 6.30k | if (pIterator) | 134 | 5.15k | { | 135 | 5.15k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 5.15k | } | 137 | 6.30k | }; |
|
138 | | |
139 | 9.50k | values.ForeachItem(process); |
140 | | |
141 | 9.50k | return ret; |
142 | 9.50k | } opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::ControlRelayOutputBlock, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::ControlRelayOutputBlock>*) Line | Count | Source | 114 | 785 | { | 115 | 785 | IINField ret; | 116 | | | 117 | 785 | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 785 | Target response(pair.value); | 119 | 785 | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 785 | switch (response.status) | 122 | 785 | { | 123 | 785 | case (CommandStatus::SUCCESS): | 124 | 785 | ++this->numSuccess; | 125 | 785 | break; | 126 | 785 | case (CommandStatus::NOT_SUPPORTED): | 127 | 785 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 785 | break; | 129 | 785 | default: | 130 | 785 | break; | 131 | 785 | } | 132 | | | 133 | 785 | if (pIterator) | 134 | 785 | { | 135 | 785 | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 785 | } | 137 | 785 | }; | 138 | | | 139 | 785 | values.ForeachItem(process); | 140 | | | 141 | 785 | return ret; | 142 | 785 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt16, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt16> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputInt16>*) Line | Count | Source | 114 | 904 | { | 115 | 904 | IINField ret; | 116 | | | 117 | 904 | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 904 | Target response(pair.value); | 119 | 904 | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 904 | switch (response.status) | 122 | 904 | { | 123 | 904 | case (CommandStatus::SUCCESS): | 124 | 904 | ++this->numSuccess; | 125 | 904 | break; | 126 | 904 | case (CommandStatus::NOT_SUPPORTED): | 127 | 904 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 904 | break; | 129 | 904 | default: | 130 | 904 | break; | 131 | 904 | } | 132 | | | 133 | 904 | if (pIterator) | 134 | 904 | { | 135 | 904 | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 904 | } | 137 | 904 | }; | 138 | | | 139 | 904 | values.ForeachItem(process); | 140 | | | 141 | 904 | return ret; | 142 | 904 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt32, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputInt32>*) Line | Count | Source | 114 | 837 | { | 115 | 837 | IINField ret; | 116 | | | 117 | 837 | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 837 | Target response(pair.value); | 119 | 837 | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 837 | switch (response.status) | 122 | 837 | { | 123 | 837 | case (CommandStatus::SUCCESS): | 124 | 837 | ++this->numSuccess; | 125 | 837 | break; | 126 | 837 | case (CommandStatus::NOT_SUPPORTED): | 127 | 837 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 837 | break; | 129 | 837 | default: | 130 | 837 | break; | 131 | 837 | } | 132 | | | 133 | 837 | if (pIterator) | 134 | 837 | { | 135 | 837 | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 837 | } | 137 | 837 | }; | 138 | | | 139 | 837 | values.ForeachItem(process); | 140 | | | 141 | 837 | return ret; | 142 | 837 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputFloat32, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputFloat32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputFloat32>*) Line | Count | Source | 114 | 701 | { | 115 | 701 | IINField ret; | 116 | | | 117 | 701 | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 701 | Target response(pair.value); | 119 | 701 | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 701 | switch (response.status) | 122 | 701 | { | 123 | 701 | case (CommandStatus::SUCCESS): | 124 | 701 | ++this->numSuccess; | 125 | 701 | break; | 126 | 701 | case (CommandStatus::NOT_SUPPORTED): | 127 | 701 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 701 | break; | 129 | 701 | default: | 130 | 701 | break; | 131 | 701 | } | 132 | | | 133 | 701 | if (pIterator) | 134 | 701 | { | 135 | 701 | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 701 | } | 137 | 701 | }; | 138 | | | 139 | 701 | values.ForeachItem(process); | 140 | | | 141 | 701 | return ret; | 142 | 701 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputDouble64, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputDouble64> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputDouble64>*) Line | Count | Source | 114 | 464 | { | 115 | 464 | IINField ret; | 116 | | | 117 | 464 | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 464 | Target response(pair.value); | 119 | 464 | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 464 | switch (response.status) | 122 | 464 | { | 123 | 464 | case (CommandStatus::SUCCESS): | 124 | 464 | ++this->numSuccess; | 125 | 464 | break; | 126 | 464 | case (CommandStatus::NOT_SUPPORTED): | 127 | 464 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 464 | break; | 129 | 464 | default: | 130 | 464 | break; | 131 | 464 | } | 132 | | | 133 | 464 | if (pIterator) | 134 | 464 | { | 135 | 464 | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 464 | } | 137 | 464 | }; | 138 | | | 139 | 464 | values.ForeachItem(process); | 140 | | | 141 | 464 | return ret; | 142 | 464 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::ControlRelayOutputBlock, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::ControlRelayOutputBlock>*) Line | Count | Source | 114 | 787 | { | 115 | 787 | IINField ret; | 116 | | | 117 | 787 | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 787 | Target response(pair.value); | 119 | 787 | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 787 | switch (response.status) | 122 | 787 | { | 123 | 787 | case (CommandStatus::SUCCESS): | 124 | 787 | ++this->numSuccess; | 125 | 787 | break; | 126 | 787 | case (CommandStatus::NOT_SUPPORTED): | 127 | 787 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 787 | break; | 129 | 787 | default: | 130 | 787 | break; | 131 | 787 | } | 132 | | | 133 | 787 | if (pIterator) | 134 | 787 | { | 135 | 787 | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 787 | } | 137 | 787 | }; | 138 | | | 139 | 787 | values.ForeachItem(process); | 140 | | | 141 | 787 | return ret; | 142 | 787 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt16, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt16> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputInt16>*) Line | Count | Source | 114 | 1.69k | { | 115 | 1.69k | IINField ret; | 116 | | | 117 | 1.69k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 1.69k | Target response(pair.value); | 119 | 1.69k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 1.69k | switch (response.status) | 122 | 1.69k | { | 123 | 1.69k | case (CommandStatus::SUCCESS): | 124 | 1.69k | ++this->numSuccess; | 125 | 1.69k | break; | 126 | 1.69k | case (CommandStatus::NOT_SUPPORTED): | 127 | 1.69k | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 1.69k | break; | 129 | 1.69k | default: | 130 | 1.69k | break; | 131 | 1.69k | } | 132 | | | 133 | 1.69k | if (pIterator) | 134 | 1.69k | { | 135 | 1.69k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 1.69k | } | 137 | 1.69k | }; | 138 | | | 139 | 1.69k | values.ForeachItem(process); | 140 | | | 141 | 1.69k | return ret; | 142 | 1.69k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputInt32, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputInt32>*) Line | Count | Source | 114 | 852 | { | 115 | 852 | IINField ret; | 116 | | | 117 | 852 | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 852 | Target response(pair.value); | 119 | 852 | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 852 | switch (response.status) | 122 | 852 | { | 123 | 852 | case (CommandStatus::SUCCESS): | 124 | 852 | ++this->numSuccess; | 125 | 852 | break; | 126 | 852 | case (CommandStatus::NOT_SUPPORTED): | 127 | 852 | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 852 | break; | 129 | 852 | default: | 130 | 852 | break; | 131 | 852 | } | 132 | | | 133 | 852 | if (pIterator) | 134 | 852 | { | 135 | 852 | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 852 | } | 137 | 852 | }; | 138 | | | 139 | 852 | values.ForeachItem(process); | 140 | | | 141 | 852 | return ret; | 142 | 852 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputFloat32, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputFloat32> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputFloat32>*) Line | Count | Source | 114 | 1.12k | { | 115 | 1.12k | IINField ret; | 116 | | | 117 | 1.12k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 1.12k | Target response(pair.value); | 119 | 1.12k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 1.12k | switch (response.status) | 122 | 1.12k | { | 123 | 1.12k | case (CommandStatus::SUCCESS): | 124 | 1.12k | ++this->numSuccess; | 125 | 1.12k | break; | 126 | 1.12k | case (CommandStatus::NOT_SUPPORTED): | 127 | 1.12k | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 1.12k | break; | 129 | 1.12k | default: | 130 | 1.12k | break; | 131 | 1.12k | } | 132 | | | 133 | 1.12k | if (pIterator) | 134 | 1.12k | { | 135 | 1.12k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 1.12k | } | 137 | 1.12k | }; | 138 | | | 139 | 1.12k | values.ForeachItem(process); | 140 | | | 141 | 1.12k | return ret; | 142 | 1.12k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeaderWithIterator<opendnp3::AnalogOutputDouble64, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputDouble64> > const&, opendnp3::PrefixedWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputDouble64>*) Line | Count | Source | 114 | 1.35k | { | 115 | 1.35k | IINField ret; | 116 | | | 117 | 1.35k | auto process = [this, pIterator, &ret](const Indexed<Target>& pair) { | 118 | 1.35k | Target response(pair.value); | 119 | 1.35k | response.status = this->ProcessCommand(pair.value, pair.index); | 120 | | | 121 | 1.35k | switch (response.status) | 122 | 1.35k | { | 123 | 1.35k | case (CommandStatus::SUCCESS): | 124 | 1.35k | ++this->numSuccess; | 125 | 1.35k | break; | 126 | 1.35k | case (CommandStatus::NOT_SUPPORTED): | 127 | 1.35k | ret.SetBit(IINBit::PARAM_ERROR); | 128 | 1.35k | break; | 129 | 1.35k | default: | 130 | 1.35k | break; | 131 | 1.35k | } | 132 | | | 133 | 1.35k | if (pIterator) | 134 | 1.35k | { | 135 | 1.35k | pIterator->Write(response, static_cast<typename IndexType::type_t>(pair.index)); | 136 | 1.35k | } | 137 | 1.35k | }; | 138 | | | 139 | 1.35k | values.ForeachItem(process); | 140 | | | 141 | 1.35k | return ret; | 142 | 1.35k | } |
|
143 | | |
144 | | template<class Target> CommandStatus CommandResponseHandler::ProcessCommand(const Target& command, uint16_t index) |
145 | 53.1k | { |
146 | 53.1k | if (numRequests < maxCommands) |
147 | 53.1k | { |
148 | 53.1k | ++numRequests; |
149 | 53.1k | return pCommandAction->Action(command, index); |
150 | 53.1k | } |
151 | 0 | else |
152 | 0 | { |
153 | 0 | return CommandStatus::TOO_MANY_OPS; |
154 | 0 | } |
155 | 53.1k | } opendnp3::CommandStatus opendnp3::CommandResponseHandler::ProcessCommand<opendnp3::ControlRelayOutputBlock>(opendnp3::ControlRelayOutputBlock const&, unsigned short) Line | Count | Source | 145 | 5.62k | { | 146 | 5.62k | if (numRequests < maxCommands) | 147 | 5.62k | { | 148 | 5.62k | ++numRequests; | 149 | 5.62k | return pCommandAction->Action(command, index); | 150 | 5.62k | } | 151 | 0 | else | 152 | 0 | { | 153 | 0 | return CommandStatus::TOO_MANY_OPS; | 154 | 0 | } | 155 | 5.62k | } |
opendnp3::CommandStatus opendnp3::CommandResponseHandler::ProcessCommand<opendnp3::AnalogOutputInt16>(opendnp3::AnalogOutputInt16 const&, unsigned short) Line | Count | Source | 145 | 24.7k | { | 146 | 24.7k | if (numRequests < maxCommands) | 147 | 24.7k | { | 148 | 24.7k | ++numRequests; | 149 | 24.7k | return pCommandAction->Action(command, index); | 150 | 24.7k | } | 151 | 0 | else | 152 | 0 | { | 153 | 0 | return CommandStatus::TOO_MANY_OPS; | 154 | 0 | } | 155 | 24.7k | } |
opendnp3::CommandStatus opendnp3::CommandResponseHandler::ProcessCommand<opendnp3::AnalogOutputInt32>(opendnp3::AnalogOutputInt32 const&, unsigned short) Line | Count | Source | 145 | 5.84k | { | 146 | 5.84k | if (numRequests < maxCommands) | 147 | 5.84k | { | 148 | 5.84k | ++numRequests; | 149 | 5.84k | return pCommandAction->Action(command, index); | 150 | 5.84k | } | 151 | 0 | else | 152 | 0 | { | 153 | 0 | return CommandStatus::TOO_MANY_OPS; | 154 | 0 | } | 155 | 5.84k | } |
opendnp3::CommandStatus opendnp3::CommandResponseHandler::ProcessCommand<opendnp3::AnalogOutputFloat32>(opendnp3::AnalogOutputFloat32 const&, unsigned short) Line | Count | Source | 145 | 8.65k | { | 146 | 8.65k | if (numRequests < maxCommands) | 147 | 8.65k | { | 148 | 8.65k | ++numRequests; | 149 | 8.65k | return pCommandAction->Action(command, index); | 150 | 8.65k | } | 151 | 0 | else | 152 | 0 | { | 153 | 0 | return CommandStatus::TOO_MANY_OPS; | 154 | 0 | } | 155 | 8.65k | } |
opendnp3::CommandStatus opendnp3::CommandResponseHandler::ProcessCommand<opendnp3::AnalogOutputDouble64>(opendnp3::AnalogOutputDouble64 const&, unsigned short) Line | Count | Source | 145 | 8.31k | { | 146 | 8.31k | if (numRequests < maxCommands) | 147 | 8.31k | { | 148 | 8.31k | ++numRequests; | 149 | 8.31k | return pCommandAction->Action(command, index); | 150 | 8.31k | } | 151 | 0 | else | 152 | 0 | { | 153 | 0 | return CommandStatus::TOO_MANY_OPS; | 154 | 0 | } | 155 | 8.31k | } |
|
156 | | |
157 | | template<class Target, class IndexType> |
158 | | IINField CommandResponseHandler::RespondToHeader(QualifierCode qualifier, |
159 | | const DNP3Serializer<Target>& serializer, |
160 | | const ICollection<Indexed<Target>>& values) |
161 | 9.50k | { |
162 | 9.50k | if (pWriter) |
163 | 6.13k | { |
164 | 6.13k | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); |
165 | 6.13k | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); |
166 | 6.13k | } |
167 | 3.36k | else |
168 | 3.36k | { |
169 | 3.36k | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); |
170 | 3.36k | } |
171 | 9.50k | } opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::ControlRelayOutputBlock, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> > const&) Line | Count | Source | 161 | 785 | { | 162 | 785 | if (pWriter) | 163 | 565 | { | 164 | 565 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 565 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 565 | } | 167 | 220 | else | 168 | 220 | { | 169 | 220 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 220 | } | 171 | 785 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputInt16, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt16> > const&) Line | Count | Source | 161 | 904 | { | 162 | 904 | if (pWriter) | 163 | 578 | { | 164 | 578 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 578 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 578 | } | 167 | 326 | else | 168 | 326 | { | 169 | 326 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 326 | } | 171 | 904 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputInt32, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt32> > const&) Line | Count | Source | 161 | 837 | { | 162 | 837 | if (pWriter) | 163 | 516 | { | 164 | 516 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 516 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 516 | } | 167 | 321 | else | 168 | 321 | { | 169 | 321 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 321 | } | 171 | 837 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputFloat32, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputFloat32> > const&) Line | Count | Source | 161 | 701 | { | 162 | 701 | if (pWriter) | 163 | 403 | { | 164 | 403 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 403 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 403 | } | 167 | 298 | else | 168 | 298 | { | 169 | 298 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 298 | } | 171 | 701 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputDouble64, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputDouble64> > const&) Line | Count | Source | 161 | 464 | { | 162 | 464 | if (pWriter) | 163 | 208 | { | 164 | 208 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 208 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 208 | } | 167 | 256 | else | 168 | 256 | { | 169 | 256 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 256 | } | 171 | 464 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::ControlRelayOutputBlock, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> > const&) Line | Count | Source | 161 | 787 | { | 162 | 787 | if (pWriter) | 163 | 395 | { | 164 | 395 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 395 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 395 | } | 167 | 392 | else | 168 | 392 | { | 169 | 392 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 392 | } | 171 | 787 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputInt16, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt16> > const&) Line | Count | Source | 161 | 1.69k | { | 162 | 1.69k | if (pWriter) | 163 | 1.11k | { | 164 | 1.11k | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 1.11k | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 1.11k | } | 167 | 586 | else | 168 | 586 | { | 169 | 586 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 586 | } | 171 | 1.69k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputInt32, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputInt32> > const&) Line | Count | Source | 161 | 852 | { | 162 | 852 | if (pWriter) | 163 | 639 | { | 164 | 639 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 639 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 639 | } | 167 | 213 | else | 168 | 213 | { | 169 | 213 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 213 | } | 171 | 852 | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputFloat32, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputFloat32> > const&) Line | Count | Source | 161 | 1.12k | { | 162 | 1.12k | if (pWriter) | 163 | 839 | { | 164 | 839 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 839 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 839 | } | 167 | 283 | else | 168 | 283 | { | 169 | 283 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 283 | } | 171 | 1.12k | } |
opendnp3::IINField opendnp3::CommandResponseHandler::RespondToHeader<opendnp3::AnalogOutputDouble64, ser4cpp::UInt8>(opendnp3::QualifierCode, opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64> const&, opendnp3::ICollection<opendnp3::Indexed<opendnp3::AnalogOutputDouble64> > const&) Line | Count | Source | 161 | 1.35k | { | 162 | 1.35k | if (pWriter) | 163 | 884 | { | 164 | 884 | auto iter = pWriter->IterateOverCountWithPrefix<IndexType, Target>(qualifier, serializer); | 165 | 884 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values, &iter); | 166 | 884 | } | 167 | 474 | else | 168 | 474 | { | 169 | 474 | return this->RespondToHeaderWithIterator<Target, IndexType>(qualifier, serializer, values); | 170 | 474 | } | 171 | 1.35k | } |
|
172 | | |
173 | | } // namespace opendnp3 |
174 | | |
175 | | #endif |