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


C++ dm_register函数代码示例

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


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

示例1: main

int main( void )
{
  FILE* fp;

  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }

  // Initialize device manager
  dm_init();

  // Register the ROM filesystem
  dm_register( romfs_init() );

  // Register the MMC filesystem
  dm_register( mmcfs_init() );

  // Register the remote filesystem
  dm_register( remotefs_init() );

  // Autorun: if "autorun.lua" is found in the file system, run it first
  if( ( fp = fopen( FS_AUTORUN, "r" ) ) != NULL )
  {
    fclose( fp );
    char* lua_argv[] = { "lua", FS_AUTORUN, NULL };
    lua_main( 2, lua_argv );
  }
  
#ifdef ELUA_BOOT_RPC
  boot_rpc();
#else
  
  // Run the shell
  if( shell_init() == 0 )
  {
    printf( "Unable to initialize the eLua shell!\n" );
    // Start Lua directly
    char* lua_argv[] = { "lua", NULL };
    lua_main( 1, lua_argv );
  }
  else
    shell_start();
#endif // #ifdef ELUA_BOOT_RPC

#ifdef ELUA_SIMULATOR
  hostif_exit(0);
  return 0;
#else
  while( 1 );
#endif
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:54,代码来源:main.c

示例2: main

int main( void )
{
    int i;
    FILE* fp;

    // Initialize platform first
    if( platform_init() != PLATFORM_OK )
    {
        // This should never happen
        while( 1 );
    }

    // Initialize device manager
    dm_init();

    // Register the ROM filesystem
    dm_register( romfs_init() );

    // Register the MMC filesystem
    dm_register( mmcfs_init() );

    // Register the Semihosting filesystem
    dm_register( semifs_init() );

    // Search for autorun files in the defined order and execute the 1st if found
    for( i = 0; i < sizeof( boot_order ) / sizeof( *boot_order ); i++ )
    {
        if( ( fp = fopen( boot_order[ i ], "r" ) ) != NULL )
        {
            fclose( fp );
            char* picoc_argv[] = { "picoc", boot_order[i], NULL };
            picoc_main( 2, picoc_argv );
            break; // autoruns only the first found
        }
    }

    // Run the shell
    if( shell_init() == 0 )
    {
        // Start picoc directly
        char* picoc_argv[] = { "picoc", NULL };
        picoc_main( 1, picoc_argv );
    }
    else
        shell_start();

    while( 1 );
}
开发者ID:fjrti,项目名称:remix,代码行数:48,代码来源:main.c

示例3: main

// ****************************************************************************
//  Program entry point
int main (void)
{
  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }
    
  // Initialize device manager
  dm_init();
  
  // And register the ROM filesystem
  dm_register( fs_init() );  
  
  // Initialize XMODEM
  xmodem_init( xmodem_send, xmodem_recv );    
  
  printf( ".text ends at %p, first free RAM is at %p, last free ram is at %p\r\n", etext, platform_get_first_free_ram(), platform_get_last_free_ram() );
  
  // Run the shell
  if( shell_init( XMODEM_MAX_FILE_SIZE ) == 0 )
    printf( "Unable to initialize shell!\n" );
  else
    shell_start();
    
  while( 1 );
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:30,代码来源:main.c

示例4: device_manager_init

/**@brief Function for the Device Manager initialization.
 */
static void device_manager_init(void)
{
    uint32_t                err_code;
    dm_init_param_t         init_data;
    dm_application_param_t  register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    // Clear all bonded centrals if the "delete all bonds" button is pushed.
    err_code = bsp_button_is_pressed(BOND_DELETE_ALL_WAKEUP_BUTTON_ID,&(init_data.clear_persistent_data));
    APP_ERROR_CHECK(err_code);
	
    err_code = dm_init(&init_data);
    APP_ERROR_CHECK(err_code);
    
    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

    register_param.sec_param.timeout      = SEC_PARAM_TIMEOUT;
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:34,代码来源:main.c

示例5: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof (ble_gap_sec_params_t));

    // Event handler to be registered with the module.
    register_param.evt_handler            = device_manager_event_handler;

    // Service or protocol context for device manager to load, store and apply on behalf of application.
    // Here set to client as application is a GATT client.
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_CLI_ID;

    // Secuirty parameters to be used for security procedures.
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.sec_param.kdist_periph.enc = 1;
    register_param.sec_param.kdist_periph.id  = 1;

    err_code = dm_register(&m_dm_app_id, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:39,代码来源:main.c

示例6: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
    
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:RobinLin,项目名称:Espruino,代码行数:32,代码来源:main.c

示例7: mmcfs_init

int mmcfs_init()
{
  // Mount the MMC file system using logical disk 0
  if ( f_mount( 0, &mmc_fs ) != FR_OK )
    return DM_ERR_INIT;
  return dm_register( "/mmc", NULL, &mmcfs_device );
}
开发者ID:LeVinh4694,项目名称:Cheerlights,代码行数:7,代码来源:mmcfs.c

示例8: device_manager_init

/**@brief Function for the Device Manager initialization.
 */
static void device_manager_init(void)
{
    uint32_t                err_code;
    dm_init_param_t         init_data;
    dm_application_param_t  register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    // Clear all bonded centrals if the Bonds Delete button is pushed.
    init_data.clear_persistent_data = true;//(nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_ID) == 0);

    err_code = dm_init(&init_data);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

    //register_param.sec_param.timeout      = SEC_PARAM_TIMEOUT;
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_NONE;

    err_code = dm_register(&g_AppHandle, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:33,代码来源:LMXDisplayBleMain.c

示例9: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    APP_ERROR_CHECK(err_code);
    
    app_bond_init(&m_app_bond_table);
    
    for(uint8_t i = 0; i < DEVICE_MANAGER_MAX_BONDS; i++)
    {
        APP_LOG("[APP][ID: %d], Application context : %08X\r\n",m_app_bond_table.device_id[i],(unsigned int) m_app_bond_table.app_bond_cnt[i]);
    }
}
开发者ID:hshd123,项目名称:nRF51-ble-peripheral-bond-handling,代码行数:39,代码来源:main.c

示例10: dm_init

// Initialize device manager
// This initializes the standard descriptors (stdin, stdout, stderr)
// At this point it is assumed that the std device (usually UART) is already initialized
int dm_init() 
{
  dm_register( std_get_desc() );
#ifndef BUILD_CON_TCP         // we need buffering on stdout for console over TCP
  setbuf( stdout, NULL );
#endif
  return DM_OK;
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:11,代码来源:devman.c

示例11: main

int main( void )
{
    FILE* fp;

    // Initialize platform first
    if( platform_init() != PLATFORM_OK )
    {
        // This should never happen
        while( 1 );
    }

    // Initialize device manager
    dm_init();

    // Register the ROM filesystem
    dm_register( romfs_init() );

#ifdef BUILD_XMODEM
    // Initialize XMODEM
    xmodem_init( xmodem_send, xmodem_recv );
#endif

#ifdef BUILD_TERM
    // Initialize terminal
    term_init( TERM_LINES, TERM_COLS, term_out, term_in, term_translate );
#endif

    // Autorun: if "autorun.lua" is found in the ROM file system, run it first
    if( ( fp = fopen( "/rom/autorun.lua", "r" ) ) != NULL )
    {
        fclose( fp );
        char* lua_argv[] = { "lua", "/rom/autorun.lua", NULL };
        lua_main( 2, lua_argv );
    }

    // Run the shell
    if( shell_init() == 0 )
    {
        printf( "Unable to initialize the eLua shell!\n" );
        // Start Lua directly
        char* lua_argv[] = { "lua", NULL };
        lua_main( 1, lua_argv );
    }
    else
        shell_start();

    while( 1 );
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:48,代码来源:main.c

示例12: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t  register_param;
    
    // Initialize persistent storage module.
    err_code = pstorage_init();
    if (err_code == NRF_SUCCESS)
			debug_printf("Persistent storage module is ready!\r\n");
		else
		{
			debug_printf("Ooops.. Something went wrong with initialising the PS module..\r\n");
			APP_ERROR_CHECK(err_code);
		}
    
		err_code = dm_init(&init_param);
    if (err_code == NRF_SUCCESS)
			debug_printf("DM initialised!\r\n");
		else
		{
			debug_printf("Ooops.. Something went wrong with initialising the DM..\r\n");
			APP_ERROR_CHECK(err_code);
		}
    
		memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
    
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    if (err_code == NRF_SUCCESS)
			debug_printf("Registered parameters for DM!\r\n");
		else
		{
			debug_printf("Ooops.. Something went wrong with registering the parameters for the DM..\r\n");
			APP_ERROR_CHECK(err_code);
		}
}
开发者ID:stelios26,项目名称:Aphrodite,代码行数:50,代码来源:main.c

示例13: device_manager_init

/**@brief Function for initializing the Device Manager.
 *
 * @details Device manager is initialized here.
 */
static void device_manager_init(void)
{
    dm_application_param_t param;
    dm_init_param_t        init_param;

    uint32_t err_code;

    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

	  init_param.clear_persistent_data = false;

#ifdef BOND_DELETE_ALL_BUTTON_PIN
    // Clear all bonded devices if user requests to.
    init_param.clear_persistent_data =
        ((nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_PIN) == 0)? true: false);
#endif
	
    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&param.sec_param, 0, sizeof (ble_gap_sec_params_t));

    // Event handler to be registered with the module.
    param.evt_handler            = device_manager_event_handler;

    // Service or protocol context for device manager to load, store and apply on behalf of application.
    // Here set to client as application is a GATT client.
    param.service_type           = DM_PROTOCOL_CNTXT_GATT_CLI_ID;

    // Secuirty parameters to be used for security procedures.
    param.sec_param.bond         = SEC_PARAM_BOND;
    param.sec_param.mitm         = SEC_PARAM_MITM;
    param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    param.sec_param.oob          = SEC_PARAM_OOB;
    param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    param.sec_param.kdist_periph.enc = 1;
    param.sec_param.kdist_periph.id  = 1;

    err_code = dm_register(&m_dm_app_id,&param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:47,代码来源:main.c

示例14: main

int main( void )
{
    // Initialize platform first
    if( platform_init() != PLATFORM_OK )
    {
        // This should never happen
        while( 1 );
    }

    // Initialize the TLSF allocator
    // (if TLSF is not used, the next function does nothing)
    tlsf_elua_init();

    // Initialize device manager
    dm_init();

    // Register the ROM filesystem
    dm_register( romfs_init() );

    // Initialize XMODEM
    xmodem_init( xmodem_send, xmodem_recv );

    // Initialize terminal
    term_init( TERMINAL_LINES, TERMINAL_COLS, term_out, term_in, term_translate );

    printf( ".text ends at %p\n", etext );

    // Run the shell
    if( shell_init( XMODEM_MAX_FILE_SIZE ) == 0 )
    {
        printf( "Unable to initialize the eLua shell!\n" );
        // Start Lua directly
        char* lua_argv[] = { "lua", NULL };
        lua_main( 1, lua_argv );
    }
    else
        shell_start();

    while( 1 );
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:40,代码来源:main.c

示例15: main

int main( void )
{
  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }
    
  // Initialize device manager
  dm_init();
  
  // Register the ROM filesystem
  dm_register( romfs_init() );  
  
  // Initialize XMODEM
  xmodem_init( xmodem_send, xmodem_recv );    
  
  // Initialize terminal
  term_init( TERMINAL_LINES, TERMINAL_COLS, term_out, term_in, term_translate );
  
  printf( ".text ends at %p, first free RAM is at %p, last free ram is at %p\r\n", etext, platform_get_first_free_ram(), platform_get_last_free_ram() );
  
  // Run the shell
  if( shell_init( XMODEM_MAX_FILE_SIZE ) == 0 )
  {
    printf( "Unable to initialize the eLua shell!\n" );
    // Start Lua directly
    char* lua_argv[] = { "lua", NULL };
    lua_main( 1, lua_argv );
  }
  else
    shell_start();

  while( 1 );
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:36,代码来源:main.c


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