Verified Commit 425d47cf authored by schneider's avatar schneider Committed by Rahix
Browse files

chore(ble): Refactoring...

parent 862b4286
......@@ -4,7 +4,7 @@
#include "wsf_timer.h"
#include "wsf_trace.h"
#include "app_ui.h"
#include "fit/fit_api.h"
#include "ble_api.h"
#include "hci_vs.h"
#include "att_defs.h"
......
......@@ -220,6 +220,8 @@ static uint16_t fitRscmPeriod = FIT_DEFAULT_RSCM_PERIOD;
/* Heart Rate Monitor feature flags */
static uint8_t fitHrmFlags = CH_HRM_FLAGS_VALUE_8BIT | CH_HRM_FLAGS_ENERGY_EXP;
static void FitHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg);
/*************************************************************************************************/
/*!
* \brief Application DM callback.
......@@ -661,12 +663,12 @@ static void fitProcMsg(fitMsg_t *pMsg)
* \return None.
*/
/*************************************************************************************************/
void FitHandlerInit(wsfHandlerId_t handlerId)
static void FitHandlerInit(void)
{
APP_TRACE_INFO0("FitHandlerInit");
/* store handler ID */
fitHandlerId = handlerId;
fitHandlerId =WsfOsSetNextHandler(FitHandler);
/* Set configuration pointers */
pAppAdvCfg = (appAdvCfg_t *) &fitAdvCfg;
......@@ -681,11 +683,11 @@ void FitHandlerInit(wsfHandlerId_t handlerId)
pSmpCfg = (smpCfg_t *) &fitSmpCfg;
/* initialize heart rate profile sensor */
HrpsInit(handlerId, (hrpsCfg_t *) &fitHrpsCfg);
HrpsInit(fitHandlerId, (hrpsCfg_t *) &fitHrpsCfg);
HrpsSetFlags(fitHrmFlags);
/* initialize battery service server */
BasInit(handlerId, (basCfg_t *) &fitBasCfg);
BasInit(fitHandlerId, (basCfg_t *) &fitBasCfg);
}
/*************************************************************************************************/
......@@ -698,7 +700,7 @@ void FitHandlerInit(wsfHandlerId_t handlerId)
* \return None.
*/
/*************************************************************************************************/
void FitHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
static void FitHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
{
if (pMsg != NULL)
{
......@@ -727,6 +729,9 @@ void FitHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
/*************************************************************************************************/
void FitStart(void)
{
FitHandlerInit();
/* Register for stack callbacks */
DmRegister(fitDmCback);
DmConnRegister(DM_CLIENT_ID_APP, fitDmCback);
......
......@@ -34,7 +34,7 @@
#include "wsf_types.h"
#include "wsf_os.h"
#include "util/bstream.h"
#include "fit/fit_api.h"
#include "ble_api.h"
#include "hci_handler.h"
#include "dm_handler.h"
#include "l2c_handler.h"
......@@ -187,7 +187,4 @@ void StackInitFit(void)
* mixed a lot. */
handlerId = WsfOsSetNextHandler(AppHandler);
AppHandlerInit(handlerId);
handlerId = WsfOsSetNextHandler(FitHandler);
FitHandlerInit(handlerId);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment