/src/opendnp3/cpp/lib/src/outstation/CommandActionAdapter.cpp
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 | | #include "CommandActionAdapter.h" |
21 | | |
22 | | namespace opendnp3 |
23 | | { |
24 | | |
25 | | CommandActionAdapter::CommandActionAdapter(ICommandHandler& handler, |
26 | | bool is_select, |
27 | | IUpdateHandler& updates, |
28 | | OperateType op_type) |
29 | 969 | : handler(handler), is_select(is_select), updates(updates), op_type(op_type) |
30 | 969 | { |
31 | 969 | } |
32 | | |
33 | | CommandActionAdapter::~CommandActionAdapter() |
34 | 969 | { |
35 | 969 | if (this->is_started) |
36 | 826 | { |
37 | 826 | handler.End(); |
38 | 826 | } |
39 | 969 | } |
40 | | |
41 | | void CommandActionAdapter::CheckStart() |
42 | 38.5k | { |
43 | 38.5k | if (!this->is_started) |
44 | 826 | { |
45 | 826 | this->is_started = true; |
46 | 826 | handler.Begin(); |
47 | 826 | } |
48 | 38.5k | } |
49 | | |
50 | | CommandStatus CommandActionAdapter::Action(const ControlRelayOutputBlock& command, uint16_t index) |
51 | 4.29k | { |
52 | 4.29k | if (command.IsQUFlagSet()) |
53 | 1.81k | { |
54 | 1.81k | return CommandStatus::NOT_SUPPORTED; |
55 | 1.81k | } |
56 | | |
57 | 2.47k | return this->ActionT(command, index); |
58 | 4.29k | } |
59 | | |
60 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputInt16& command, uint16_t index) |
61 | 19.1k | { |
62 | 19.1k | return this->ActionT(command, index); |
63 | 19.1k | } |
64 | | |
65 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputInt32& command, uint16_t index) |
66 | 4.62k | { |
67 | 4.62k | return this->ActionT(command, index); |
68 | 4.62k | } |
69 | | |
70 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputFloat32& command, uint16_t index) |
71 | 5.99k | { |
72 | 5.99k | return this->ActionT(command, index); |
73 | 5.99k | } |
74 | | |
75 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputDouble64& command, uint16_t index) |
76 | 6.30k | { |
77 | 6.30k | return this->ActionT(command, index); |
78 | 6.30k | } |
79 | | |
80 | | } // namespace opendnp3 |