Code Examples.
More...
Code Examples.
The PM MSOs can be configured to be autocreated in IDE in which case COR server will create it when the node is coming up. Otherwise it can be created later by the user explicitly using COR Apis. Please refer COR section in this API reference guide for the usage examples.
The below code shows how to register the resources (or MOs) with the PM library so that the PM operation will be performed on those MOs.
ClCharT* resources[] = {
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:0",
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:2",
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:3",
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:4"
};
ClUint32T count = 4;
ClUint32T i = 0;
for (i=0 ; i<count; i++)
{
{
clLogError("APP", "INT", "Failed to get moId from moId name. rc [0x%x]", rc);
return rc;
}
}
pMoIdList->moIdCnt = count;
{
clLogError("APP", "INT", "Failed to start PM operation on the given Moid list. rc [0x%x]", rc);
return rc;
}
The below code shows the Primary OI implementation for PM Read
{
ClUint32T i = 0;
clLogNotice("APP", "READ", "***Invoking read callback function***");
clLogNotice("APP", "READ", "INFO : MoId :");
clLogNotice(
"APP",
"READ",
"Attr Count : [%u]", pObjectData->
attrCount);
{
clLogNotice("APP", "READ", "--------------------");
clLogNotice(
"APP",
"READ",
"Attr Id : [%d]", pObjectData->
pAttrData[i].
attrId);
clLogNotice(
"APP",
"READ",
"Attr Size : [%u]", pObjectData->
pAttrData[i].
size);
clLogNotice(
"APP",
"READ",
"Attr Index : [%d]", pObjectData->
pAttrData[i].
index);
clLogNotice("APP", "READ", "Return value [%d]", i);
clLogNotice("APP", "READ", "--------------------");
}
}
The below code shows how to access the PM reset value. The user is supposed to reset all the PM attributes depending on the PM reset value.
{
clLogNotice("APP", "RESET", "***Invoking RESET callback function***");
clLogNotice("APP", "RESET", "--------------------");
clLogNotice("APP", "RESET", "INFO : MoId :");
clLogNotice(
"APP",
"RESET",
"Attr Id : [%d]", pObjectData->
pAttrData[0].
attrId);
clLogNotice(
"APP",
"RESET",
"Attr Size : [%u]", pObjectData->
pAttrData[0].
size);
clLogNotice(
"APP",
"RESET",
"Attr Index : [%d]", pObjectData->
pAttrData[0].
index);
clLogNotice(
"APP",
"RESET",
"Reset Value [%d]", *(ClInt8T *) pObjectData->
pAttrData[0].
pPMData);
clLogNotice("APP", "RESET", "--------------------");
}
The below code shows how to stop PM operation on a particular set of MoIds.
pMoIdList->moIdCnt = 2;
{
clLogError("APP", "RESET", "Failed to stop PM operation on the moId list. rc [0x%x]", rc);
return rc;
}