/src/opendnp3/cpp/lib/src/master/ICommandHeader.h
Line | Count | Source (jump to first uncovered line) |
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_ICOMMAND_HEADER_H |
21 | | #define OPENDNP3_ICOMMAND_HEADER_H |
22 | | |
23 | | #include "opendnp3/app/AnalogOutput.h" |
24 | | #include "opendnp3/app/ControlRelayOutputBlock.h" |
25 | | #include "opendnp3/app/Indexed.h" |
26 | | #include "opendnp3/app/parsing/ICollection.h" |
27 | | #include "opendnp3/gen/IndexQualifierMode.h" |
28 | | #include "opendnp3/master/CommandPointResult.h" |
29 | | #include "opendnp3/master/HeaderInfo.h" |
30 | | |
31 | | namespace opendnp3 |
32 | | { |
33 | | |
34 | | class HeaderWriter; |
35 | | |
36 | | struct CommandState |
37 | | { |
38 | 0 | CommandState(uint16_t index_) : state(CommandPointState::INIT), status(CommandStatus::UNDEFINED), index(index_) {} |
39 | | |
40 | | CommandPointState state; |
41 | | CommandStatus status; |
42 | | uint16_t index; |
43 | | }; |
44 | | |
45 | | /** |
46 | | * Represents an object header of command objects (CROB or AO) |
47 | | */ |
48 | | class ICommandHeader : public ICollection<CommandState> |
49 | | { |
50 | | public: |
51 | 0 | virtual ~ICommandHeader() {} |
52 | | |
53 | | /// Write all of the headers to an ASDU |
54 | | virtual bool Write(HeaderWriter&, IndexQualifierMode mode) = 0; |
55 | | |
56 | | /// Ask if all of the individual commands have been selected |
57 | | virtual bool AreAllSelected() const = 0; |
58 | | |
59 | | // --- each overriden classs will only override one of these --- |
60 | | |
61 | | virtual void ApplySelectResponse(QualifierCode code, const ICollection<Indexed<ControlRelayOutputBlock>>& commands) |
62 | 0 | { |
63 | 0 | } |
64 | 0 | virtual void ApplySelectResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputInt16>>& commands) {} |
65 | 0 | virtual void ApplySelectResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputInt32>>& commands) {} |
66 | 0 | virtual void ApplySelectResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputFloat32>>& commands) {} |
67 | 0 | virtual void ApplySelectResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputDouble64>>& commands) {} |
68 | | |
69 | | // --- each overriden classs will only override one of these --- |
70 | | |
71 | | virtual void ApplyOperateResponse(QualifierCode code, const ICollection<Indexed<ControlRelayOutputBlock>>& commands) |
72 | 0 | { |
73 | 0 | } |
74 | 0 | virtual void ApplyOperateResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputInt16>>& commands) {} |
75 | 0 | virtual void ApplyOperateResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputInt32>>& commands) {} |
76 | 0 | virtual void ApplyOperateResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputFloat32>>& commands) {} |
77 | 0 | virtual void ApplyOperateResponse(QualifierCode code, const ICollection<Indexed<AnalogOutputDouble64>>& commands) {} |
78 | | }; |
79 | | |
80 | | } // namespace opendnp3 |
81 | | |
82 | | #endif |