当前位置: 首页>>代码示例>>C++>>正文


C++ saHpiSessionOpen函数代码示例

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


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

示例1: open_session

int open_session()
{
	SaErrorT rv;
	SaHpiVersionT hpiVer;

	rv = saHpiInitialize(&hpiVer);
	if (rv != SA_OK) {
		printf("saHpiInitialize error %d\n", rv);
		return -1;
	}

	rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID, &sessionid, NULL);
	if (rv != SA_OK) {
     		printf("saHpiSessionOpen error %d\n", rv);
		return -1;
	}
	rv = saHpiResourcesDiscover(sessionid);
	if (rv != SA_OK) 
		printf("saHpiResourcesDiscover rv = %d\n", rv);

	printf("Initial discovery done\n");	
	printf("\tEnter a command or \"help\" for list of commands\n");

	pthread_create(&ge_thread, NULL, get_event, NULL);
	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:26,代码来源:session.c

示例2: main

int main (int argc, char *argv []) {
	SaErrorT 		err;
	SaHpiSessionIdT 	session_id;

	err =  saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &session_id, NULL);
	if (err != SA_OK) {
		printf("%s: saHpiSessionOpen failed\n", argv[0]);
		printf("%s: the daemon may not be running\n", argv[0]);
		return (-1);
	}

	err =  saHpiDiscover(session_id);
	if (err != SA_OK) {
		printf("%s: saHpiDiscover failed\n", argv[0]);
		return (-1);
	}

	err =  saHpiSessionClose(session_id);
	if (err != SA_OK) {
		printf("%s: saHpiSessionClose failed\n", argv[0]);
		return (-1);
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:25,代码来源:ctest_01.cpp

示例3: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
        SaHpiWatchdogT wd;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		dbg("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		dbg("Failed to run discover");
                return -1;
	}

        rc = saHpiWatchdogTimerGet(sid, 1, 1, &wd);
        if (rc != SA_OK) {
		dbg("Couldn't get watchdog timer");
		dbg("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:27,代码来源:sim_sanity_034.c

示例4: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
        SaHpiPowerStateT pwrstate;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		err("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		err("Failed to run discover");
                return -1;
	}

        /* get the resource id of the chassis */
        SaHpiResourceIdT resid = get_resid(sid, SAHPI_ENT_SYSTEM_CHASSIS);
        if (resid == 0) {
		err("Couldn't find the resource id of the chassis");
                return -1;
	}

        rc = saHpiResourcePowerStateGet(sid, resid, &pwrstate);
        if (rc != SA_OK) {
		err("Couldn't get power state");
		err("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:34,代码来源:sim_sanity_028.c

示例5: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		dbg("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		dbg("Failed to run discover");
                return -1;
	}

        rc = saHpiResourcePowerStateSet(sid, 1, SAHPI_POWER_ON);
        if (rc != SA_OK) {
		dbg("Couldn't set power state");
		dbg("Error %s",oh_lookup_error(rc));
                return -1;
	}

        rc = saHpiResourcePowerStateSet(sid, 1, SAHPI_POWER_OFF);
        if (rc == SA_OK) {
		dbg("Able to set invalid power state");
		dbg("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:33,代码来源:sim_sanity_029.c

示例6: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
	SaHpiTimeT cur_time = 0;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		dbg("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		dbg("Failed to run discover");
                return -1;
	}

        /* set event log time */
        rc = saHpiEventLogTimeSet(sid, 1, cur_time);
        if (rc != SA_OK) {
		dbg("Couldn't set event log time");
		dbg("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:28,代码来源:sim_sanity_018.c

示例7: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
        SaHpiHsStateT state;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		dbg("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		dbg("Failed to run discover");
                return -1;
	}

        /* get the resource id of the hs drive */
        SaHpiResourceIdT resid = get_resid(sid, SAHPI_ENT_DISK_DRIVE_BAY);
        if (resid == 0) {
		dbg("Couldn't find the resource id of the hs drive");
                return -1;
	}

        rc = saHpiHotSwapStateGet(sid, resid, &state);
        if (rc != SA_OK) {
		dbg("Couldn't get state");
		dbg("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:34,代码来源:sim_sanity_032.c

示例8: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
        SaHpiIdrFieldT field;
        SaHpiEntryIdT next;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		err("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		err("Failed to run discover");
                return -1;
	}

        /* get the resource id of the chassis */
        SaHpiResourceIdT resid = get_resid(sid, SAHPI_ENT_SYSTEM_CHASSIS);
        if (resid == 0) {
		err("Couldn't find the resource id of the chassis");
                return -1;
	}

        rc = saHpiIdrFieldGet(sid, resid, 1, 1, SAHPI_IDR_FIELDTYPE_MANUFACTURER, SAHPI_FIRST_ENTRY, &next, &field);
        if (rc != SA_OK) {
		err("Couldn't get field");
		err("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:35,代码来源:sim_sanity_041.c

示例9: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
        SaHpiIdrFieldT field;
        SaHpiEntryIdT next;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		dbg("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		dbg("Failed to run discover");
                return -1;
	}

        rc = saHpiIdrFieldGet(sid, 1, 1, 1, SAHPI_IDR_FIELDTYPE_MANUFACTURER, SAHPI_FIRST_ENTRY, &next, &field);
        if (rc != SA_OK) {
		dbg("Couldn't get field");
		dbg("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:28,代码来源:sim_sanity_041.c

示例10: tsetup

SaErrorT tsetup (SaHpiSessionIdT *sessionid_ptr)
{

        SaErrorT err = SA_OK;	
        /* ************************	 	 
	 * Hook in simulation environment
	 * ***********************/
        
        err = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, sessionid_ptr, NULL);
        if (err != SA_OK) {
                printf("Error! Can not open session.\n");
		printf("  File=%s, Line=%d\n", __FILE__, __LINE__);
                printf("  Received error=%s\n", oh_lookup_error(err));
        }
        
        if (!err) err = saHpiDiscover(*sessionid_ptr);
        if (err != SA_OK) {
                printf("Error! Can not discover resources.\n");
		printf("   File=%s, Line=%d\n", __FILE__, __LINE__);
                printf("   Received error=%s\n", oh_lookup_error(err));
                err = saHpiSessionClose(*sessionid_ptr);
        }
        
        return err;	 
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:25,代码来源:tsetup.c

示例11: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if (rc != SA_OK) {
		dbg("Failed to open session");
                return -1;
	}

	rc = saHpiDiscover(sid);
	if (rc != SA_OK) {
		dbg("Failed to run discover");
                return -1;
	}

        /* get the resource id of the chassis */
        SaHpiResourceIdT resid = get_resid(sid, SAHPI_ENT_SYSTEM_CHASSIS);
        if (resid == 0) {
		dbg("Couldn't find the resource id of the chassis");
                return -1;
	}

        rc = saHpiAnnunciatorAcknowledge(sid, resid, 1, SAHPI_ENTRY_UNSPECIFIED,
                                         SAHPI_MINOR);
        if (rc != SA_OK) {
		dbg("Couldn't ack annunciator");
		dbg("Error %s",oh_lookup_error(rc));
                return -1;
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:34,代码来源:sim_sanity_025.c

示例12: main

int main(int argc, char **argv)
{
        SaHpiSessionIdT sid = 0;
        
        setenv("OPENHPI_CONF","./noconfig", 1);
        
        if (saHpiSessionOpen(1, &sid, NULL))
                return -1;
                    
        /* Load plugins */
        if (oHpiPluginLoad("libdummy"))
                return -1;
                
        if (oHpiPluginLoad("libwatchdog"))
                return -1;
                
        if (!oHpiPluginGetNext(NULL, NULL, 0))
                return -1;
                
        if (oHpiPluginUnload("libwatchdog"))
                return -1;

        
        return oHpiPluginUnload("libdummy");
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:25,代码来源:ohpi_021.c

示例13: main

int main(int argc, char **argv)
{
        SaErrorT err;
        SaHpiSessionIdT sessionid;

        err = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL);
        if (err) {
	  printf("  Error! Testcase failed. Line=%d\n", __LINE__);
	  printf("  Received error=%s\n", oh_lookup_error(err));
	  return -1;
        }
	// regular sim_init is part of saHpiSessionOpen, here we close it
	sim_close();
	// env variable OPENHPI_SIMTEST_FILE is now defined in Makefile.am
	// setenv("OPENHPI_SIMTEST_FILE","./sim_test_file", 1);
	// create hash table based on input file
	err = sim_file();
	if (err != SA_OK) {
	  printf(" Error! sim_file failed\n");
	  return -1;
	} 

	/****************** 
	 * End of testcases 
         ******************/

        err = saHpiSessionClose(sessionid);
        if (err) {
	  printf("Error! saHpiSessionClose: err=%d\n", err);
	  return -1;
        }

        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:34,代码来源:tsim_file.c

示例14: open_session

int open_session()
{
	SaErrorT rv;

        if (!g_thread_supported()) {
                g_thread_init(NULL);
	};
	thread_wait = g_cond_new();
	thread_mutex = g_mutex_new();
	do_progress("Discover");
	rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL);
	if (rv != SA_OK) {
     		printf("saHpiSessionOpen error %d\n", rv);
		return -1;
	}
	rv = saHpiDiscover(sessionid);
	if (rv != SA_OK) 
		printf("saHpiDiscover rv = %d\n", rv);
	delete_progress();

	printf("Initial discovery done\n");

	Domain = init_resources(sessionid);
	if (Domain == (Domain_t *)NULL) {
     		printf("init_resources error\n");
		return -1;
	}
	printf("\tEnter a command or \"help\" for list of commands\n");

	pthread_create(&ge_thread, NULL, get_event, NULL);
	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:32,代码来源:session.c

示例15: main

int main(int argc, char **argv)
{
    SaHpiSessionIdT sid = 0;
    char *config_file = NULL;
    GHashTable *config = g_hash_table_new(g_str_hash, g_str_equal);
    oHpiHandlerIdT hid = 0;

    /* Save config file env variable and unset it */
    config_file = getenv("OPENHPI_CONF");
    setenv("OPENHPI_CONF","./noconfig", 1);

    if (saHpiSessionOpen(1, &sid, NULL))
        return -1;

    if (oHpiPluginLoad("libdummy"))
        return -1;

    /* Set configuration. */
    g_hash_table_insert(config, "plugin", "libdummy");
    g_hash_table_insert(config, "entity_root", "{SYSTEM_CHASSIS,1}");
    g_hash_table_insert(config, "name", "test");
    g_hash_table_insert(config, "addr", "0");

    if (oHpiHandlerCreate(config, &hid))
        return -1;

    if (!oHpiHandlerInfo(0, NULL))
        return -1;

    /* Restore config file env variable */
    setenv("OPENHPI_CONF",config_file,1);

    return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:34,代码来源:ohpi_030.c


注:本文中的saHpiSessionOpen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。