From 425d47cf2289273001c04b251993e67b718e5923 Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Sat, 3 Aug 2019 22:39:48 +0200 Subject: [PATCH] chore(ble): Refactoring... --- epicardium/ble/ble.c | 2 +- epicardium/ble/ble_main.c | 15 ++++++++++----- epicardium/ble/stack.c | 5 +---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/epicardium/ble/ble.c b/epicardium/ble/ble.c index dc8664067..ae4ce2253 100644 --- a/epicardium/ble/ble.c +++ b/epicardium/ble/ble.c @@ -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" diff --git a/epicardium/ble/ble_main.c b/epicardium/ble/ble_main.c index 6c30970f5..eefbb58e5 100644 --- a/epicardium/ble/ble_main.c +++ b/epicardium/ble/ble_main.c @@ -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); diff --git a/epicardium/ble/stack.c b/epicardium/ble/stack.c index f100d3902..07c733534 100644 --- a/epicardium/ble/stack.c +++ b/epicardium/ble/stack.c @@ -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); } -- GitLab