Skip to content
Snippets Groups Projects
Verified Commit 425d47cf authored by schneider's avatar schneider Committed by rahix
Browse files

chore(ble): Refactoring...

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