void AppInit(sleep_state last_sleep_state) { /* initialise application debug */ AppDebugInit(); AppDebugWriteString("\r\n\r\n*****************\r\n"); AppDebugWriteString("Beacon example\r\n"); /* Initialise GATT entity */ GattInit(); /* Initialise beacon data */ initBeacon(); /* Start beaconing */ startBeaconing(); }
/*----------------------------------------------------------------------------* * NAME * AppInit * * DESCRIPTION * This user application function is called after a power-on reset * (including after a firmware panic), after a wakeup from Hibernate or * Dormant sleep states, or after an HCI Reset has been requested. * * NOTE: In the case of a power-on reset, this function is called * after AppPowerOnReset(). * * PARAMETERS * last_sleep_state [in] Last sleep state * * RETURNS * Nothing *----------------------------------------------------------------------------*/ void AppInit(sleep_state last_sleep_state) { uint16 gatt_db_length = 0; /* GATT database size */ uint16 *p_gatt_db = NULL; /* GATT database */ /* Initialise GATT entity */ GattInit(); /* Install GATT Server support for the "Write" procedures */ GattInstallServerWrite(); /* Read or initialise the application NVM */ readPersistentStore(); /* Tell firmware about our database. We will get a GATT_ADD_DB_CFM event * when this has completed. */ p_gatt_db = GattGetDatabase(&gatt_db_length); GattAddDatabaseReq(gatt_db_length, p_gatt_db); }