Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
e990df75
Verified
Commit
e990df75
authored
Aug 04, 2019
by
schneider
Committed by
Rahix
Aug 06, 2019
Browse files
fix(ble): Remove obsolete stuff from fit example
parent
b3eec4e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
epicardium/ble/app/app_main.c
View file @
e990df75
...
...
@@ -179,9 +179,9 @@ uint8_t appNumConns(uint8_t role)
* \return None.
*/
/*************************************************************************************************/
void
App
HandlerInit
(
wsfHandlerId_t
handlerI
d
)
void
App
Init
(
voi
d
)
{
appHandlerId
=
handlerId
;
appHandlerId
=
WsfOsSetNextHandler
(
AppHandler
)
;
AppDbInit
();
}
...
...
epicardium/ble/ble.c
View file @
e990df75
...
...
@@ -45,7 +45,8 @@ static wsfBufPoolDesc_t mainPoolDesc[WSF_BUF_POOLS] =
};
/*! \brief Stack initialization for app. */
extern
void
StackInitFit
(
void
);
extern
void
StackInit
(
void
);
extern
void
AppInit
(
void
);
/*************************************************************************************************/
void
PalSysAssertTrap
(
void
)
...
...
@@ -316,12 +317,14 @@ void ble_uart_write(uint8_t *pValue, uint8_t len)
static
void
ble_init
(
void
)
{
WsfInit
();
StackInit
Fit
();
StackInit
();
setAddress
();
NVIC_SetPriority
(
BTLE_SFD_TO_IRQn
,
2
);
NVIC_SetPriority
(
BTLE_TX_DONE_IRQn
,
2
);
NVIC_SetPriority
(
BTLE_RX_RCVD_IRQn
,
2
);
FitStart
();
AppInit
();
BleStart
();
/* Add the UART service dynamically */
AttsDynInit
();
...
...
epicardium/ble/ble_main.c
View file @
e990df75
/*************************************************************************************************/
/*!
* \file
*
* \brief Fitness sample application for the following profiles:
* Heart Rate profile
*
* Copyright (c) 2011-2018 Arm Ltd. All Rights Reserved.
* ARM Ltd. confidential and proprietary.
*
* IMPORTANT. Your use of this file is governed by a Software License Agreement
* ("Agreement") that must be accepted in order to download or otherwise receive a
* copy of this file. You may not use or copy this file for any purpose other than
* as described in the Agreement. If you do not agree to all of the terms of the
* Agreement do not use this file and delete all copies in your possession or control;
* if you do not have a copy of the Agreement, you must contact ARM Ltd. prior
* to any use, copying or further distribution of this software.
*/
/*************************************************************************************************/
/* card10:
* Copied from lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/fit/fit_main.c
*
...
...
@@ -25,6 +5,11 @@
* to this file regarding handling of OOB paring data
*
* This file contains some application logic taken from the "fit" example.
*
* Things have been renamed:
* fit -> ble
* Fit -> Ble
* FIT -> BLE
*/
#include
<string.h>
#include
"wsf_types.h"
...
...
@@ -54,17 +39,12 @@
**************************************************************************************************/
/*! WSF message event starting value */
#define FIT_MSG_START 0xA0
/* Default Running Speed and Cadence Measurement period (seconds) */
#define FIT_DEFAULT_RSCM_PERIOD 1
#define BLE_MSG_START 0xA0
/*! WSF message event enumeration */
enum
{
FIT_HR_TIMER_IND
=
FIT_MSG_START
,
/*! Heart rate measurement timer expired */
FIT_BATT_TIMER_IND
,
/*! Battery measurement timer expired */
FIT_RUNNING_TIMER_IND
/*! Running speed and cadence measurement timer expired */
BLE_BATT_TIMER_IND
=
BLE_MSG_START
,
/*! Battery measurement timer expired */
};
/**************************************************************************************************
...
...
@@ -78,27 +58,27 @@ typedef union
dmEvt_t
dm
;
attsCccEvt_t
ccc
;
attEvt_t
att
;
}
fit
Msg_t
;
}
ble
Msg_t
;
/**************************************************************************************************
Configurable Parameters
**************************************************************************************************/
/*! configurable parameters for advertising */
static
const
appAdvCfg_t
fit
AdvCfg
=
static
const
appAdvCfg_t
ble
AdvCfg
=
{
{
60000
,
0
,
0
},
/*! Advertising durations in ms */
{
500
/
0
.
625
,
4000
/
0
.
625
,
0
}
/*! Advertising intervals in 0.625 ms units */
};
/*! configurable parameters for slave */
static
const
appSlaveCfg_t
fit
SlaveCfg
=
static
const
appSlaveCfg_t
ble
SlaveCfg
=
{
1
,
/*! Maximum connections */
};
/*! configurable parameters for security */
static
const
appSecCfg_t
fit
SecCfg
=
static
const
appSecCfg_t
ble
SecCfg
=
{
DM_AUTH_BOND_FLAG
|
DM_AUTH_SC_FLAG
,
/*! Authentication and bonding flags */
0
,
/*! Initiator key distribution flags */
...
...
@@ -108,25 +88,19 @@ static const appSecCfg_t fitSecCfg =
};
/*! configurable parameters for connection parameter update */
static
const
appUpdateCfg_t
fit
UpdateCfg
=
static
const
appUpdateCfg_t
ble
UpdateCfg
=
{
6000
,
/*! Connection idle period in ms before attempting
connection parameter update; set to zero to disable */
640
,
/*! Minimum connection interval in 1.25ms units */
8
00
,
/*! Maximum connection interval in 1.25ms units */
800
/
1
.
25
,
/*! Minimum connection interval in 1.25ms units */
1
00
0
/
1
.
25
,
/*! Maximum connection interval in 1.25ms units */
0
,
/*! Connection latency */
900
,
/*! Supervision timeout in 10ms units */
900
0
/
10
,
/*! Supervision timeout in 10ms units */
5
/*! Number of update attempts before giving up */
};
/*! heart rate measurement configuration */
static
const
hrpsCfg_t
fitHrpsCfg
=
{
2000
/*! Measurement timer expiration period in ms */
};
/*! battery measurement configuration */
static
const
basCfg_t
fit
BasCfg
=
static
const
basCfg_t
ble
BasCfg
=
{
30
,
/*! Battery measurement timer expiration period in seconds */
1
,
/*! Perform battery measurement after this many timer periods */
...
...
@@ -134,7 +108,7 @@ static const basCfg_t fitBasCfg =
};
/*! SMP security parameter configuration */
static
const
smpCfg_t
fit
SmpCfg
=
static
const
smpCfg_t
ble
SmpCfg
=
{
3000
,
/*! 'Repeated attempts' timeout in msec */
SMP_IO_NO_IN_NO_OUT
,
/*! I/O Capability */
...
...
@@ -149,7 +123,7 @@ static const smpCfg_t fitSmpCfg =
**************************************************************************************************/
/*! advertising data, discoverable mode */
static
const
uint8_t
fit
AdvDataDisc
[]
=
static
const
uint8_t
ble
AdvDataDisc
[]
=
{
/*! flags */
2
,
/*! length */
...
...
@@ -163,16 +137,14 @@ static const uint8_t fitAdvDataDisc[] =
0
,
/*! tx power */
/*! service UUID list */
9
,
/*! length */
5
,
/*! length */
DM_ADV_TYPE_16_UUID
,
/*! AD type */
UINT16_TO_BYTES
(
ATT_UUID_HEART_RATE_SERVICE
),
UINT16_TO_BYTES
(
ATT_UUID_RUNNING_SPEED_SERVICE
),
UINT16_TO_BYTES
(
ATT_UUID_DEVICE_INFO_SERVICE
),
UINT16_TO_BYTES
(
ATT_UUID_BATTERY_SERVICE
)
};
/*! scan data, discoverable mode */
static
const
uint8_t
fit
ScanDataDisc
[]
=
static
const
uint8_t
ble
ScanDataDisc
[]
=
{
/*! device name */
7
,
/*! length */
...
...
@@ -187,21 +159,17 @@ static const uint8_t fitScanDataDisc[] =
/*! enumeration of client characteristic configuration descriptors */
enum
{
FIT_GATT_SC_CCC_IDX
,
/*! GATT service, service changed characteristic */
FIT_HRS_HRM_CCC_IDX
,
/*! Heart rate service, heart rate monitor characteristic */
FIT_BATT_LVL_CCC_IDX
,
/*! Battery service, battery level characteristic */
FIT_RSCS_SM_CCC_IDX
,
/*! Runninc speed and cadence measurement characteristic */
FIT_NUM_CCC_IDX
BLE_GATT_SC_CCC_IDX
,
/*! GATT service, service changed characteristic */
BLE_BATT_LVL_CCC_IDX
,
/*! Battery service, battery level characteristic */
BLE_NUM_CCC_IDX
};
/*! client characteristic configuration descriptors settings, indexed by above enumeration */
static
const
attsCccSet_t
fit
CccSet
[
FIT
_NUM_CCC_IDX
]
=
static
const
attsCccSet_t
ble
CccSet
[
BLE
_NUM_CCC_IDX
]
=
{
/* cccd handle value range security level */
{
GATT_SC_CH_CCC_HDL
,
ATT_CLIENT_CFG_INDICATE
,
DM_SEC_LEVEL_NONE
},
/* FIT_GATT_SC_CCC_IDX */
{
HRS_HRM_CH_CCC_HDL
,
ATT_CLIENT_CFG_NOTIFY
,
DM_SEC_LEVEL_NONE
},
/* FIT_HRS_HRM_CCC_IDX */
{
BATT_LVL_CH_CCC_HDL
,
ATT_CLIENT_CFG_NOTIFY
,
DM_SEC_LEVEL_NONE
},
/* FIT_BATT_LVL_CCC_IDX */
{
RSCS_RSM_CH_CCC_HDL
,
ATT_CLIENT_CFG_NOTIFY
,
DM_SEC_LEVEL_NONE
}
/* FIT_RSCS_SM_CCC_IDX */
{
GATT_SC_CH_CCC_HDL
,
ATT_CLIENT_CFG_INDICATE
,
DM_SEC_LEVEL_NONE
},
/* BLE_GATT_SC_CCC_IDX */
{
BATT_LVL_CH_CCC_HDL
,
ATT_CLIENT_CFG_NOTIFY
,
DM_SEC_LEVEL_NONE
},
/* BLE_BATT_LVL_CCC_IDX */
};
/**************************************************************************************************
...
...
@@ -209,19 +177,10 @@ static const attsCccSet_t fitCccSet[FIT_NUM_CCC_IDX] =
**************************************************************************************************/
/*! WSF handler ID */
wsfHandlerId_t
fitHandlerId
;
/* WSF Timer to send running speed and cadence measurement data */
wsfTimer_t
fitRscmTimer
;
/* Running Speed and Cadence Measurement period - Can be changed at runtime to vary period */
static
uint16_t
fitRscmPeriod
=
FIT_DEFAULT_RSCM_PERIOD
;
wsfHandlerId_t
bleHandlerId
;
/* 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
);
static
void
BleHandler
(
wsfEventMask_t
event
,
wsfMsgHdr_t
*
pMsg
);
/*************************************************************************************************/
/*!
* \brief Application DM callback.
...
...
@@ -231,7 +190,7 @@ static void FitHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg);
* \return None.
*/
/*************************************************************************************************/
static
void
fit
DmCback
(
dmEvt_t
*
pDmEvt
)
static
void
ble
DmCback
(
dmEvt_t
*
pDmEvt
)
{
dmEvt_t
*
pMsg
;
uint16_t
len
;
...
...
@@ -241,7 +200,7 @@ static void fitDmCback(dmEvt_t *pDmEvt)
if
((
pMsg
=
WsfMsgAlloc
(
len
))
!=
NULL
)
{
memcpy
(
pMsg
,
pDmEvt
,
len
);
WsfMsgSend
(
fit
HandlerId
,
pMsg
);
WsfMsgSend
(
ble
HandlerId
,
pMsg
);
}
}
...
...
@@ -254,7 +213,7 @@ static void fitDmCback(dmEvt_t *pDmEvt)
* \return None.
*/
/*************************************************************************************************/
static
void
fit
AttCback
(
attEvt_t
*
pEvt
)
static
void
ble
AttCback
(
attEvt_t
*
pEvt
)
{
attEvt_t
*
pMsg
;
...
...
@@ -263,7 +222,7 @@ static void fitAttCback(attEvt_t *pEvt)
memcpy
(
pMsg
,
pEvt
,
sizeof
(
attEvt_t
));
pMsg
->
pValue
=
(
uint8_t
*
)
(
pMsg
+
1
);
memcpy
(
pMsg
->
pValue
,
pEvt
->
pValue
,
pEvt
->
valueLen
);
WsfMsgSend
(
fit
HandlerId
,
pMsg
);
WsfMsgSend
(
ble
HandlerId
,
pMsg
);
}
}
...
...
@@ -276,7 +235,7 @@ static void fitAttCback(attEvt_t *pEvt)
* \return None.
*/
/*************************************************************************************************/
static
void
fit
CccCback
(
attsCccEvt_t
*
pEvt
)
static
void
ble
CccCback
(
attsCccEvt_t
*
pEvt
)
{
attsCccEvt_t
*
pMsg
;
appDbHdl_t
dbHdl
;
...
...
@@ -292,48 +251,11 @@ static void fitCccCback(attsCccEvt_t *pEvt)
if
((
pMsg
=
WsfMsgAlloc
(
sizeof
(
attsCccEvt_t
)))
!=
NULL
)
{
memcpy
(
pMsg
,
pEvt
,
sizeof
(
attsCccEvt_t
));
WsfMsgSend
(
fit
HandlerId
,
pMsg
);
WsfMsgSend
(
ble
HandlerId
,
pMsg
);
}
}
/*************************************************************************************************/
/*!
* \brief Send a Running Speed and Cadence Measurement Notification.
*
* \param connId connection ID
*
* \return None.
*/
/*************************************************************************************************/
static
void
fitSendRunningSpeedMeasurement
(
dmConnId_t
connId
)
{
if
(
AttsCccEnabled
(
connId
,
FIT_RSCS_SM_CCC_IDX
))
{
static
uint8_t
walk_run
=
1
;
/* TODO: Set Running Speed and Cadence Measurement Parameters */
RscpsSetParameter
(
RSCP_SM_PARAM_SPEED
,
1
);
RscpsSetParameter
(
RSCP_SM_PARAM_CADENCE
,
2
);
RscpsSetParameter
(
RSCP_SM_PARAM_STRIDE_LENGTH
,
3
);
RscpsSetParameter
(
RSCP_SM_PARAM_TOTAL_DISTANCE
,
4
);
/* Toggle running/walking */
walk_run
=
walk_run
?
0
:
1
;
RscpsSetParameter
(
RSCP_SM_PARAM_STATUS
,
walk_run
);
RscpsSendSpeedMeasurement
(
connId
);
}
/* Configure and start timer to send the next measurement */
fitRscmTimer
.
msg
.
event
=
FIT_RUNNING_TIMER_IND
;
fitRscmTimer
.
msg
.
status
=
FIT_RSCS_SM_CCC_IDX
;
fitRscmTimer
.
handlerId
=
fitHandlerId
;
fitRscmTimer
.
msg
.
param
=
connId
;
WsfTimerStartSec
(
&
fitRscmTimer
,
fitRscmPeriod
);
}
/*************************************************************************************************/
/*!
...
...
@@ -344,44 +266,16 @@ static void fitSendRunningSpeedMeasurement(dmConnId_t connId)
* \return None.
*/
/*************************************************************************************************/
static
void
fit
ProcCccState
(
fit
Msg_t
*
pMsg
)
static
void
ble
ProcCccState
(
ble
Msg_t
*
pMsg
)
{
APP_TRACE_INFO3
(
"ccc state ind value:%d handle:%d idx:%d"
,
pMsg
->
ccc
.
value
,
pMsg
->
ccc
.
handle
,
pMsg
->
ccc
.
idx
);
/* handle heart rate measurement CCC */
if
(
pMsg
->
ccc
.
idx
==
FIT_HRS_HRM_CCC_IDX
)
{
if
(
pMsg
->
ccc
.
value
==
ATT_CLIENT_CFG_NOTIFY
)
{
HrpsMeasStart
((
dmConnId_t
)
pMsg
->
ccc
.
hdr
.
param
,
FIT_HR_TIMER_IND
,
FIT_HRS_HRM_CCC_IDX
);
}
else
{
HrpsMeasStop
((
dmConnId_t
)
pMsg
->
ccc
.
hdr
.
param
);
}
return
;
}
/* handle running speed and cadence measurement CCC */
if
(
pMsg
->
ccc
.
idx
==
FIT_RSCS_SM_CCC_IDX
)
{
if
(
pMsg
->
ccc
.
value
==
ATT_CLIENT_CFG_NOTIFY
)
{
fitSendRunningSpeedMeasurement
((
dmConnId_t
)
pMsg
->
ccc
.
hdr
.
param
);
}
else
{
WsfTimerStop
(
&
fitRscmTimer
);
}
return
;
}
/* handle battery level CCC */
if
(
pMsg
->
ccc
.
idx
==
FIT
_BATT_LVL_CCC_IDX
)
if
(
pMsg
->
ccc
.
idx
==
BLE
_BATT_LVL_CCC_IDX
)
{
if
(
pMsg
->
ccc
.
value
==
ATT_CLIENT_CFG_NOTIFY
)
{
BasMeasBattStart
((
dmConnId_t
)
pMsg
->
ccc
.
hdr
.
param
,
FIT
_BATT_TIMER_IND
,
FIT
_BATT_LVL_CCC_IDX
);
BasMeasBattStart
((
dmConnId_t
)
pMsg
->
ccc
.
hdr
.
param
,
BLE
_BATT_TIMER_IND
,
BLE
_BATT_LVL_CCC_IDX
);
}
else
{
...
...
@@ -400,16 +294,10 @@ static void fitProcCccState(fitMsg_t *pMsg)
* \return None.
*/
/*************************************************************************************************/
static
void
fit
Close
(
fit
Msg_t
*
pMsg
)
static
void
ble
Close
(
ble
Msg_t
*
pMsg
)
{
/* stop heart rate measurement */
HrpsMeasStop
((
dmConnId_t
)
pMsg
->
hdr
.
param
);
/* stop battery measurement */
BasMeasBattStop
((
dmConnId_t
)
pMsg
->
hdr
.
param
);
/* Stop running speed and cadence timer */
WsfTimerStop
(
&
fitRscmTimer
);
}
/*************************************************************************************************/
...
...
@@ -422,11 +310,11 @@ static void fitClose(fitMsg_t *pMsg)
* \return None.
*/
/*************************************************************************************************/
static
void
fit
Setup
(
fit
Msg_t
*
pMsg
)
static
void
ble
Setup
(
ble
Msg_t
*
pMsg
)
{
/* set advertising and scan response data for discoverable mode */
AppAdvSetData
(
APP_ADV_DATA_DISCOVERABLE
,
sizeof
(
fit
AdvDataDisc
),
(
uint8_t
*
)
fit
AdvDataDisc
);
AppAdvSetData
(
APP_SCAN_DATA_DISCOVERABLE
,
sizeof
(
fit
ScanDataDisc
),
(
uint8_t
*
)
fit
ScanDataDisc
);
AppAdvSetData
(
APP_ADV_DATA_DISCOVERABLE
,
sizeof
(
ble
AdvDataDisc
),
(
uint8_t
*
)
ble
AdvDataDisc
);
AppAdvSetData
(
APP_SCAN_DATA_DISCOVERABLE
,
sizeof
(
ble
ScanDataDisc
),
(
uint8_t
*
)
ble
ScanDataDisc
);
/* set advertising and scan response data for connectable mode */
AppAdvSetData
(
APP_ADV_DATA_CONNECTABLE
,
0
,
NULL
);
...
...
@@ -436,120 +324,6 @@ static void fitSetup(fitMsg_t *pMsg)
AppAdvStart
(
APP_MODE_AUTO_INIT
);
}
/*************************************************************************************************/
/*!
* \brief Button press callback.
*
* \param btn Button press.
*
* \return None.
*/
/*************************************************************************************************/
static
void
fitBtnCback
(
uint8_t
btn
)
{
dmConnId_t
connId
;
static
uint8_t
heartRate
=
78
;
/* for testing/demonstration */
/* button actions when connected */
if
((
connId
=
AppConnIsOpen
())
!=
DM_CONN_ID_NONE
)
{
switch
(
btn
)
{
case
APP_UI_BTN_1_SHORT
:
/* increment the heart rate */
AppHwHrmTest
(
++
heartRate
);
break
;
case
APP_UI_BTN_1_MED
:
break
;
case
APP_UI_BTN_1_LONG
:
AppConnClose
(
connId
);
break
;
case
APP_UI_BTN_2_SHORT
:
/* decrement the heart rate */
AppHwHrmTest
(
--
heartRate
);
break
;
case
APP_UI_BTN_2_MED
:
/* Toggle HRM Sensor DET flags */
if
(
!
(
fitHrmFlags
&
(
CH_HRM_FLAGS_SENSOR_DET
|
CH_HRM_FLAGS_SENSOR_NOT_DET
)))
{
fitHrmFlags
|=
CH_HRM_FLAGS_SENSOR_DET
;
}
else
if
(
fitHrmFlags
&
CH_HRM_FLAGS_SENSOR_DET
)
{
fitHrmFlags
&=
~
CH_HRM_FLAGS_SENSOR_DET
;
fitHrmFlags
|=
CH_HRM_FLAGS_SENSOR_NOT_DET
;
}
else
{
fitHrmFlags
&=
~
CH_HRM_FLAGS_SENSOR_NOT_DET
;
}
HrpsSetFlags
(
fitHrmFlags
);
break
;
case
APP_UI_BTN_2_LONG
:
/* Toggle HRM RR Interval feature flag */
if
(
fitHrmFlags
&
CH_HRM_FLAGS_RR_INTERVAL
)
{
fitHrmFlags
&=
~
CH_HRM_FLAGS_RR_INTERVAL
;
}
else
{
fitHrmFlags
|=
CH_HRM_FLAGS_RR_INTERVAL
;
}
HrpsSetFlags
(
fitHrmFlags
);
break
;
default:
break
;
}
}
/* button actions when not connected */
else
{
switch
(
btn
)
{
case
APP_UI_BTN_1_SHORT
:
/* start or restart advertising */
AppAdvStart
(
APP_MODE_AUTO_INIT
);
break
;
case
APP_UI_BTN_1_MED
:
/* enter discoverable and bondable mode mode */
AppSetBondable
(
TRUE
);
AppAdvStart
(
APP_MODE_DISCOVERABLE
);
break
;
case
APP_UI_BTN_1_LONG
:
/* clear bonded device info and restart advertising */
AppDbDeleteAllRecords
();
AppAdvStart
(
APP_MODE_AUTO_INIT
);
break
;
case
APP_UI_BTN_2_SHORT
:
/* Toggle HRM Flag for 8 and 16 bit values */
if
(
fitHrmFlags
&
CH_HRM_FLAGS_VALUE_16BIT
)
{
fitHrmFlags
&=
~
CH_HRM_FLAGS_VALUE_16BIT
;
}
else
{
fitHrmFlags
|=
CH_HRM_FLAGS_VALUE_16BIT
;
}
HrpsSetFlags
(
fitHrmFlags
);
break
;
default:
break
;
}
}
}
/*************************************************************************************************/
/*!
...
...
@@ -560,36 +334,27 @@ static void fitBtnCback(uint8_t btn)
* \return None.
*/
/*************************************************************************************************/
static
void
fit
ProcMsg
(
fit
Msg_t
*
pMsg
)
static
void
ble
ProcMsg
(
ble
Msg_t
*
pMsg
)
{
uint8_t
uiEvent
=
APP_UI_NONE
;
switch
(
pMsg
->
hdr
.
event
)
{
case
FIT_RUNNING_TIMER_IND
:
fitSendRunningSpeedMeasurement
((
dmConnId_t
)
pMsg
->
ccc
.
hdr
.
param
);
break
;
case
FIT_HR_TIMER_IND
:
HrpsProcMsg
(
&
pMsg
->
hdr
);
break
;
case
FIT_BATT_TIMER_IND
:
case
BLE_BATT_TIMER_IND
:
BasProcMsg
(
&
pMsg
->
hdr
);
break
;
case
ATTS_HANDLE_VALUE_CNF
:
HrpsProcMsg
(
&
pMsg
->
hdr
);
BasProcMsg
(
&
pMsg
->
hdr
);
break
;
case
ATTS_CCC_STATE_IND
:
fit
ProcCccState
(
pMsg
);
ble
ProcCccState
(
pMsg
);
break
;
case
DM_RESET_CMPL_IND
:
DmSecGenerateEccKeyReq
();
fit
Setup
(
pMsg
);
ble
Setup
(
pMsg
);
uiEvent
=
APP_UI_RESET_CMPL
;
break
;
...
...
@@ -602,13 +367,12 @@ static void fitProcMsg(fitMsg_t *pMsg)
break
;
case
DM_CONN_OPEN_IND
:
HrpsProcMsg
(
&
pMsg
->
hdr
);
BasProcMsg
(
&
pMsg
->
hdr
);
uiEvent
=
APP_UI_CONN_OPEN
;
break
;
case
DM_CONN_CLOSE_IND
:
fit
Close
(
pMsg
);
ble
Close
(
pMsg
);
uiEvent
=
APP_UI_CONN_CLOSE
;
break
;
...
...
@@ -663,31 +427,27 @@ static void fitProcMsg(fitMsg_t *pMsg)
* \return None.
*/
/*************************************************************************************************/
static
void
Fit
HandlerInit
(
void
)
static
void
Ble
HandlerInit
(
void
)
{
APP_TRACE_INFO0
(
"
Fit
HandlerInit"
);
APP_TRACE_INFO0
(
"
Ble
HandlerInit"
);
/* store handler ID */
fit
HandlerId
=
WsfOsSetNextHandler
(
Fit
Handler
);
ble
HandlerId
=
WsfOsSetNextHandler
(
Ble
Handler
);
/* Set configuration pointers */
pAppAdvCfg
=
(
appAdvCfg_t
*
)
&
fit
AdvCfg
;
pAppSlaveCfg
=
(
appSlaveCfg_t
*
)
&
fit
SlaveCfg
;
pAppSecCfg
=
(
appSecCfg_t
*
)
&
fit
SecCfg
;
pAppUpdateCfg
=
(
appUpdateCfg_t
*
)
&
fit
UpdateCfg
;
pAppAdvCfg
=
(
appAdvCfg_t
*
)
&
ble
AdvCfg
;
pAppSlaveCfg
=
(
appSlaveCfg_t
*
)
&
ble
SlaveCfg
;
pAppSecCfg
=
(
appSecCfg_t
*
)
&
ble
SecCfg
;
pAppUpdateCfg
=
(
appUpdateCfg_t
*
)
&
ble
UpdateCfg
;
/* Initialize application framework */
AppSlaveInit
();
/* Set stack configuration pointers */
pSmpCfg
=
(
smpCfg_t
*
)
&
fitSmpCfg
;
/* initialize heart rate profile sensor */
HrpsInit
(
fitHandlerId
,
(
hrpsCfg_t
*
)
&
fitHrpsCfg
);
HrpsSetFlags
(
fitHrmFlags
);
pSmpCfg
=
(
smpCfg_t
*
)
&
bleSmpCfg
;
/* initialize battery service server */
BasInit
(
fit
HandlerId
,
(
basCfg_t
*
)
&
fit
BasCfg
);
BasInit
(
ble
HandlerId
,
(
basCfg_t
*
)
&
ble
BasCfg
);
}
/*************************************************************************************************/
...
...
@@ -700,11 +460,11 @@ static void FitHandlerInit(void)
* \return None.
*/
/*************************************************************************************************/
static
void
Fit
Handler
(
wsfEventMask_t
event
,
wsfMsgHdr_t
*
pMsg
)