本文整理汇总了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
}
示例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 );
}
示例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 );
}
示例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(®ister_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, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例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(®ister_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, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例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(®ister_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, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例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 );
}
示例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(®ister_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, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例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(®ister_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, ®ister_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]);
}
}
示例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;
}
示例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 );
}
示例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(®ister_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, ®ister_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);
}
}
示例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(¶m.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,¶m);
APP_ERROR_CHECK(err_code);
}
示例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 );
}
示例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 );
}