-
Notifications
You must be signed in to change notification settings - Fork 3
/
cipelectricalenergy.h
executable file
·140 lines (121 loc) · 4.46 KB
/
cipelectricalenergy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*******************************************************************************
* Copyright (c) 2019, Rockwell Automation, Inc.
* All rights reserved.
*
******************************************************************************/
#ifndef OPENER_CIP_ELECTRICAL_ENERGY_H_
#define OPENER_CIP_ELECTRICAL_ENERGY_H_
#include "opener_api.h"
#include "typedefs.h"
static const EipUint16 kCipElectricalEnergyClassCode = 0x4f; /**< Electrical Energy Object class code */
/** @brief Energy Object specific getAttributeSingle implementation for special handling of attributes (odo-meters)
*
* @param instance The requested instance
* @param message_router_request The request message
* @param message_router_response The generated response message
* @param originator_address The originators sockaddr information
* @param encapsulation_session The associated encapsulation session
*
* @return kEipStatusOkSend on success
*/
EipStatus GetAttributeSingleElectricalEnergy(CipInstance *RESTRICT const instance,
CipMessageRouterRequest *const message_router_request,
CipMessageRouterResponse *const message_router_response,
const struct sockaddr *originator_address,
const int encapsulation_session);
/** @brief Initializes the CipElectricalEnergy object
*
* @return kEipStatusOk on success, else kEipStatusError
*/
EipStatus
CipElectricalEnergyInit(void);
/* \defgroup CIP_ENERGY API of OpENer's CIP Energy implementation
*
*/
/* \ingroup CIP_ENERGY_API
* \brief function that will handle the application processing of the base energy object
*
* Will be invoked right before the void IApp_HandleApplication(void) callback.
*/
void HandleBaseEnergyObject();
/** \defgroup CIP_ENERGY_API Callback Functions Demanded by CIP Energy
* \ingroup CIP_ENERGY_API
*
* \brief These functions have to implemented in order to give the CIP Energy
* implementation of OpENer a method to inform the application on certain state changes.
*/
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Callback informing that the cip energy object is entering the state
* Metering
*/
void
BaseEnergyOnEnterStateMetering();
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Callback informing that the cip energy object is entering the state
* NotMetering
*/
void
BaseEnergyOnEnterStateNotMetering();
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Callback informing that the cip energy object is entering the state
* Starting
*/
void
BaseEnergyOnEnterStateStarting();
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Callback informing that the cip energy object is entering the state
* Stopping
*/
void
BaseEnergyOnEnterStateStopping();
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Application specific processing during the energy object state
* Metering.
*
* State processing is triggered cyclically synchronously with the manage
* connections cycle.
*
* Transitional state: Application informs with true return value that the process
* in this state has finished.
*/
CipBool
BaseEnergyProcessStateMetering();
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Application specific processing during the energy object state
* NotMetering.
*
* State processing is triggered cyclically synchronously with the manage
* connections cycle.
*
* Transitional state: Application informs with true return value that the process
* in this state has finished.
*/
CipBool
BaseEnergyProcessStateNotMetering();
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Application specific processing during the energy object state
* Starting.
*
* State processing is triggered cyclically synchronously with the manage
* connections cycle.
*
* Transitional state: Application informs with true return value that the process
* in this state has finished.
*/
CipBool
BaseEnergyProcessStateStarting();
/** \ingroup CIP_ENERGY_CALLBACK_API
* \brief Application specific processing during the energy object state
* Stopping.
*
* State processing is triggered cyclically synchronously with the manage
* connections cycle.
*
* Transitional state: Application informs with true return value that the process
* in this state has finished.
*/
CipBool
BaseEnergyProcessStateStopping();
void UpdateElectricalMeasuringAndMeteringData(double time_interval_in_seconds,
double voltage, double current);
#endif /* OPENER_CIP_ELECTRICAL_ENERGY_H_ */