• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ saHpiRdrGet函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中saHpiRdrGet函数的典型用法代码示例。如果您正苦于以下问题:C++ saHpiRdrGet函数的具体用法?C++ saHpiRdrGet怎么用?C++ saHpiRdrGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了saHpiRdrGet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: show_sensor_list

Pr_ret_t show_sensor_list(SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid,
		hpi_ui_print_cb_t proc)
{
	SaErrorT	rv = SA_OK;
	SaHpiEntryIdT	entryid;
	SaHpiEntryIdT	nextentryid;
	SaHpiRdrT	rdr;
	char		buf[SHOW_BUF_SZ];

	entryid = SAHPI_FIRST_ENTRY;
	while (entryid != SAHPI_LAST_ENTRY) {
		rv = saHpiRdrGet(sessionid, resourceid, entryid, &nextentryid, &rdr);
		if (rv != SA_OK)
			break;
		if (rdr.RdrType == SAHPI_SENSOR_RDR) {
			snprintf(buf, 256, "Resource Id: %d, Sensor Num: %d",
				resourceid, rdr.RdrTypeUnion.SensorRec.Num);
			if (proc(buf) != 0) return(HPI_UI_END);
			if (print_text_buffer_text(" Tag: ", &(rdr.IdString),
				NULL, proc) != 0)
				return(-1);
			if (proc("\n") != 0) return(HPI_UI_END);
		};
		entryid = nextentryid;
	};
	return(HPI_UI_OK);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:27,代码来源:show.c


示例2: Test_Resource

int Test_Resource(SaHpiSessionIdT session_id, SaHpiRptEntryT rpt_entry,
		  callback2_t func)
{
	SaHpiResourceIdT resource_id = rpt_entry.ResourceId;
	SaHpiEntryIdT next_rdr;
	SaErrorT val;
	SaHpiRdrT rdr;
	int ret = SAF_TEST_UNKNOWN;

	if (rpt_entry.ResourceCapabilities & SAHPI_CAPABILITY_RDR) {
		val =
		    saHpiRdrGet(INVALID_SESSION_ID, resource_id,
				SAHPI_FIRST_ENTRY, &next_rdr, &rdr);

		if (val != SA_ERR_HPI_INVALID_SESSION) {
			e_print(saHpiRdrGet, SA_ERR_HPI_INVALID_SESSION, val);
			ret = SAF_TEST_FAIL;
		} else {
			ret = SAF_TEST_PASS_AND_EXIT;
		}
	} else
		ret = SAF_TEST_NOTSUPPORT;

	return ret;
}
开发者ID:basheerk,项目名称:autotest-client-tests,代码行数:25,代码来源:2.c


示例3: 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);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:59,代码来源:hpitree.c


示例4: 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);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:54,代码来源:sim_sanity_005.c


示例5: find_rdr_by_num

SaErrorT find_rdr_by_num(SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid,
                         SaHpiInstrumentIdT num, SaHpiRdrTypeT type, int as,
                         SaHpiRdrT *retrdr)
//as : 0 - get rdr by num
//     1 - get first rdr
{
    SaHpiRdrT		rdr;
    SaErrorT		rv;
    SaHpiEntryIdT		entryid;
    SaHpiEntryIdT		nextentryid;
    SaHpiInstrumentIdT	rdrnum;

    entryid = SAHPI_FIRST_ENTRY;
    while (entryid !=SAHPI_LAST_ENTRY) {
        rv = saHpiRdrGet(sessionid, resourceid, entryid, &nextentryid, &rdr);
        if (rv != SA_OK) return(-1);
        if ((type != SAHPI_NO_RECORD) && (rdr.RdrType != type))
            continue;
        switch (rdr.RdrType) {
        case SAHPI_CTRL_RDR:
            rdrnum = rdr.RdrTypeUnion.CtrlRec.Num;
            break;
        case SAHPI_SENSOR_RDR:
            rdrnum = rdr.RdrTypeUnion.SensorRec.Num;
            break;
        case SAHPI_INVENTORY_RDR:
            rdrnum = rdr.RdrTypeUnion.InventoryRec.IdrId;
            break;
        case SAHPI_WATCHDOG_RDR:
            rdrnum = rdr.RdrTypeUnion.WatchdogRec.WatchdogNum;
            break;
        case SAHPI_ANNUNCIATOR_RDR:
            rdrnum = rdr.RdrTypeUnion.AnnunciatorRec.AnnunciatorNum;
            break;
        case SAHPI_DIMI_RDR:
            rdrnum = rdr.RdrTypeUnion.DimiRec.DimiNum;
            break;
        case SAHPI_FUMI_RDR:
            rdrnum = rdr.RdrTypeUnion.FumiRec.Num;
            break;
        default:
            entryid = nextentryid;
            continue;
        };
        if ((rdrnum == num) || as) {
            *retrdr = rdr;
            return(SA_OK);
        };
        entryid = nextentryid;
    };
    return(-1);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:52,代码来源:service.c


示例6: 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;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:52,代码来源:commands.c


示例7: get_sensor_num

static int
get_sensor_num(SaHpiSessionIdT ohsession, SaHpiResourceIdT ohresid)
{
	SaErrorT	ohrc = SA_OK;
	SaHpiEntryIdT	ohnextid;
	SaHpiRdrT	ohRDR;

	ohnextid = SAHPI_FIRST_ENTRY;
	do {
		ohrc = saHpiRdrGet(ohsession, ohresid, ohnextid
				, &ohnextid, &ohRDR);
		if (ohrc != SA_OK) {
			LOG(PIL_CRIT, "Unable to get RDR entry in %s (%d)"
			,	__FUNCTION__, ohrc);
		} else if (ohRDR.RdrType == SAHPI_SENSOR_RDR) {
			return ohRDR.RdrTypeUnion.SensorRec.Num;
		}
	} while (ohrc == SA_OK && ohnextid != SAHPI_LAST_ENTRY);

	return 0;
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:21,代码来源:bladehpi.c


示例8: get_rdrs

static void get_rdrs(Rpt_t *Rpt)
{
	SaHpiRdrT		rdr;
	SaErrorT		rv;
	int			n;
	SaHpiEntryIdT		entryid;
	SaHpiEntryIdT		nextentryid;
	SaHpiResourceIdT	resourceid;

	entryid = SAHPI_FIRST_ENTRY;
	while (entryid !=SAHPI_LAST_ENTRY) {
		resourceid = Rpt->Rpt.ResourceId;
		rv = saHpiRdrGet(sessionid, resourceid, entryid, &nextentryid, &rdr);
		if (rv != SA_OK)
			break;
		n = Rpt->nrdrs;
		Rpt->rdrs = (Rdr_t *)resize_array(Rpt->rdrs, sizeof(Rdr_t), &(Rpt->nrdrs), 1);
		rdr.IdString.Data[rdr.IdString.DataLength] = 0;
		Rpt->rdrs[n].Rdr = rdr;
		entryid = nextentryid;
	}
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:22,代码来源:hpithres.c


示例9: testResource

int testResource(SaHpiSessionIdT sessionId, SaHpiResourceIdT resourceId) {
     int retval = SAF_TEST_NOTSUPPORT;
     int response;
     SaErrorT error;
     SaHpiEntryIdT nextEntryId;
     SaHpiEntryIdT entryId;
     SaHpiRdrT rdr;
     SaHpiBoolT pass = SAHPI_FALSE;

     nextEntryId = SAHPI_FIRST_ENTRY;
     while (nextEntryId != SAHPI_LAST_ENTRY && retval == SAF_TEST_NOTSUPPORT) {
          entryId = nextEntryId;
          error = saHpiRdrGet(sessionId, resourceId, entryId, &nextEntryId, &rdr);
          if (error == SA_ERR_HPI_NOT_PRESENT) {
              break;
          } else if (error != SA_OK) {
              retval = SAF_TEST_UNRESOLVED;
              e_print(saHpiRdrGet, SA_OK, error);
          } else {
              response = canTest(sessionId, resourceId, &rdr);
              if (response != SAF_TEST_PASS) {
                   retval = response;
              } else {
                   response = testSensor(sessionId, resourceId, &rdr);
                   if (response == SAF_TEST_PASS) {
                       pass = SAHPI_TRUE;
                   } else {
                       retval = response;
                   }
              }
          }
     }

     if (retval == SAF_TEST_NOTSUPPORT && pass) {
         retval = SAF_TEST_PASS;
     }

     return retval;
}
开发者ID:basheerk,项目名称:autotest-client-tests,代码行数:39,代码来源:9.c


示例10: list_rdr

void list_rdr(SaHpiSessionIdT session_id, SaHpiResourceIdT resource_id)
{
        SaErrorT        err;
	SaHpiEntryIdT	current_rdr;
	SaHpiEntryIdT	next_rdr;
	SaHpiRdrT	rdr;

	printf("RDR Info:\n");
	next_rdr = SAHPI_FIRST_ENTRY;
	do {
		int i;
		current_rdr = next_rdr;
		err = saHpiRdrGet(session_id, resource_id, current_rdr, 
				&next_rdr, &rdr);
		if (SA_OK != err) {
			if (current_rdr == SAHPI_FIRST_ENTRY)
				printf("Empty RDR table\n");
			else
				error("saHpiRdrGet", err);
			return;			
		}
		
		printf("\tRecordId: %x\n", rdr.RecordId);
		printf("\tRdrType: %s\n", rdrtype2str(rdr.RdrType));
		printf("\tEntity: \n");
		for ( i=0; i<SAHPI_MAX_ENTITY_PATH; i++)
		{
			SaHpiEntityT tmp = rdr.Entity.Entry[i];
			if (tmp.EntityType <= SAHPI_ENT_UNSPECIFIED)
				break;
				printf("\t\t{%s, %i}\n", 
				type2string(tmp.EntityType),
				tmp.EntityInstance);
		}
		printf("\tIdString: ");
	       	display_id_string(rdr.IdString);
	}while(next_rdr != SAHPI_LAST_ENTRY);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:38,代码来源:list_resources.c


示例11: show_sensor_list

SaErrorT show_sensor_list(SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid,
		hpi_ui_print_cb_t proc)
{
	SaErrorT	rv = SA_OK;
	SaHpiEntryIdT	entryid;
	SaHpiEntryIdT	nextentryid;
	SaHpiRdrT	rdr;
	char		buf[256];

	entryid = SAHPI_FIRST_ENTRY;
	while (entryid != SAHPI_LAST_ENTRY) {
		rv = saHpiRdrGet(sessionid, resourceid, entryid, &nextentryid, &rdr);
		if (rv != SA_OK)
			break;
		if (rdr.RdrType == SAHPI_SENSOR_RDR) {
			snprintf(buf, 256, "Resource Id: %d, Sensor Num: %d\n",
				resourceid, rdr.RdrTypeUnion.SensorRec.Num);
			if (proc(buf) != 0)
				return(-1);
		};
		entryid = nextentryid;
	};
	return(rv);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:24,代码来源:show.c


示例12: main

int main(int argc, char **argv) 
{

	/* ************************
	 * Local variables
	 * ***********************/	 
	int testfail = 0;
	SaErrorT          err;
	SaErrorT expected_err;
        SaHpiRptEntryT rptentry;
	SaHpiResourceIdT  id;
        SaHpiSessionIdT sessionid;
	SaHpiRdrT	rdr;
	SaHpiCtrlNumT cid = 1;
	SaHpiCtrlModeT mode;
	SaHpiCtrlStateT state;
													   
	/* *************************************	 	 
	 * Find a resource with Control type rdr
	 * ************************************* */
	err = tsetup(&sessionid);
	if (err != SA_OK) {
		printf("Error! Can not open session for test environment\n");
		printf("       File=%s, Line=%d\n", __FILE__, __LINE__);
		return -1;
	}
	err = tfind_resource(&sessionid, SAHPI_CAPABILITY_CONTROL, SAHPI_FIRST_ENTRY, &rptentry, SAHPI_TRUE);
	if (err != SA_OK) {
		printf("Can not find a control resource for test environment\n");
		printf("       File=%s, Line=%d\n", __FILE__, __LINE__);
		err = tcleanup(&sessionid);
		return SA_OK;
	}
	
	id = rptentry.ResourceId;
	/************************** 
	 * Test: find a control RDR
	 **************************/
	SaHpiEntryIdT entryid = SAHPI_FIRST_ENTRY;
	SaHpiEntryIdT nextentryid;
	SaHpiBoolT foundControl = SAHPI_FALSE;			
	do {
		err = saHpiRdrGet(sessionid,id,entryid,&nextentryid, &rdr);
		if (err == SA_OK)
		{
			if (rdr.RdrType == SAHPI_CTRL_RDR) 
			{
				foundControl = SAHPI_TRUE;
				break;
														
			}
			entryid = nextentryid;
		}
	} while ((err == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ;

	if (!foundControl) {
		dbg("Did not find desired resource for test\n");
		return(SA_OK);
	} else {
		cid = rdr.RdrTypeUnion.CtrlRec.Num; 
	}	

	/************************** 
	 * Test 1: Invalid Handle    
	 *************************/
	struct oh_handler_state l_handle;
	memset(&l_handle, 0, sizeof(struct oh_handler_state));
	expected_err = SA_ERR_HPI_INVALID_PARAMS;
	err = snmp_bc_get_control_state(NULL, id, cid, &mode, &state);
	checkstatus(err, expected_err, testfail);
	
	/************************** 
	 * Test 2: Resource ID with no RPT
	 *************************/
	expected_err = SA_ERR_HPI_INVALID_RESOURCE;
	err = saHpiControlGet(sessionid, 5000, cid, &mode, &state);
	checkstatus(err, expected_err, testfail);
	
	/************************** 
	 * Test 3: Control ID with no RDR 
	 *************************/
	expected_err = SA_ERR_HPI_NOT_PRESENT;
	err = saHpiControlGet(sessionid, id, 5000, &mode, &state);
	checkstatus(err, expected_err, testfail);
	
	/************************** 
	 * Test 4: NULL mode and state    
	 *************************/
	expected_err = SA_OK;
	err = saHpiControlGet(sessionid, id, cid, NULL, NULL);
	checkstatus(err, expected_err, testfail);
	
	/************************** 
	 * Test: resource without SAHPI_CAPABILITY_CONTROL    
	 *************************/
	err = tfind_resource(&sessionid, SAHPI_CAPABILITY_CONTROL, SAHPI_FIRST_ENTRY, &rptentry, SAHPI_FALSE);
	if (err != SA_OK) {
		printf("Error! Can not find resources for test environment\n");
		printf("       File=%s, Line=%d\n", __FILE__, __LINE__);
		err = tcleanup(&sessionid);
//.........这里部分代码省略.........
开发者ID:openhpi1,项目名称:testrepo,代码行数:101,代码来源:tcontrol001.c


示例13: sa_show_inv

static ret_code_t sa_show_inv(SaHpiResourceIdT resourceid)
{
	SaErrorT		rv = SA_OK, rva, rvf;
	SaHpiEntryIdT		rdrentryid;
	SaHpiEntryIdT		nextrdrentryid;
	SaHpiRdrT		rdr;
	SaHpiIdrIdT		idrid;
	SaHpiIdrInfoT		idrInfo;
	SaHpiEntryIdT		areaId;
	SaHpiEntryIdT		nextareaId;
	SaHpiIdrAreaTypeT	areaType;
	int			numAreas;
	SaHpiEntryIdT		fieldId;
	SaHpiEntryIdT		nextFieldId;
	SaHpiIdrFieldTypeT	fieldType;
	SaHpiIdrFieldT		thisField;
	SaHpiIdrAreaHeaderT	areaHeader;

	rdrentryid = SAHPI_FIRST_ENTRY;
	while (rdrentryid != SAHPI_LAST_ENTRY) {
		rv = saHpiRdrGet(Domain->sessionId, resourceid, rdrentryid,
			&nextrdrentryid, &rdr);
		if (rv != SA_OK) {
			printf("saHpiRdrGet error %s\n", oh_lookup_error(rv));
			return HPI_SHELL_CMD_ERROR;
		}

		if (rdr.RdrType != SAHPI_INVENTORY_RDR) {
			rdrentryid = nextrdrentryid;
			continue;
		};
		
		idrid = rdr.RdrTypeUnion.InventoryRec.IdrId;
		rv = saHpiIdrInfoGet(Domain->sessionId, resourceid, idrid, &idrInfo);
		if (rv != SA_OK) {
			printf("saHpiIdrInfoGet error %s\n", oh_lookup_error(rv));
			return HPI_SHELL_CMD_ERROR;
		}
		
		numAreas = idrInfo.NumAreas;
		areaType = SAHPI_IDR_AREATYPE_UNSPECIFIED;
		areaId = SAHPI_FIRST_ENTRY; 
		while (areaId != SAHPI_LAST_ENTRY) {
			rva = saHpiIdrAreaHeaderGet(Domain->sessionId, resourceid,
				idrInfo.IdrId, areaType, areaId, &nextareaId,
				&areaHeader);
			if (rva != SA_OK) {
				printf("saHpiIdrAreaHeaderGet error %s\n",
					oh_lookup_error(rva));
				break;
			}
			show_inv_area_header(&areaHeader, 2, ui_print);

			fieldType = SAHPI_IDR_FIELDTYPE_UNSPECIFIED;
			fieldId = SAHPI_FIRST_ENTRY;
			while (fieldId != SAHPI_LAST_ENTRY) {
				rvf = saHpiIdrFieldGet(Domain->sessionId, resourceid,
						idrInfo.IdrId, areaHeader.AreaId, 
						fieldType, fieldId, &nextFieldId,
						&thisField);
				if (rvf != SA_OK) {
					printf("saHpiIdrFieldGet error %s\n",
						oh_lookup_error(rvf));
					break;
				}
				show_inv_field(&thisField, 4, ui_print);
				fieldId = nextFieldId;
			}
			areaId = nextareaId;
		}
		rdrentryid = nextrdrentryid;
	}
	return HPI_SHELL_OK;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:74,代码来源:ctrl_inv.c


示例14: main

int main(int argc, char **argv) 
{

	/* ************************
	 * Local variables
	 * ***********************/	 
	int testfail = 0;
	SaErrorT          err;
	SaErrorT expected_err;

	SaHpiResourceIdT  id;
        SaHpiSessionIdT sessionid;
        SaHpiRptEntryT    rptentry;
	SaHpiRdrT         rdr;
	SaHpiSensorNumT   dd_sid = 0;
	SaHpiEventStateT state;
	SaHpiSensorReadingT reading;
	SaHpiEntryIdT entryid;
	SaHpiEntryIdT nextentryid;
	SaHpiBoolT foundSensor;			
													    
	/* *************************************	 	 
	 * Find a resource with Sensor type rdr
	 * ************************************* */
	err = tsetup(&sessionid);
	if (err != SA_OK) {
		printf("Error! Can not open session for test environment\n");
		printf("      File=%s, Line=%d\n", __FILE__, __LINE__);
		return -1;

	}
	err = tfind_resource(&sessionid,SAHPI_CAPABILITY_SENSOR,SAHPI_FIRST_ENTRY, &rptentry, SAHPI_TRUE);
	if (err != SA_OK) {
		printf("Error! Can not find resources for test environment\n");
		printf("      File=%s, Line=%d\n", __FILE__, __LINE__);
		err = tcleanup(&sessionid);
		return -1;
	}

	id = rptentry.ResourceId;
	/************************** 
	 * Test: find a sensor with desired property
	 **************************/
	entryid = SAHPI_FIRST_ENTRY;
	foundSensor = SAHPI_FALSE;			
	do {
		err = saHpiRdrGet(sessionid,id,entryid,&nextentryid, &rdr);
		if (err == SA_OK)
		{
			if ((rdr.RdrType == SAHPI_SENSOR_RDR) &&
				(rdr.RdrTypeUnion.SensorRec.DataFormat.IsSupported == SAHPI_TRUE))
			{
				foundSensor = SAHPI_TRUE;
				break;
														
			}
			entryid = nextentryid;
		}
	} while ((err == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ;

	if (!foundSensor) {
		err("Did not find desired resource for test\n");
		return(SA_OK);
	} else {
		dd_sid = rdr.RdrTypeUnion.SensorRec.Num; 
	}	

	/************************** 
	 * Test : Read sensor with NULL Reading area. State only 
	 **************************/
	expected_err = SA_OK;                   
	err = saHpiSensorReadingGet(sessionid, id, dd_sid, NULL, &state);
	checkstatus(err, expected_err, testfail);

	/************************** 
	 * Test:Read with NULL State area, Read Value only 
	 **************************/
	err = saHpiSensorReadingGet(sessionid, id, dd_sid, &reading, NULL);
	checkstatus(err, expected_err, testfail);

	/************************** 
	 * Test: Both Reading and State are NULL. ie checking for sensor existance
	 **************************/
	err = saHpiSensorReadingGet(sessionid, id, dd_sid, NULL, NULL);
	checkstatus(err, expected_err, testfail);
	
	/***************************
	 * Cleanup after all tests
	 ***************************/
	 err = tcleanup(&sessionid);
	 return testfail;

}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:93,代码来源:tsensorget013.c


示例15: show_rdr_list

int show_rdr_list(Domain_t *domain, SaHpiResourceIdT rptid, SaHpiRdrTypeT passed_type,
	hpi_ui_print_cb_t proc)
//  return: list size
{
	SaHpiRdrT		rdr;
	SaHpiEntryIdT		entryid;
	SaHpiEntryIdT		nextentryid;
	char			buf[SHOW_BUF_SZ];
	SaHpiRdrTypeT		type;
	char			ar[256];
	SaHpiSensorRecT		*sensor;
	SaHpiCtrlRecT		*ctrl;
	SaHpiInventoryRecT	*inv;
	SaHpiWatchdogRecT	*wdog;
	SaHpiAnnunciatorRecT	*ann;
	SaErrorT		ret;
	int			res_num = 0;

	entryid = SAHPI_FIRST_ENTRY;
	while (entryid !=SAHPI_LAST_ENTRY) {
		ret = saHpiRdrGet(domain->sessionId, rptid, entryid,
			&nextentryid, &rdr);
		if (ret != SA_OK)
			return(res_num);
		type = rdr.RdrType;
		if ((passed_type != SAHPI_NO_RECORD) && (type != passed_type)) {
			entryid = nextentryid;
			continue;
		};
		snprintf(buf, SHOW_BUF_SZ, "  (%d):%s NUM=", rdr.RecordId,
			oh_lookup_rdrtype(type));
		switch (type) {
			case SAHPI_SENSOR_RDR:
				sensor = &(rdr.RdrTypeUnion.SensorRec);
				snprintf(ar, 256, "%3.3d Ctrl=%d EvtCtrl=",
					sensor->Num, sensor->EnableCtrl);
				switch (sensor->EventCtrl) {
					case SAHPI_SEC_PER_EVENT:
						strcat(ar, "WR"); break;
					case SAHPI_SEC_READ_ONLY_MASKS:
						strcat(ar, "RM"); break;
					default:
						strcat(ar, "RO"); break;
				};
				break;
			case SAHPI_CTRL_RDR:
				ctrl = &(rdr.RdrTypeUnion.CtrlRec);
				snprintf(ar, 256, "%3.3d", ctrl->Num);
				break;
			case SAHPI_INVENTORY_RDR:
				inv = &(rdr.RdrTypeUnion.InventoryRec);
				snprintf(ar, 256, "%3.3d", inv->IdrId);
				break;
			case SAHPI_WATCHDOG_RDR:
				wdog = &(rdr.RdrTypeUnion.WatchdogRec);
				snprintf(ar, 256, "%3.3d", wdog->WatchdogNum);
				break;
			case SAHPI_ANNUNCIATOR_RDR:
				ann = &(rdr.RdrTypeUnion.AnnunciatorRec);
				snprintf(ar, 256, "%3.3d", ann->AnnunciatorNum);
				break;
			default:
				snprintf(ar, 256, "%c", '?');
		};
		strcat(buf, ar);
		res_num++;
		if (proc(buf) != HPI_UI_OK) return(res_num);
		if (print_text_buffer_text(" Tag=", &(rdr.IdString),
			"\n", proc) != HPI_UI_OK)
			return(res_num);
		entryid = nextentryid;
	};
	return(res_num);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:74,代码来源:show.c


示例16: main

int main(int argc, char **argv)
{

    /* ************************
     * Local variables
     * ***********************/
    int testfail = 0;
    SaErrorT          err;
    SaErrorT expected_err;
    SaHpiRptEntryT rptentry;
    SaHpiRdrT	rdr;
    SaHpiResourceIdT  id = 0;
    SaHpiSessionIdT   sessionid;
    SaHpiIdrIdT       idrId = 0;
    SaHpiIdrInfoT	  info;
    SaHpiEntryIdT entryid;
    SaHpiEntryIdT nextentryid;
    SaHpiBoolT foundControl;

    /* *************************************
     * Find a resource with inventory capability
     * ************************************* */
    err = tsetup(&sessionid);
    if (err != SA_OK) {
        printf("Error! Can not open session for test environment\n");
        printf("       File=%s, Line=%d\n", __FILE__, __LINE__);
        return -1;
    }

    err = tfind_resource(&sessionid, SAHPI_CAPABILITY_INVENTORY_DATA, SAHPI_FIRST_ENTRY, &rptentry, SAHPI_TRUE);
    if (err != SA_OK) {
        printf("Can not find an Inventory resource for test environment\n");
        printf("       File=%s, Line=%d\n", __FILE__, __LINE__);
        err = tcleanup(&sessionid);
        return SA_OK;
    }
    id = rptentry.ResourceId;

    /**************************
     * Test: find an Inventory RDR
     **************************/
    entryid = SAHPI_FIRST_ENTRY;
    foundControl = SAHPI_FALSE;
    do {
        err = saHpiRdrGet(sessionid,id,entryid,&nextentryid, &rdr);
        if (err == SA_OK)
        {
            if (rdr.RdrType == SAHPI_INVENTORY_RDR)
            {
                foundControl = SAHPI_TRUE;
                break;

            }
            entryid = nextentryid;
        }
    } while ((err == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ;

    if (!foundControl) {
        dbg("Did not find desired resource for test\n");
        return(SA_OK);
    } else {
        idrId = rdr.RdrTypeUnion.InventoryRec.IdrId;
    }

    /**************************
     * Test : Invalid handle
     **************************/
    expected_err = SA_ERR_HPI_INVALID_PARAMS;
    err = snmp_bc_get_idr_info(NULL , id, idrId, &info);
    checkstatus(err, expected_err, testfail);

    /**************************
     * Test : Invalid info pointer
     * expected_err = SA_ERR_HPI_INVALID_PARAMS;
     **************************/
    err = saHpiIdrInfoGet(sessionid, id, idrId, NULL);
    checkstatus(err, expected_err, testfail);

    /**************************&*
     * Cleanup after all tests
     ***************************/
    err = tcleanup(&sessionid);
    return testfail;

}
开发者ID:openhpi1,项目名称:testrepo,代码行数:85,代码来源:tinv006.c


示例17: main

int main(int argc, char **argv) 
{

	/* ************************
	 * Local variables
	 * ***********************/	 
	int testfail = 0;
	SaErrorT          err;
	SaErrorT expected_err;
	SaHpiResourceIdT  id = 0;
        SaHpiSessionIdT sessionid;
	SaHpiRptEntryT rptentry;
	SaHpiRdrT	rdr;	 
	SaHpiSensorNumT sid = 0;
	SaHpiSensorThresholdsT thres;
	SaHpiEntryIdT entryid;
	SaHpiEntryIdT nextentryid;
	SaHpiBoolT foundSensor;			

	/* *************************************	 	 
	 * Find a resource with Sensor type rdr
	 * ************************************* */		
	err = tsetup(&sessionid);
	if (err != SA_OK) {
		printf("Error! Can not open session for test environment\n");
		printf("      File=%s, Line=%d\n", __FILE__, __LINE__);
		return -1;

	}
	err = tfind_resource(&sessionid,SAHPI_CAPABILITY_SENSOR,SAHPI_FIRST_ENTRY, &rptentry, SAHPI_TRUE);
	if (err != SA_OK) {
		printf("Error! Can not find resources for test environment\n");
		printf("      File=%s, Line=%d\n", __FILE__, __LINE__);
		err = tcleanup(&sessionid);
		return SA_OK;
	}

	id = rptentry.ResourceId;
	/************************** 
	 * Test: find a sensor with desired property
	 **************************/
	entryid = SAHPI_FIRST_ENTRY;
	foundSensor = SAHPI_FALSE;			
	do {
		err = saHpiRdrGet(sessionid,id,entryid,&nextentryid, &rdr);
		if (err == SA_OK)
		{
			if ((rdr.RdrType == SAHPI_SENSOR_RDR) &&
				(rdr.RdrTypeUnion.SensorRec.Category == SAHPI_EC_THRESHOLD) &&
				(rdr.RdrTypeUnion.SensorRec.ThresholdDefn.WriteThold == 0))
			{
				foundSensor = SAHPI_TRUE;
				break;
														
			}
			entryid = nextentryid;
		}
	} while ((err == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ;

	if (!foundSensor) {
		dbg("Did not find desired resource for test\n");
		return(SA_OK);
	} else {
		sid = rdr.RdrTypeUnion.SensorRec.Num; 
	}	


        /************************** 
	 * Test: setting to a non-writeable sensor
         **************************/
        expected_err = SA_ERR_HPI_INVALID_CMD;
	err = saHpiSensorThresholdsSet(sessionid, id, sid, &thres);
        checkstatus(err, expected_err, testfail);
											
	/***************************
	 * Cleanup after all tests
	 ***************************/
	err = tcleanup(&sessionid);
	return testfail;

}
开发者ID:openhpi1,项目名称:testrepo,代码行数:81,代码来源:tsensorset023.c


示例18: show_rdr_list

int show_rdr_list(Domain_t *domain, SaHpiResourceIdT rptid, SaHpiRdrTypeT passed_type,
                  hpi_ui_print_cb_t proc)
//  return: list size
{
    SaHpiRdrT               rdr;
    SaHpiEntryIdT           entryid;
    SaHpiEntryIdT           nextentryid;
    char                    buf[SHOW_BUF_SZ];
    SaHpiRdrTypeT           type;
    char                    ar[256];
    SaHpiSensorRecT         *sensor;
    SaErrorT                ret;
    int                     res_num = 0;

    entryid = SAHPI_FIRST_ENTRY;
    while (entryid !=SAHPI_LAST_ENTRY) {
        memset(buf, 0, SHOW_BUF_SZ);
        memset(ar, 0, 256);
        ret = saHpiRdrGet(domain->sessionId, rptid, entryid,
                          &nextentryid, &rdr);
        if (ret != SA_OK)
            return(res_num);
        type = rdr.RdrType;
        if ((passed_type != SAHPI_NO_RECORD) && (type != passed_type)) {
            entryid = nextentryid;
            continue;
        };
        snprintf(buf, SHOW_BUF_SZ, "(%3.3d): %s ID=%u",
                 oh_get_rdr_num(rdr.RecordId),
                 oh_lookup_rdrtype(type), rdr.RecordId);
        switch (type) {
        case SAHPI_SENSOR_RDR:
            sensor = &(rdr.RdrTypeUnion.SensorRec);
            snprintf(ar, 256, ", Ctrl=%d, EvtCtrl=",
                     sensor->EnableCtrl);
            switch (sensor->EventCtrl) {
            case SAHPI_SEC_PER_EVENT:
                strcat(ar, "WR");
                break;
            case SAHPI_SEC_READ_ONLY_MASKS:
                strcat(ar, "RM");
                break;
            default:
                strcat(ar, "RO");
                break;
            };
            break;
        case SAHPI_CTRL_RDR:
            break;
        case SAHPI_INVENTORY_RDR:
            break;
        case SAHPI_WATCHDOG_RDR:
            break;
        case SAHPI_ANNUNCIATOR_RDR:
            break;
        case SAHPI_DIMI_RDR:
            break;
        case SAHPI_FUMI_RDR:
            break;
        default:
            snprintf(ar, 256, ", Unrecognized RDR Type");
        };
        strcat(buf, ar);
        res_num++;
        if (proc(buf) != HPI_UI_OK) return(res_num);
        if (print_text_buffer_text(", Tag=", &(rdr.IdString),
                                   "\n", proc) != HPI_UI_OK)
            return(res_num);
        entryid = nextentryid;
    };
    return(res_num);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:72,代码来源:show.c


示例19: main

int main(int argc, char **argv) 
{

	/* ************************
	 * Local variables
	 * ***********************/	 
	int testfail = 0;
	SaErrorT          err;
	SaErrorT expected_err;
	SaHpiResourceIdT  id;
        SaHpiSessionIdT sessionid;
        SaHpiRptEntryT rptentry;
	SaHpiRdrT	rdr;	
	SaHpiCtrlNumT cid = 1;
	SaHpiCtrlModeT mode;
	SaHpiCtrlStateT state;
	SaHpiEntryIdT entryid;
	SaHpiEntryIdT nextentryid;
	SaHpiBoolT foundControl;			
													   
	/* *************************************	 	 
	 * Find a resource with Control type rdr
	 * ************************************* */
	err = tsetup(&sessionid);
	if (err != SA_OK) {
		printf("Error! Can not open session for test environment\n");
		printf("       File=%s, Line=%d\n", __FILE__, __LINE__);
		return -1;
	}
	err = tfind_resource(&sessionid, SAHPI_CAPABILITY_CONTROL, SAHPI_FIRST_ENTRY, &rptentry, SAHPI_TRUE);
	if (err != SA_OK) {
		printf("Can not find a control resource for test environment\n");
		printf("       File=%s, Line=%d\n", __FILE__, __LINE__);
		err = tcleanup(&sessionid);
		return SA_OK;
	}
	
	id = rptentry.ResourceId;
	/************************** 
	 * Test: find a control RDR
	 **************************/
	entryid = SAHPI_FIRST_ENTRY;
	foundControl = SAHPI_FALSE;			
	do {
		err = saHpiRdrGet(sessionid,id,entryid,&nextentryid, &rdr);
		if (err == SA_OK)
		{
			if (rdr.RdrType == SAHPI_CTRL_RDR) 
			{
				foundControl = SAHPI_TRUE;
				break;
														
			}
			entryid = nextentryid;
		}
	} while ((err == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ;

	if (!foundControl) {
		err("Did not find desired resource for test\n");
		return(SA_OK);
	} else {
		cid = rdr.RdrTypeUnion.CtrlRec.Num; 
	}	

	/************************** 
	 * Test 1: Normal get    
	 *************************/
	expected_err = SA_OK;
	err = saHpiControlGet(sessionid, id, cid, &mode, &state);
	checkstatus(err, expected_err, testfail);
	
	/************************** 
	 * Test 2: Get with no mode
	 * expected_err = SA_OK;
	 *************************/
	err = saHpiControlGet(sessionid, id, cid, NULL, &state);
	checkstatus(err, expected_err, testfail);
	
	/************************** 
	 * Test 3: Get with no state 
	 * expected_err = SA_OK;
	 *************************/
	err = saHpiControlGet(sessionid, id, cid, &mode, NULL);
	checkstatus(err, expected_err, testfail);
	
	/***************************
	 * Cleanup after all tests
	 ***************************/
	 err = tcleanup(&sessionid);
	 return testfail;

}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:92,代码来源:tcontrol002.c


示例20: list_rdr

void list_rdr(SaHpiSessionIdT session_id, SaHpiResourceIdT resource_id)
{
        SaErrorT             	err;
        SaHpiEntryIdT        	current_rdr;
        SaHpiEntryIdT        	next_rdr;
        SaHpiRdrT            	rdr;

	SaHpiSensorReadingT	reading;
	SaHpiSensorTypeT	sensor_type;
	SaHpiSensorNumT		sensor_num;
	SaHpiEventCategoryT	category;
	SaHpiSensorThresholdsT	thres; 

	SaHpiCtrlNumT   	ctrl_num;
	SaHpiCtrlStateT 	state;
	SaHpiCtrlTypeT  	ctrl_type;

        SaHpiEirIdT             l_eirid;
        SaHpiInventoryDataT*    l_inventdata;
	const SaHpiUint32T	l_inventsize = 16384;
        SaHpiUint32T            l_actualsize;


        printf("RDR Info:\n");
        next_rdr = SAHPI_FIRST_ENTRY;
        do {
                char tmp_epath[128];
                current_rdr = next_rdr;
                err = saHpiRdrGet(session_id, resource_id, current_rdr, 
                                  &next_rdr, &rdr);
                if (SA_OK != err) {
                        if (current_rdr == SAHPI_FIRST_ENTRY)
                                printf("Empty RDR table\n");
                        else
                                error("saHpiRdrGet", err);
                        return;                        
                }
                
                printf("\tRecordId: %x\n", rdr.RecordId);
                printf("\tRdrType: %s\n", rdrtype2str(rdr.RdrType));
		
		if (rdr.RdrType == SAHPI_SENSOR_RDR)
		{			
			SaErrorT val;
			
			sensor_num = rdr.RdrTypeUnion.SensorRec.Num;
			
			val = saHpiSensorTypeGet(session_id, resource_id, 
						 sensor_num, &sensor_type, 
						 &category);
			
			printf("\tSensor num: %i\n\tType: %s\n", sensor_num, get_sensor_type(sensor_type)); 
			printf("\tCategory: %s\n", get_sensor_category(category)); 

			memset(&reading, 0, sizeof(SaHpiSensorReadingT));

			err = saHpiSensorReadingGet(session_id, resource_id, sensor_num, &reading);
			if (err != SA_OK) {
				printf("Error=%d reading sensor data {sensor, %d}\n", err, sensor_num);
				continue;
			}

			if (reading.ValuesPresent & SAHPI_SRF_RAW) {
				printf("\tValues Present: RAW\n");
				printf("\t\tRaw value: %d\n", reading.Raw);
			}

			if (reading.ValuesPresent & SAHPI_SRF_INTERPRETED) {
				printf("\tValues Present: Interpreted\n");
                                printf("\t\t");
				interpreted2str(reading.Interpreted);
			}

			if (reading.ValuesPresent & SAHPI_SRF_EVENT_STATE) {
				printf("\tValues Present: Event State\n");
			}

			if (rdr.RdrTypeUnion.SensorRec.ThresholdDefn.IsThreshold == SAHPI_TRUE) {
                                memset(&thres, 0, sizeof(SaHpiSensorThresholdsT));
				err = saHpiSensorThresholdsGet(session_id, resource_id, sensor_num, &thres);
				if (err != SA_OK) {
					printf("Error=%d reading sensor thresholds {sensor, %d}\n", err, sensor_num);
					continue;
				}
				
				if (thres.LowCritical.ValuesPresent) {
					printf("\t\tThreshold:  Low Critical Values\n");
					printreading(thres.LowCritical);
				}
				if (thres.LowMajor.ValuesPresent) {
					printf("\t\tThreshold:  Low Major Values\n");
					printreading(thres.LowMajor);
				}
				if (thres.LowMinor.ValuesPresent) {
					printf("\t\tThreshold:  Low Minor Values\n");
					printreading(thres.LowMinor);
				}
				if (thres.UpCritical.ValuesPresent) {
					printf("\t\tThreshold:  Up Crit 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ saHpiRptEntryGet函数代码示例发布时间:2022-05-30
下一篇:
C++ saAmfResponse函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap