RDK Documentation (Open Sourced RDK Components)
Device_MoCA_Interface_AssociatedDevice.cpp
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 2018 RDK Management
6  * Copyright 2018 Broadcom Inc.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain 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 
21 /**
22  * @file Device_MoCA_Interface_AssociatedDevice.c
23  *
24  * @brief Device_MoCA_Interface_AssociatedDevice API Implementation.
25  *
26  * This is the implementation of the Device_MoCA_Interface_AssociatedDevice API.
27  *
28  * @par Document
29  * TBD Relevant design or API documentation.
30  *
31  */
32 
33 /** @addtogroup Device_MoCA_Interface_AssociatedDevice Implementation
34  * This is the implementation of the Device Public API.
35  * @{
36  */
37 
38 /*****************************************************************************
39  * STANDARD INCLUDE FILES
40  *****************************************************************************/
42 #include "rdk_moca_hal.h"
43 
44 MoCAInterfaceAssociatedDevice* MoCAInterfaceAssociatedDevice::Instance = NULL;
45 
46 MoCAInterfaceAssociatedDevice::MoCAInterfaceAssociatedDevice(int _dev_id):
47  m_ui32NodeId(0),
48  m_bPreferredNC(false),
49  m_ui32PhyTxRate(0),
50  m_ui32PhyRxRate(0),
51  m_ui32TxPowerControlReduction(0),
52  m_i32RxPowerLevel(0),
53  m_ui32TxBcastRate(0),
54  m_i32RxBcastPowerLevel(0),
55  m_ui32TxPackets(0),
56  m_ui32RxPackets(0),
57  m_ui32RxErroredAndMissedPackets(0),
58  m_bQAM256Capable(false),
59  m_ui32PacketAggregationCapability(0),
60  m_ui32RxSNR(0),
61  m_bActive(false)
62 {
63  dev_id = _dev_id;
64  memset(m_i8MacAddress,0, MAC_ADDRESS_LENGTH);
65  memset(m_i8HighestVersion,0,VERSION_LENGTH);
66 }
67 
68 MoCAInterfaceAssociatedDevice* MoCAInterfaceAssociatedDevice::getInstance()
69 {
70  if(NULL == Instance)
71  {
72  Instance = new MoCAInterfaceAssociatedDevice(0);
73  }
74  return Instance;
75 }
76 
77 MoCAInterfaceAssociatedDevice::~MoCAInterfaceAssociatedDevice()
78 {
79  if(Instance)
80  {
81  delete Instance;
82  }
83 }
84 
85 
86 /****************************************************************************************************************************************************/
87 // Device.MoCA.Interface.AssociatedDevice Table Profile. Getters:
88 /****************************************************************************************************************************************************/
89 
90 int MoCAInterfaceAssociatedDevice::get_MACAddress(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
91 {
92  int ret = NOK;
93  stMsgData->paramtype = hostIf_StringType;
94  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
95 
96  if(rmh) {
97  /* Get NodeID from associate ID*/
98  const uint32_t associatedId = associatedDeviceNum;
99  uint32_t nodeID;
100  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
101  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
102  return NOK;
103  }
104  RMH_MacAddress_t macAddr;
105  if(RMH_SUCCESS == RMH_RemoteNode_GetMac(rmh, nodeID, &macAddr)) {
106  const size_t macAddrBuffSize = 20;
107  char macAddrBuff[macAddrBuffSize] = {'\0'};
108  RMH_MacToString(macAddr, macAddrBuff, macAddrBuffSize);
109  snprintf(stMsgData->paramValue, macAddrBuffSize-1, "%s", macAddrBuff);
110  ret = OK;
111  }
112  }
113  stMsgData->paramLen = sizeof(stMsgData->paramValue);
114  return ret;
115 }
116 
117 int MoCAInterfaceAssociatedDevice::get_NodeID(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
118 {
119  int ret = NOK;
120  stMsgData->paramtype = hostIf_UnsignedIntType;
121  stMsgData->paramLen = sizeof(unsigned int);
122  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
123 
124  if(rmh) {
125  /* Get NodeID from associate ID*/
126  const uint32_t associatedId = associatedDeviceNum;
127  uint32_t nodeID;
128  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
129  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
130  return NOK;
131  }
132  if(nodeID >= 0 && nodeID <=16) {
133  put_int(stMsgData->paramValue, nodeID);
134  ret = OK;
135  }
136  }
137  return ret;
138 }
139 
140 int MoCAInterfaceAssociatedDevice::get_PreferredNC(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
141 {
142  int ret = NOK;
143  stMsgData->paramtype = hostIf_BooleanType;
144  stMsgData->paramLen = sizeof(bool);
145 
146  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
147 
148  if(rmh) {
149  /* Get NodeID from associate ID*/
150  const uint32_t associatedId = associatedDeviceNum;
151  uint32_t nodeID;
152  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
153  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
154  return NOK;
155  }
156  bool isPrefNC = false;
157  if(RMH_SUCCESS == RMH_RemoteNode_GetPreferredNC(rmh, nodeID, &isPrefNC)) {
158  put_boolean(stMsgData->paramValue, isPrefNC);
159  ret = OK;
160  }
161  }
162  return ret;
163 
164 }
165 int MoCAInterfaceAssociatedDevice::get_HighestVersion(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
166 {
167  int ret = NOK;
168  stMsgData->paramtype = hostIf_StringType;
169 
170  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
171  if(rmh) {
172  /* Get NodeID from associate ID*/
173  const uint32_t associatedId = associatedDeviceNum;
174  uint32_t nodeID;
175  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
176  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
177  return NOK;
178  }
179  RMH_MoCAVersion hVer;
180  if(RMH_SUCCESS == RMH_RemoteNode_GetHighestSupportedMoCAVersion(rmh, nodeID, &hVer)) {
181  snprintf(stMsgData->paramValue, (TR69HOSTIFMGR_MAX_PARAM_LEN-1), "%02X", hVer);
182  ret = OK;
183  }
184  }
185  stMsgData->paramLen = sizeof(stMsgData->paramValue);
186  return ret;
187 }
188 
189 int MoCAInterfaceAssociatedDevice::get_PHYTxRate(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
190 {
191  int ret = NOK;
192  stMsgData->paramtype = hostIf_UnsignedIntType;
193  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
194  if(rmh) {
195  /* Get NodeID from associate ID*/
196  const uint32_t associatedId = associatedDeviceNum;
197  uint32_t nodeID;
198  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
199  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
200  return NOK;
201  }
202  uint32_t response;
203  if(RMH_SUCCESS ==RMH_RemoteNode_GetTxUnicastPhyRate(rmh, nodeID, &response)) {
204  put_int(stMsgData->paramValue, response);
205  ret = OK;
206  }
207  }
208  stMsgData->paramLen = sizeof(unsigned int);
209  return ret;
210 }
211 
212 int MoCAInterfaceAssociatedDevice::get_PHYRxRate(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
213 {
214  int ret = NOK;
215  stMsgData->paramtype = hostIf_UnsignedIntType;
216  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
217  if(rmh) {
218  /* Get NodeID from associate ID*/
219  const uint32_t associatedId = associatedDeviceNum;
220  uint32_t nodeID;
221  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
222  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
223  return NOK;
224  }
225  uint32_t response;
226  if(RMH_SUCCESS ==RMH_RemoteNode_GetRxUnicastPhyRate(rmh, nodeID, &response)) {
227  put_int(stMsgData->paramValue, response);
228  ret = OK;
229  }
230  }
231  stMsgData->paramLen = sizeof(unsigned int);
232  return ret;
233 }
234 
235 int MoCAInterfaceAssociatedDevice::get_TxPowerControlReduction(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
236 {
237  int ret = NOK;
238  stMsgData->paramtype = hostIf_UnsignedIntType;
239  stMsgData->paramLen = sizeof(unsigned int);
240 
241  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
242  if(rmh) {
243  /* Get NodeID from associate ID*/
244  const uint32_t associatedId = associatedDeviceNum;
245  uint32_t nodeID;
246  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
247  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
248  return NOK;
249  }
250  uint32_t response;
251  if(RMH_SUCCESS == RMH_RemoteNode_GetTxPowerReduction(rmh, nodeID, &response)) {
252  put_int(stMsgData->paramValue, response);
253  ret = OK;
254  }
255  }
256  return ret;
257 }
258 
259 int MoCAInterfaceAssociatedDevice::get_RxPowerLevel(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
260 {
261  int ret = NOK;
262  stMsgData->paramtype = hostIf_UnsignedIntType;
263  stMsgData->paramLen = sizeof(unsigned int);
264 
265  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
266  if(rmh) {
267  /* Get NodeID from associate ID*/
268  const uint32_t associatedId = associatedDeviceNum;
269  uint32_t nodeID;
270  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
271  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
272  return NOK;
273  }
274  float response;
275  if(RMH_SUCCESS == RMH_RemoteNode_GetRxMapPower(rmh, nodeID, &response)) {
276  put_int(stMsgData->paramValue, (int)response);
277  ret = OK;
278  }
279  }
280  return ret;
281 }
282 int MoCAInterfaceAssociatedDevice::get_TxBcastRate(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
283 {
284  int ret = NOK;
285  stMsgData->paramtype = hostIf_UnsignedIntType;
286  stMsgData->paramLen = sizeof(unsigned int);
287 
288  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
289  if(rmh) {
290  /* Get NodeID from associate ID*/
291  const uint32_t associatedId = associatedDeviceNum;
292  uint32_t nodeID;
293  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
294  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
295  return NOK;
296  }
297  uint32_t response;
298  if(RMH_SUCCESS == RMH_RemoteNode_GetRxBroadcastPhyRate(rmh, nodeID, &response)) {
299  put_int(stMsgData->paramValue, (int)response);
300  ret = OK;
301  }
302  }
303  return ret;
304 }
305 int MoCAInterfaceAssociatedDevice::get_RxBcastPowerLevel(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
306 {
307  int ret = NOK;
308  stMsgData->paramtype = hostIf_UnsignedIntType;
309  stMsgData->paramLen = sizeof(unsigned int);
310 
311  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
312  if(rmh) {
313  /* Get NodeID from associate ID*/
314  const uint32_t associatedId = associatedDeviceNum;
315  uint32_t nodeID;
316  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
317  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
318  return NOK;
319  }
320  float response;
321  if(RMH_SUCCESS == RMH_RemoteNode_GetRxBroadcastPower(rmh, nodeID, &response)) {
322  put_int(stMsgData->paramValue, (int)response);
323  ret = OK;
324  }
325  }
326  return ret;
327 }
328 
329 int MoCAInterfaceAssociatedDevice::get_TxPackets(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
330 {
331  int ret = NOK;
332  stMsgData->paramtype = hostIf_UnsignedIntType;
333  stMsgData->paramLen = sizeof(unsigned int);
334 
335  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
336  if(rmh) {
337  /* Get NodeID from associate ID*/
338  const uint32_t associatedId = associatedDeviceNum;
339  uint32_t nodeID;
340  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
341  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
342  return NOK;
343  }
344  uint32_t response;
345  if(RMH_SUCCESS == RMH_RemoteNode_GetTxPackets(rmh, nodeID, &response)) {
346  put_int(stMsgData->paramValue, response);
347  ret = OK;
348  }
349  }
350  return ret;
351 }
352 
353 int MoCAInterfaceAssociatedDevice::get_RxPackets(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
354 {
355  int ret = NOK;
356  stMsgData->paramtype = hostIf_UnsignedIntType;
357  stMsgData->paramLen = sizeof(unsigned int);
358 
359  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
360  if(rmh) {
361  /* Get NodeID from associate ID*/
362  const uint32_t associatedId = associatedDeviceNum;
363  uint32_t nodeID;
364  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
365  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
366  return NOK;
367  }
368  uint32_t response;
369  if(RMH_SUCCESS == RMH_RemoteNode_GetRxPackets(rmh, nodeID, &response)) {
370  put_int(stMsgData->paramValue, response);
371  ret = OK;
372  }
373  }
374  return ret;
375 }
376 int MoCAInterfaceAssociatedDevice::get_RxErroredAndMissedPackets(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
377 {
378  int ret = NOK;
379  stMsgData->paramtype = hostIf_UnsignedIntType;
380  stMsgData->paramLen = sizeof(unsigned int);
381 
382  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
383  if(rmh) {
384  /* Get NodeID from associate ID*/
385  const uint32_t associatedId = associatedDeviceNum;
386  uint32_t nodeID;
387  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
388  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
389  return NOK;
390  }
391  uint32_t response;
392  if(RMH_SUCCESS == RMH_RemoteNode_GetRxTotalErrors(rmh, nodeID, &response)) {
393  put_int(stMsgData->paramValue, response);
394  ret = OK;
395  }
396  }
397  return ret;
398 }
399 
400 int MoCAInterfaceAssociatedDevice::get_QAM256Capable(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
401 {
402  int ret = NOK;
403  stMsgData->paramtype = hostIf_BooleanType;
404  stMsgData->paramLen = sizeof(bool);
405 
406  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
407  if(rmh) {
408  /* Get NodeID from associate ID*/
409  const uint32_t associatedId = associatedDeviceNum;
410  uint32_t nodeID;
411  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
412  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
413  return NOK;
414  }
415  bool response;
416  if(RMH_SUCCESS == RMH_RemoteNode_GetQAM256Capable(rmh, nodeID, &response)) {
417  put_boolean(stMsgData->paramValue, response);
418  ret = OK;
419  }
420  }
421  return ret;
422 }
423 
424 int MoCAInterfaceAssociatedDevice::get_PacketAggregationCapability(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
425 {
426  int ret = NOK;
427  stMsgData->paramtype = hostIf_UnsignedIntType;
428  stMsgData->paramLen = sizeof(unsigned int);
429 
430  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
431  if(rmh) {
432  /* Get NodeID from associate ID*/
433  const uint32_t associatedId = associatedDeviceNum;
434  uint32_t nodeID;
435  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
436  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
437  return NOK;
438  }
439  uint32_t response;
440  if(RMH_SUCCESS == RMH_RemoteNode_GetMaxPacketAggregation(rmh, nodeID, &response)) {
441  put_int(stMsgData->paramValue, response);
442  ret = OK;
443  }
444  }
445  return ret;
446 }
447 
448 int MoCAInterfaceAssociatedDevice::get_RxSNR(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
449 {
450  int ret = NOK;
451  stMsgData->paramtype = hostIf_UnsignedIntType;
452  stMsgData->paramLen = sizeof(unsigned int);
453 
454  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
455  if(rmh) {
456  /* Get NodeID from associate ID*/
457  const uint32_t associatedId = associatedDeviceNum;
458  uint32_t nodeID;
459  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
460  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
461  return NOK;
462  }
463  float response;
464  if(RMH_SUCCESS == RMH_RemoteNode_GetRxSNR(rmh, nodeID, &response)) {
465  put_int(stMsgData->paramValue, (int)response);
466  ret = OK;
467  }
468  }
469  return ret;
470 }
471 
472 int MoCAInterfaceAssociatedDevice::get_Active(HOSTIF_MsgData_t *stMsgData,unsigned int associatedDeviceNum,bool *pChanged)
473 {
474  int retval = NOK;
475 
476  stMsgData->paramtype = hostIf_UnsignedIntType;
477  stMsgData->paramLen = sizeof(unsigned int);
478 
479  const RMH_Handle rmh = (RMH_Handle)MoCADevice::getRmhContext();
480  if(rmh) {
481  /* Get NodeID from associate ID*/
482  const uint32_t associatedId = associatedDeviceNum;
483  uint32_t nodeID;
484  if(RMH_SUCCESS != RMH_RemoteNode_GetNodeIdFromAssociatedId(rmh, associatedId, &nodeID)) {
485  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"Failed in RMH_RemoteNode_GetNodeIdFromAssociatedId for AssociatedId (%d) \n",__FUNCTION__,associatedDeviceNum);
486  return NOK;
487  }
488 
489  RMH_NodeList_Uint32_t response;
490  RMH_Result ret = RMH_Network_GetNodeIds(rmh, &response);
491  if (ret != RMH_SUCCESS) {
492  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%u] RMH_Network_GetNodeIds failed with result %s.\n", __FUNCTION__, __LINE__, RMH_ResultToString(ret));
493  return retval;
494  }
495 
496  for (int nodeId = 0; nodeId < RMH_MAX_MOCA_NODES; nodeId++) {
497  if ((true ==response.nodePresent[nodeId]) && (nodeId == nodeID)) {
498  put_boolean(stMsgData->paramValue, true);
499  retval = OK;
500  break;
501  }
502  }
503  }
504  return retval;
505 }
506 
507 /* End of doxygen group */
508 /**
509  * @}
510  */
511 
512 /* End of file xxx_api.c. */
MoCAInterfaceAssociatedDevice::get_MACAddress
int get_MACAddress(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the MAC address of the associated device's MoCA interface.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:90
RMH_RemoteNode_GetRxBroadcastPhyRate
RMH_Result RMH_RemoteNode_GetRxBroadcastPhyRate(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
Return the PHY rate at which broadcast packets are received from nodeId.
MoCAInterfaceAssociatedDevice::get_PHYRxRate
int get_PHYRxRate(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the PHY receive rate (in Mbps) from this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:212
RMH_RemoteNode_GetMac
RMH_Result RMH_RemoteNode_GetMac(const RMH_Handle handle, const uint32_t nodeId, RMH_MacAddress_t *response)
Return the MAC address of the remote node specified by nodeId.
MoCAInterfaceAssociatedDevice::get_TxPowerControlReduction
int get_TxPowerControlReduction(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the reduction in transmitter level (in dB) due to power control.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:235
RMH_Network_GetNodeIds
RMH_Result RMH_Network_GetNodeIds(const RMH_Handle handle, RMH_NodeList_Uint32_t *response)
Return a list of every node ID on the network.
RMH_RemoteNode_GetPreferredNC
RMH_Result RMH_RemoteNode_GetPreferredNC(const RMH_Handle handle, const uint32_t nodeId, bool *response)
Return if the node indicated by nodeId is a preferred NC or not.
RMH_RemoteNode_GetRxBroadcastPower
RMH_Result RMH_RemoteNode_GetRxBroadcastPower(const RMH_Handle handle, const uint32_t nodeId, float *response)
Return the power level at which broadcast packets are received from nodeId.
MoCAInterfaceAssociatedDevice::get_TxBcastRate
int get_TxBcastRate(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the broadcast PHY transmit rate (in Mbps) from this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:282
MoCAInterfaceAssociatedDevice::get_RxPowerLevel
int get_RxPowerLevel(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the power level (in dBm) received at the MoCA interface from this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:259
MoCAInterfaceAssociatedDevice::get_RxErroredAndMissedPackets
int get_RxErroredAndMissedPackets(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the number of errored and missed packets received from this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:376
RMH_NodeList_Uint32_t
Definition: rmh_type.h:195
MoCAInterfaceAssociatedDevice
Definition: Device_MoCA_Interface_AssociatedDevice.h:98
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
MoCAInterfaceAssociatedDevice::get_PreferredNC
int get_PreferredNC(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Check whether the MoCA remote device is a preferred Network Coordinator (NC).
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:140
RMH_RemoteNode_GetHighestSupportedMoCAVersion
RMH_Result RMH_RemoteNode_GetHighestSupportedMoCAVersion(const RMH_Handle handle, const uint32_t nodeId, RMH_MoCAVersion *response)
Return the highest supported version of MoCA by the remote node specified by nodeId.
Device_MoCA_Interface_AssociatedDevice.h
RMH_RemoteNode_GetNodeIdFromAssociatedId
RMH_Result RMH_RemoteNode_GetNodeIdFromAssociatedId(const RMH_Handle handle, const uint32_t associatedId, uint32_t *response)
Convert an associated Id into a Node Id.
RMH_RemoteNode_GetRxMapPower
RMH_Result RMH_RemoteNode_GetRxMapPower(const RMH_Handle handle, const uint32_t nodeId, float *response)
Return the power level at which MAP packets are received by nodeId.
MoCAInterfaceAssociatedDevice::get_HighestVersion
int get_HighestVersion(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the identifies the highest MoCA version that this remote device supports.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:165
MoCAInterfaceAssociatedDevice::get_PHYTxRate
int get_PHYTxRate(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the PHY transmit rate (in Mbps) to this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:189
put_boolean
void put_boolean(char *ptr, bool val)
This function converts the input data to Boolean type.
Definition: hostIf_utils.cpp:191
RMH_RemoteNode_GetRxPackets
RMH_Result RMH_RemoteNode_GetRxPackets(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
Return the number of packets nodeId has received.
MoCAInterfaceAssociatedDevice::get_TxPackets
int get_TxPackets(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the number of packets transmitted to this remote device (Note: Includes Broadcast,...
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:329
MoCAInterfaceAssociatedDevice::get_PacketAggregationCapability
int get_PacketAggregationCapability(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the packet aggregation capability supported by the remote device. Standard values are 0 (no suppo...
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:424
RMH
Definition: librmh.h:57
RMH_RemoteNode_GetRxTotalErrors
RMH_Result RMH_RemoteNode_GetRxTotalErrors(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
Return the total number of packets with errors nodeId has received.
_HostIf_MsgData_t::paramtype
HostIf_ParamType_t paramtype
Definition: hostIf_tr69ReqHandler.h:177
RMH_RemoteNode_GetRxUnicastPhyRate
RMH_Result RMH_RemoteNode_GetRxUnicastPhyRate(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
Return the PHY rate at which unicast packets are received from nodeId of the self node.
MoCAInterfaceAssociatedDevice::get_QAM256Capable
int get_QAM256Capable(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Check whether this remote device supports the 256 QAM feature.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:400
RDK_LOG
#define RDK_LOG
Definition: rdk_debug.h:258
RMH_RemoteNode_GetQAM256Capable
RMH_Result RMH_RemoteNode_GetQAM256Capable(const RMH_Handle handle, const uint32_t nodeId, bool *response)
Return if the node indicated by nodeId has QAM256 enabled or not.
RMH_MacToString
const char *const RMH_MacToString(const RMH_MacAddress_t value, char *responseBuf, const size_t responseBufSize)
Returns the provided MAC address in value as a string.
Definition: librmh_api_no_wrap.c:174
MoCAInterfaceAssociatedDevice::get_RxPackets
int get_RxPackets(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the number of packets received from this remote device (Note: Includes Broadcast,...
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:353
RMH_ResultToString
const char *const RMH_ResultToString(const RMH_Result value)
Convert RMH_Result to a string.
Definition: librmh_api_no_wrap.c:84
_HostIf_MsgData_t::paramValue
char paramValue[(4 *1024)]
Definition: hostIf_tr69ReqHandler.h:172
RMH_RemoteNode_GetTxPowerReduction
RMH_Result RMH_RemoteNode_GetTxPowerReduction(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
The transmit power control back-off used for transmissions from the specified nodeId.
RMH_RemoteNode_GetTxUnicastPhyRate
RMH_Result RMH_RemoteNode_GetTxUnicastPhyRate(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
Return the PHY rate at which unicast packets are transmitted from nodeId to the self node.
RMH_RemoteNode_GetTxPackets
RMH_Result RMH_RemoteNode_GetTxPackets(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
Return the total number of packets nodeId has transmitted.
MoCAInterfaceAssociatedDevice::get_RxSNR
int get_RxSNR(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the signal to noise level (in dBm) received at this interface from this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:448
MoCAInterfaceAssociatedDevice::get_NodeID
int get_NodeID(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the Node ID of this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:117
RMH_RemoteNode_GetRxSNR
RMH_Result RMH_RemoteNode_GetRxSNR(const RMH_Handle handle, const uint32_t nodeId, float *response)
The signal to noise ratio of nodeId based on the Type 1 probe from per node.
put_int
void put_int(char *ptr, int val)
This function converts the input data to integer type.
Definition: hostIf_utils.cpp:152
MoCAInterfaceAssociatedDevice::get_Active
int get_Active(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Check whether or not this remote device is currently present in the MoCA network.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:472
_HostIf_MsgData_t::paramLen
short paramLen
Definition: hostIf_tr69ReqHandler.h:175
RMH_RemoteNode_GetMaxPacketAggregation
RMH_Result RMH_RemoteNode_GetMaxPacketAggregation(const RMH_Handle handle, const uint32_t nodeId, uint32_t *response)
Return the maximum number of packets for aggregated transmissions for the node indicated by nodeId.
MoCAInterfaceAssociatedDevice::get_RxBcastPowerLevel
int get_RxBcastPowerLevel(HOSTIF_MsgData_t *stMsgData, unsigned int associatedDeviceNum, bool *pChanged=NULL)
Get the power level (in dBm) received at the MoCA interface from this remote device.
Definition: Device_MoCA_Interface_AssociatedDevice.cpp:305