本文整理汇总了C++中saHpiRptEntryGet函数的典型用法代码示例。如果您正苦于以下问题:C++ saHpiRptEntryGet函数的具体用法?C++ saHpiRptEntryGet怎么用?C++ saHpiRptEntryGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saHpiRptEntryGet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: list_rpt
static
void list_rpt(SaHpiSessionIdT sessionid)
{
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
int rv;
rptentryid = SAHPI_FIRST_ENTRY;
rv = SA_OK;
while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) {
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
&rptentry);
if (rv != SA_OK) {
printf("Error getting RPT entry: rv = %d\n", rv);
}
printf("Resource Id: %d\n", rptentry.ResourceId);
printf("Resource Tag: %s\n", (char *)rptentry.ResourceTag.Data);
rptentryid = nextrptentryid;
}
}
示例2: list_all
SaErrorT list_all(SaHpiSessionIdT sessionid)
{
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
SaErrorT rv = SA_OK;
rptentryid = SAHPI_FIRST_ENTRY;
do {
if (fdebug) printf("saHpiRptEntryGet\n");
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,&rptentry);
if (rv != SA_OK) {
printf("Error getting RPT entry: rv = %s\n", oh_lookup_error(rv));
return (rv);
} else {
oh_print_rptentry(&rptentry, 2);
list_rdr(sessionid, rptentry.ResourceId);
list_inv(sessionid, rptentry.ResourceId);
list_sens(sessionid, rptentry.ResourceId);
list_ctrl(sessionid, rptentry.ResourceId);
list_wdog(sessionid, rptentry.ResourceId);
}
rptentryid = nextrptentryid;
} while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY));
return(rv);
}
示例3: list_rpt
SaErrorT list_rpt(SaHpiSessionIdT sessionid,SaHpiResourceIdT resourceid)
{
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
SaErrorT rv = SA_OK;
rptentryid = SAHPI_FIRST_ENTRY;
do {
if (fdebug) printf("saHpiRptEntryGet\n");
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,&rptentry);
if (rv != SA_OK) {
printf("Error getting RPT entry: rv = %s\n", oh_lookup_error(rv));
return (rv);
} else {
if (resourceid == 255)
oh_print_rptentry(&rptentry, 2);
else {
if (resourceid == rptentry.ResourceId) {
oh_print_rptentry(&rptentry, 2);
nextrptentryid = SAHPI_LAST_ENTRY;
}
}
}
rptentryid = nextrptentryid;
} while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY));
return(rv);
}
示例4: list_rdr
SaErrorT list_rdr(SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid)
{
SaErrorT rv = SA_OK,
rvRdrGet = SA_OK,
rvRptGet = SA_OK;
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
SaHpiEntryIdT entryid;
SaHpiEntryIdT nextentryid;
SaHpiRdrT rdr;
SaHpiResourceIdT l_resourceid;
SaHpiTextBufferT working;
oh_init_textbuffer(&working);
/* walk the RPT list */
rptentryid = SAHPI_FIRST_ENTRY;
do {
if (fdebug) printf("saHpiRptEntryGet\n");
rvRptGet = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry);
if ((rvRptGet != SA_OK) || fdebug)
printf("RptEntryGet returns %s\n",oh_lookup_error(rvRptGet));
if (rvRptGet == SA_OK
&& (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_RDR)
&& ((resourceid == 0xFF) || (resourceid == rptentry.ResourceId)))
{
l_resourceid = rptentry.ResourceId;
if (resourceid != 0xFF)
nextrptentryid = SAHPI_LAST_ENTRY;
/* walk the RDR list for this RPT entry */
entryid = SAHPI_FIRST_ENTRY;
if (fdebug) printf("rptentry[%d] resourceid=%d\n", entryid,resourceid);
do {
rvRdrGet = saHpiRdrGet(sessionid,l_resourceid, entryid,&nextentryid, &rdr);
if (fdebug) printf("saHpiRdrGet[%d] rv = %s\n",entryid,oh_lookup_error(rvRdrGet));
if (rvRdrGet == SA_OK)
{
snprintf(working.Data, SAHPI_MAX_TEXT_BUFFER_LENGTH,
"\nRdr for %s, ResourceId: %d\n",
rptentry.ResourceTag.Data,l_resourceid);
oh_print_text(&working);
oh_print_rdr(&rdr, 4);
}
entryid = nextentryid;
} while ((rvRdrGet == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ;
}
rptentryid = nextrptentryid;
} while ((rvRptGet == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY));
return(rv);
}
示例5: main
int main(int argc, char **argv)
{
SaHpiSessionIdT sid = 0;
SaHpiRptEntryT res;
SaHpiRdrT rdr;
SaHpiEntryIdT id = SAHPI_FIRST_ENTRY;
SaHpiResourceIdT resid;
int failcount = 0;
int testnum = 0;
SaErrorT rc = SA_OK;
rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
if(rc != SA_OK) {
failed("Failed to open session");
}
rc = saHpiDiscover(sid);
if(rc != SA_OK) {
failed("Failed to run discover");
}
rc = saHpiRptEntryGet(sid, id, &id, &res);
runtest();
if(rc != SA_OK) {
dbg("Error %s",oh_lookup_error(rc));
failed("Couldn't get the first rpt entry");
/* we're toast, bail */
goto end;
}
else{
id = SAHPI_FIRST_ENTRY;
resid = res.ResourceId;
rc = saHpiRdrGet(sid, resid, id, &id, &rdr);
if (oh_cmp_ep(&rdr.Entity,&res.ResourceEntity) != SAHPI_TRUE){
dbg("Error %s", oh_lookup_error(rc));
failed("Entity path of rdr did not match entity path of resource");
}
runtest();
if(rc != SA_OK){
dbg("Error %s", oh_lookup_error(rc));
failed("Couldn't get the first rdr entry");
goto end;
}
}
dbg("Ran %d tests", testnum);
/* if there is any failures, the test fails */
end:
if(failcount) {
return -1;
}
return(0);
}
示例6: get_event
static void* get_event(void *unused)
{
SaHpiEventT event;
SaErrorT rv;
SaHpiRptEntryT rptentry;
SaHpiRdrT rdr;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
rv = saHpiSubscribe(Domain->sessionId);
if (rv != SA_OK) {
printf("OpenHPI>Fail to Subscribe event\n");
return (void *)0;
}
while(1) {
for(;;) {
rdr.RdrType = SAHPI_NO_RECORD;
rptentry.ResourceId = 0;
memset(&event, 0xF, sizeof(event));
rv = saHpiEventGet(Domain->sessionId,
SAHPI_TIMEOUT_BLOCK, &event,
NULL, NULL, NULL);
if (rv != SA_OK ) {
printf("saHpiEventGet failed with error <%d>", rv);
break;
}
if (prt_flag == 1) {
if (show_event_short)
show_short_event(&event, ui_print);
else if (rdr.RdrType != SAHPI_NO_RECORD)
oh_print_event(&event, &rdr.Entity, 4);
else if (rptentry.ResourceId != 0)
oh_print_event(&event, &rptentry.ResourceEntity, 4);
else {
rptentryid = event.Source;
rv = saHpiRptEntryGet(Domain->sessionId,
rptentryid,
&nextrptentryid, &rptentry);
if(rv == SA_OK)
oh_print_event(&event, &rptentry.ResourceEntity, 4);
else {
printf("saHpiRptEntryGet failed for resource Id <%d> with error <%d>",
event.Source, rv);
printf("Wrong resource Id <%d> detected", event.Source);
oh_print_event(&event, NULL, 4);
}
}
}
}/*the loop for retrieving event*/
sleep(1);
}
return (void *)1;
}
示例7: get_resid
static SaHpiResourceIdT get_resid(SaHpiSessionIdT sid,
SaHpiEntryIdT srchid) {
SaHpiRptEntryT res;
SaHpiEntryIdT rptid = SAHPI_FIRST_ENTRY;
while(saHpiRptEntryGet(sid, rptid, &rptid, &res) == SA_OK) {
if (srchid == res.ResourceEntity.Entry[0].EntityType) {
return res.ResourceId;
}
}
return 0;
}
示例8: sa_list_sensor
static int sa_list_sensor(void)
{
SaErrorT rv = SA_OK;
SaHpiEntryIdT rptentryid;
SaHpiRptEntryT rptentry;
SaHpiEntryIdT nextrptentryid;
SaHpiEntryIdT entryid;
SaHpiEntryIdT nextentryid;
SaHpiResourceIdT resourceid;
SaHpiRdrT rdr;
SaHpiEntityPathT ep_target;
char *ep_string = NULL;
/* walk the RPT list */
rptentryid = SAHPI_FIRST_ENTRY;
while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY))
{
rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry);
if (rv == SA_OK) {
/* Walk the RDR list for this RPT entry */
/* Filter by entity path if specified */
if (ep_string && !oh_cmp_ep(&ep_target,&(rptentry.ResourceEntity))) {
rptentryid = nextrptentryid;
continue;
}
entryid = SAHPI_FIRST_ENTRY;
resourceid = rptentry.ResourceId;
rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0;
while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY))
{
rv = saHpiRdrGet(sessionid,resourceid,
entryid,&nextentryid, &rdr);
if (rv == SA_OK) {
if (rdr.RdrType == SAHPI_SENSOR_RDR &&
rdr.RdrTypeUnion.SensorRec.Ignore != TRUE) {
printf("Resource Id: %d, Sensor Id: %d\n",
resourceid, rdr.RdrTypeUnion.SensorRec.Num);
}
entryid = nextentryid;
} else {
rv = SA_OK;
entryid = SAHPI_LAST_ENTRY;
}
}
rptentryid = nextrptentryid;
}
}
return rv;
}
示例9: discover_resources
/*
* This function opens the HPI session, discovers the resources which matches
* the requested capability and sends the list of resource ids and resource
* names.
*
* If the none of the resources matches to requested capability,
* then SA_ERR_HPI_NOT_PRESENT error will be return.
* On sucess SA_OK will be return.
*/
SaErrorT discover_resources(SaHpiSessionIdT sessionid,
SaHpiCapabilitiesT capability,
SaHpiResourceIdT *resourceid_list,
int *number_resources)
{
int count=0;
SaErrorT rv;
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
rv = saHpiDiscover(sessionid);
if (rv != SA_OK) {
printf("saHpiDiscover failed with error: %s\n",
oh_lookup_error(rv));
return rv;
}
rptentryid = SAHPI_FIRST_ENTRY;
while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY))
{
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
&rptentry);
if (rv != SA_OK) {
printf("RptEntryGet failed with error: %s\n",
oh_lookup_error(rv));
return rv;
}
if (rptentry.ResourceCapabilities & capability) {
resourceid_list[count] = rptentry.ResourceId;
printf("\tResource-id = %d, Resource Name = %s\n",
rptentry.ResourceId, rptentry.ResourceTag.Data);
if (strcmp(rptentry.ResourceTag.Data,
"Power Subsystem") == 0)
powerSubsystemResId = rptentry.ResourceId;
count++;
}
rptentryid = nextrptentryid;
}
if (count == 0)
return SA_ERR_HPI_NOT_PRESENT;
*number_resources = count;
return SA_OK;
}
示例10: main
int main(int argc, char **argv)
{
SaHpiSessionIdT sid = 0;
SaHpiRptEntryT res;
SaHpiEntryIdT id = SAHPI_FIRST_ENTRY;
int failcount = 0;
int testnum = 0;
SaErrorT rc = SA_OK;
rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
if(rc != SA_OK) {
failed("Failed to open session");
}
rc = saHpiDiscover(sid);
if(rc != SA_OK) {
failed("Failed to run discover");
}
/* loop over all resources, ensure that ResourceTag and
* ManufacturerId have been set */
while(saHpiRptEntryGet(sid,id,&id,&res) == SA_OK) {
runtest();
if(!res.ResourceTag.DataLength) {
failed("Resource Tag has zero length");
}
runtest();
if(!res.ResourceInfo.ManufacturerId) {
failed("Resource has no Manufacturer Id");
}
/* there should be an inner loop here for Rdrs */
}
printf("I hit here\n");
dbg("Ran %d tests", testnum);
/* if there is any failures, the test fails */
if(failcount) {
return -1;
}
return(0);
}
示例11: get_rpts
static void get_rpts(void)
{
SaHpiEntryIdT rptentryid, nextrptentryid;
SaErrorT rv;
SaHpiRptEntryT rptentry;
int n;
rptentryid = SAHPI_FIRST_ENTRY;
while (rptentryid != SAHPI_LAST_ENTRY) {
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid, &rptentry);
if (rv != SA_OK)
break;
n = nrpts;
Rpts = (Rpt_t *)resize_array(Rpts, sizeof(Rpt_t), &nrpts, 1);
rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0;
Rpts[n].Rpt = rptentry;
rptentryid = nextrptentryid;
}
}
示例12: sensor_list
SaErrorT sensor_list(SaHpiSessionIdT sessionid, hpi_ui_print_cb_t proc)
{
SaErrorT rv = SA_OK;
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
/* walk the RPT list */
rptentryid = SAHPI_FIRST_ENTRY;
while (rptentryid != SAHPI_LAST_ENTRY) {
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid, &rptentry);
if (rv != SA_OK)
break;
rv = show_sensor_list(sessionid, rptentry.ResourceId, proc);
if (rv == -1)
return(-1);
rptentryid = nextrptentryid;
};
return(rv);
}
示例13: Test_Resource
int Test_Resource(SaHpiSessionIdT session)
{
SaErrorT status;
int retval = SAF_TEST_UNKNOWN;
SaHpiEntryIdT RptNextEntry;
SaHpiRptEntryT Report;
//
// Obtain a ResourceId
//
status = saHpiRptEntryGet(session,
SAHPI_FIRST_ENTRY, &RptNextEntry, &Report);
if (status != SA_OK) {
if (status == SA_ERR_HPI_NOT_PRESENT) {
retval = SAF_TEST_NOTSUPPORT;
} else {
e_print(saHpiRptEntryGet, SA_OK, status);
retval = SAF_TEST_UNRESOLVED;
}
} else {
//
// Call saHpiResourceSeveritySet while passing in an invalid
// session id
//
status = saHpiResourceSeveritySet(INVALID_SESSION_ID,
Report.ResourceId, SAHPI_OK);
if (status == SA_ERR_HPI_INVALID_SESSION)
retval = SAF_TEST_PASS;
else {
e_print(saHpiResourceSeveritySet,
SA_ERR_HPI_INVALID_SESSION, status);
retval = SAF_TEST_FAIL;
}
}
return (retval);
}
示例14: set_resource_tag
int set_resource_tag(SaHpiSessionIdT sessionid)
{
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
SaHpiTextBufferT new_resource_tag;
SaHpiTextBufferT old_resource_tag;
int rv;
SaHpiResourceIdT resource_id;
char id_buf[SAHPI_MAX_TEXT_BUFFER_LENGTH], *res_id;
char tag_buf[SAHPI_MAX_TEXT_BUFFER_LENGTH], *res_tag;
rptentryid = SAHPI_FIRST_ENTRY;
rv = SA_OK;
while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) {
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
&rptentry);
if (rv != SA_OK) {
printf("Error getting RPT entry: rv = %d\n", rv);
return (-1);
}
printf("Resource Id: %d\n", rptentry.ResourceId);
printf("Resource Tag: %s\n", (char *)rptentry.ResourceTag.Data);
rptentryid = nextrptentryid;
}
res_id = NULL;
res_tag = NULL;
printf("\nResource Id to change: ");
res_id = fgets(id_buf, 255, stdin);
if ((res_id = strchr(id_buf, '\n')) != NULL)
*res_id = '\0';
resource_id = (SaHpiResourceIdT) atoi(id_buf);
printf("New Resource Tag: ");
res_tag = fgets(tag_buf, SAHPI_MAX_TEXT_BUFFER_LENGTH, stdin);
if ((res_tag = strchr(tag_buf, '\n')) != NULL)
*res_tag = '\0';
rv = saHpiRptEntryGetByResourceId(sessionid, resource_id, &rptentry);
if (rv != SA_OK) {
printf("Erro getting RPT entry for resource: %d\n",
resource_id);
return (-1);
}
if (rptentry.ResourceEntity.Entry[0].EntityType == SAHPI_ENT_SYS_MGMNT_MODULE) {
printf("On some systems, changing the Tag is no allowed\n");
printf("for System Management Modules\n");
printf("Failed to change tag for resource: %d\n", resource_id);
return(1);
}
old_resource_tag = rptentry.ResourceTag;
new_resource_tag.DataType = SAHPI_TL_TYPE_ASCII6;
new_resource_tag.Language = SAHPI_LANG_ENGLISH;
new_resource_tag.DataLength = strlen(tag_buf);
memcpy(new_resource_tag.Data, tag_buf, strlen(tag_buf) + 1);
rv = saHpiResourceTagSet(sessionid, resource_id, &new_resource_tag);
if (rv != SA_OK) {
printf("Erro setting custom tag for resource: %d\n",
resource_id);
return -1;
}
memset(&rptentry, 0, 0);
rv = saHpiRptEntryGetByResourceId(sessionid, resource_id, &rptentry);
if (rv != SA_OK) {
printf("Erro getting RPT entry for resource: %d\n",
resource_id);
return (-1);
} else {
printf("Old resource Tag was: %s, new Tag: %s\n",
(char *)old_resource_tag.Data,
(char *)rptentry.ResourceTag.Data);
}
return 0;
}
示例15: main
int main(int argc, char **argv)
{
int c;
SaErrorT rv;
SaErrorT rvx;
SaHpiVersionT hpiVer;
SaHpiSessionIdT sessionid;
SaHpiRptInfoT rptinfo;
SaHpiRptEntryT rptentry;
SaHpiEntryIdT rptentryid;
SaHpiEntryIdT nextrptentryid;
SaHpiResourceIdT resourceid;
char input[255], *p;
pthread_t discover_thread;
void *thread_done;
int valid = 0;
printf("%s ver %s\n", argv[0], progver);
while ((c = getopt(argc, argv, "x?")) != EOF) {
switch (c) {
case 'x':
debug = 1;
break;
default:
printf("Usage: %s [-x]\n", progname);
printf(" -x Display debug messages\n");
exit(1);
}
}
rv = saHpiInitialize(&hpiVer);
if (rv != SA_OK) {
printf("saHpiInitialize error %d\n", rv);
exit(-1);
}
rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID, &sessionid, NULL);
if (rv != SA_OK) {
printf("saHpiSessionOpen error %d\n", rv);
exit(-1);
}
rv = saHpiResourcesDiscover(sessionid);
if (debug)
printf("saHpiResourcesDiscover rv = %d\n", rv);
restart:
rv = saHpiRptInfoGet(sessionid, &rptinfo);
if (debug)
printf("saHpiRptInfoGet rv = %d\n", rv);
printf("RptInfo: UpdateCount = %d, UpdateTime = %lx\n",
rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp);
/* walk the RPT list */
rptentryid = SAHPI_FIRST_ENTRY;
rvx = SA_OK;
while ((rvx == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) {
rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
&rptentry);
if (rvx != SA_OK)
printf("RptEntryGet: rv = %d\n", rv);
if (rvx == SA_OK && (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_RDR)
&& (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_INVENTORY_DATA)) {
resourceid = rptentry.ResourceId;
list_inv(sessionid, resourceid);
}
rptentryid = nextrptentryid;
}
printf("Initial discovery done\n");
printf("\tEnter a command or \"help\" for list of commands\n");
printf("Command> ");
rv = pthread_create(&discover_thread, NULL, sahpi_discover_thread,
(void *)sessionid);
if (rv)
printf("Error creating event thread\n");
while (!valid) {
fflush(stdout);
p = fgets(input, 255, stdin);
if ((p = strchr(input, '\n')) != NULL)
*p = '\0';
if (!strcmp(input, "list_all_inv")) {
//.........这里部分代码省略.........