RDK Documentation (Open Sourced RDK Components)
Device_DeviceInfo_ProcessStatus.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file Device_DeviceInfo_ProcessStatus.h
22  * @brief The header file provides TR069 device processor status information APIs.
23  */
24 
25 /**
26  * @defgroup TR69_HOSTIF_DEVICE_PROCESSORSTATUS TR-069 Object (Device.DeviceInfo.ProcessStatus)
27  * Status of the processes on the device.
28  * @ingroup TR69_HOSTIF_DEVICEINFO
29  *
30  * @defgroup TR69_HOSTIF_DEVICE_PROCESSORSTATUS_API TR-069 Object (Device.DeviceInfo.ProcessStatus.Interface.{i}) Public APIs
31  * Describe the details about TR-069 DeviceInfo processor status APIs specifications.
32  * @ingroup TR69_HOSTIF_DEVICE_PROCESSORSTATUS
33  *
34  * @defgroup TR69_HOSTIF_DEVICE_PROCESSORSTATUS_CLASSES TR-069 Object (Device.DeviceInfo.ProcessStatus.Interface.{i}) Public Classes
35  * Describe the details about classes used in TR-069 DeviceInfo processor status.
36  * @ingroup TR69_HOSTIF_DEVICE_PROCESSORSTATUS
37  */
38 
39 /**
40 * @defgroup tr69hostif
41 * @{
42 * @defgroup hostif
43 * @{
44 **/
45 
46 #ifndef DEVICE_DEVICEINFO_PROCESSSTATUS_H_
47 #define DEVICE_DEVICEINFO_PROCESSSTATUS_H_
48 
49 /*****************************************************************************
50  * TR069-SPECIFIC INCLUDE FILES
51  *****************************************************************************/
52 #include "hostIf_main.h"
53 #include <stdio.h>
54 #include <stdlib.h>
55 #include <string.h>
56 
57 #include "hostIf_tr69ReqHandler.h"
58 #include "hostIf_utils.h"
59 #include "hostIf_updateHandler.h"
60 
61 #define PARAM_LEN 256
62 
63 /**
64  * @brief This class provides the interface for getting device processor status information.
65  * @ingroup TR69_HOSTIF_DEVICE_PROCESSORSTATUS_CLASSES
66  */
68 {
71  static GHashTable *ifHash;
72  static GMutex *m_mutex;
73 
74  int dev_id;
75 
76  bool bCalledCPUUsage;
77  bool bCalledProcessNumberOfEntries;
78 
79  int backupCPUUsage;
80  int backupProcessNumberOfEntries;
81 
82  unsigned int getNumOfProcessEntries();
83  int getProcessStatusCPUUsage();
84 
85 public:
86 
87  static hostIf_DeviceProcessStatusInterface *getInstance(int dev_id);
88 
89  static void closeInstance(hostIf_DeviceProcessStatusInterface *);
90 
91  static GList *getAllInstances();
92 
93  static void closeAllInstances();
94 
95  static void getLock();
96 
97  static void releaseLock();
98 
99  /**
100  * Description. This is the getter api for Device_DeviceInfo_ProcessStatus. for
101  * Device_DeviceInfo_ProcessStatus. object Profile.
102  *
103  * @param[in] name Complete path name of the parameter.
104  * @param[in] type It is a user data type of ParameterType.
105  * @param[out] value It is the value of the parameter.
106  *
107  * @retval OK if successful.
108  * @retval XXX_ERR_BADPARAM if a bad parameter was supplied.
109  *
110  * @execution Synchronous.
111  * @sideeffect None.
112  *
113  * @note This function must not suspend and must not invoke any blocking system
114  * calls. It should probably just send a message to a driver event handler task.
115  *
116  * @see XXX_SomeOtherFunction.
117  */
118 
119 
120 
121  int get_Device_DeviceInfo_ProcessStatus_CPUUsage(HOSTIF_MsgData_t *stMsgData,bool *pChanged = NULL);
122  /**
123  * @brief get_Device_DeviceInfo_ProcessStatus_ProcessNumberOfEntries.
124  *
125  * This function provides The number of entries in the process table.
126  *
127  * @return The number of entries in the process table.
128  *
129  * @retval OK if is successful.
130  * @retval ERR_INTERNAL_ERROR if not able to fetch.
131  *
132  * @sideeffect All necessary structures and buffers are deallocated.
133  * @execution Synchronous.
134  *
135  */
136 
137 };
138 /* End of doxygen group */
139 /**
140  * @}
141  */
142 
143 #endif /* DEVICE_DEVICEINFO_PROCESSSTATUS_H_ */
144 
145 
146 /** @} */
147 /** @} */
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_main.h
hostIf_main API.
hostIf_DeviceProcessStatusInterface::get_Device_DeviceInfo_ProcessStatus_CPUUsage
int get_Device_DeviceInfo_ProcessStatus_CPUUsage(HOSTIF_MsgData_t *stMsgData, bool *pChanged=NULL)
This function provides the total amount of cpu usage, in percentage.
Definition: Device_DeviceInfo_ProcessStatus.cpp:208
hostIf_DeviceProcessStatusInterface
This class provides the interface for getting device processor status information.
Definition: Device_DeviceInfo_ProcessStatus.h:67