/src/opendnp3/cpp/lib/src/outstation/WriteHandler.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_WRITEHANDLER_H |
21 | | #define OPENDNP3_WRITEHANDLER_H |
22 | | |
23 | | #include "app/parsing/IAPDUHandler.h" |
24 | | #include "outstation/TimeSyncState.h" |
25 | | |
26 | | #include "opendnp3/app/IINField.h" |
27 | | #include "opendnp3/logging/Logger.h" |
28 | | #include "opendnp3/outstation/IOutstationApplication.h" |
29 | | #include "opendnp3/util/Timestamp.h" |
30 | | |
31 | | namespace opendnp3 |
32 | | { |
33 | | |
34 | | class WriteHandler final : public IAPDUHandler |
35 | | { |
36 | | public: |
37 | | WriteHandler(IOutstationApplication& application, |
38 | | TimeSyncState& timeSyncState, |
39 | | AppSeqNum seq, |
40 | | Timestamp now, |
41 | | IINField* pWriteIIN); |
42 | | |
43 | | virtual bool IsAllowed(uint32_t headerCount, GroupVariation gv, QualifierCode qc) override |
44 | 27.9k | { |
45 | 27.9k | return true; |
46 | 27.9k | } |
47 | | |
48 | | private: |
49 | | virtual IINField ProcessHeader(const RangeHeader& header, const ICollection<Indexed<IINValue>>& values) override; |
50 | | |
51 | | virtual IINField ProcessHeader(const CountHeader& header, const ICollection<Group50Var1>& values) override; |
52 | | |
53 | | virtual IINField ProcessHeader(const CountHeader& header, const ICollection<Group50Var3>& values) override; |
54 | | |
55 | | virtual IINField ProcessHeader(const PrefixHeader& header, |
56 | | const ICollection<Indexed<TimeAndInterval>>& values) override; |
57 | | |
58 | | IOutstationApplication* application; |
59 | | TimeSyncState* timeSyncState; |
60 | | AppSeqNum seq; |
61 | | Timestamp now; |
62 | | IINField* writeIIN; |
63 | | |
64 | | bool wroteTime = false; |
65 | | bool wroteIIN = false; |
66 | | }; |
67 | | |
68 | | } // namespace opendnp3 |
69 | | |
70 | | #endif |