/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 | 1.07k | : handler(handler), is_select(is_select), updates(updates), op_type(op_type) |
30 | 1.07k | { |
31 | 1.07k | } |
32 | | |
33 | | CommandActionAdapter::~CommandActionAdapter() |
34 | 1.07k | { |
35 | 1.07k | if (this->is_started) |
36 | 902 | { |
37 | 902 | handler.End(); |
38 | 902 | } |
39 | 1.07k | } |
40 | | |
41 | | void CommandActionAdapter::CheckStart() |
42 | 35.8k | { |
43 | 35.8k | if (!this->is_started) |
44 | 902 | { |
45 | 902 | this->is_started = true; |
46 | 902 | handler.Begin(); |
47 | 902 | } |
48 | 35.8k | } |
49 | | |
50 | | CommandStatus CommandActionAdapter::Action(const ControlRelayOutputBlock& command, uint16_t index) |
51 | 3.38k | { |
52 | 3.38k | if (command.IsQUFlagSet()) |
53 | 1.44k | { |
54 | 1.44k | return CommandStatus::NOT_SUPPORTED; |
55 | 1.44k | } |
56 | | |
57 | 1.94k | return this->ActionT(command, index); |
58 | 3.38k | } |
59 | | |
60 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputInt16& command, uint16_t index) |
61 | 15.0k | { |
62 | 15.0k | return this->ActionT(command, index); |
63 | 15.0k | } |
64 | | |
65 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputInt32& command, uint16_t index) |
66 | 6.00k | { |
67 | 6.00k | return this->ActionT(command, index); |
68 | 6.00k | } |
69 | | |
70 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputFloat32& command, uint16_t index) |
71 | 9.15k | { |
72 | 9.15k | return this->ActionT(command, index); |
73 | 9.15k | } |
74 | | |
75 | | CommandStatus CommandActionAdapter::Action(const AnalogOutputDouble64& command, uint16_t index) |
76 | 3.70k | { |
77 | 3.70k | return this->ActionT(command, index); |
78 | 3.70k | } |
79 | | |
80 | | } // namespace opendnp3 |