Coverage Report

Created: 2026-03-31 06:56

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opendnp3/cpp/lib/src/master/RestartOperationTask.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_RESTART_OPERATION_TASK_H
21
#define OPENDNP3_RESTART_OPERATION_TASK_H
22
23
#include "app/parsing/IAPDUHandler.h"
24
#include "master/IMasterTask.h"
25
#include "master/TaskPriority.h"
26
27
#include "opendnp3/gen/RestartType.h"
28
#include "opendnp3/master/RestartOperationResult.h"
29
30
namespace opendnp3
31
{
32
33
class RestartOperationTask final : public IMasterTask, private IAPDUHandler
34
{
35
36
public:
37
    RestartOperationTask(const std::shared_ptr<TaskContext>& context,
38
                         IMasterApplication& app,
39
                         const Timestamp& startTimeout,
40
                         RestartType operationType,
41
                         RestartOperationCallbackT callback,
42
                         const Logger& logger,
43
                         const TaskConfig& config);
44
45
    bool BuildRequest(APDURequest& request, uint8_t seq) override;
46
47
    int Priority() const override
48
0
    {
49
0
        return priority::USER_REQUEST;
50
0
    }
51
52
    bool BlocksLowerPriority() const override
53
0
    {
54
0
        return false;
55
0
    }
56
57
    bool IsRecurring() const override
58
0
    {
59
0
        return false;
60
0
    }
61
62
    char const* Name() const override;
63
64
    bool IsAllowed(uint32_t headerCount, GroupVariation gv, QualifierCode qc) override;
65
66
private:
67
    MasterTaskType GetTaskType() const override;
68
69
    IINField ProcessHeader(const CountHeader& header, const ICollection<Group52Var1>& values) override;
70
    IINField ProcessHeader(const CountHeader& header, const ICollection<Group52Var2>& values) override;
71
72
    static FunctionCode ToFunctionCode(RestartType op);
73
74
    const FunctionCode function;
75
    RestartOperationCallbackT callback;
76
    TimeDuration duration;
77
78
    IMasterTask::ResponseResult ProcessResponse(const APDUResponseHeader& header,
79
                                                const ser4cpp::rseq_t& objects) override;
80
81
    void OnTaskComplete(TaskCompletion result, Timestamp now) override;
82
};
83
84
} // namespace opendnp3
85
86
#endif