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
fleur
firmware
Commits
ba56b7af
Commit
ba56b7af
authored
Aug 24, 2019
by
Rahix
Browse files
Merge 'Add extra logs to BLE'
See merge request
card10/firmware!248
parents
40ae65a4
aece2960
Changes
2
Show whitespace changes
Inline
Side-by-side
epicardium/ble/app/app_main.c
View file @
ba56b7af
...
...
@@ -37,6 +37,8 @@
#include
"app_main.h"
#include
"app_ui.h"
#include
"modules/log.h"
/**************************************************************************************************
Global Variables
**************************************************************************************************/
...
...
@@ -283,6 +285,8 @@ void AppHandleNumericComparison(dmSecCnfIndEvt_t *pCnfInd)
{
uint32_t
confirm
=
DmSecGetCompareValue
(
pCnfInd
->
confirm
);
LOG_INFO
(
"ble"
,
"Confirm Value: %ld"
,
confirm
);
/* display confirmation value */
AppUiDisplayConfirmValue
(
confirm
);
...
...
epicardium/ble/ble_main.c
View file @
ba56b7af
...
...
@@ -38,6 +38,8 @@
#include
"hrps/hrps_api.h"
#include
"rscp/rscp_api.h"
#include
"modules/log.h"
/**************************************************************************************************
Macros
**************************************************************************************************/
...
...
@@ -373,6 +375,7 @@ static void bleSetup(bleMsg_t *pMsg)
static
void
bleProcMsg
(
bleMsg_t
*
pMsg
)
{
uint8_t
uiEvent
=
APP_UI_NONE
;
hciLeConnCmplEvt_t
*
connOpen
;
switch
(
pMsg
->
hdr
.
event
)
{
...
...
@@ -395,36 +398,88 @@ static void bleProcMsg(bleMsg_t *pMsg)
break
;
case
DM_ADV_START_IND
:
LOG_INFO
(
"ble"
,
"Advertisement started"
);
uiEvent
=
APP_UI_ADV_START
;
break
;
case
DM_ADV_STOP_IND
:
LOG_INFO
(
"ble"
,
"Advertisement stopped"
);
uiEvent
=
APP_UI_ADV_STOP
;
break
;
case
DM_CONN_OPEN_IND
:
connOpen
=
&
pMsg
->
dm
.
connOpen
;
LOG_INFO
(
"ble"
,
"connection from %02X:%02X:%02X:%02X:%02X:%02X opened"
,
connOpen
->
peerAddr
[
0
],
connOpen
->
peerAddr
[
1
],
connOpen
->
peerAddr
[
2
],
connOpen
->
peerAddr
[
3
],
connOpen
->
peerAddr
[
4
],
connOpen
->
peerAddr
[
5
]);
BasProcMsg
(
&
pMsg
->
hdr
);
uiEvent
=
APP_UI_CONN_OPEN
;
break
;
case
DM_CONN_CLOSE_IND
:
switch
(
pMsg
->
dm
.
connClose
.
reason
)
{
case
HCI_ERR_CONN_TIMEOUT
:
LOG_INFO
(
"ble"
,
"Connection closed (0x%02X), Connection timeout"
,
pMsg
->
dm
.
connClose
.
reason
);
break
;
case
HCI_ERR_LOCAL_TERMINATED
:
LOG_INFO
(
"ble"
,
"Connection closed (0x%02X), Connection terminated by local host"
,
pMsg
->
dm
.
connClose
.
reason
);
break
;
case
HCI_ERR_REMOTE_TERMINATED
:
LOG_INFO
(
"ble"
,
"Connection closed (0x%02X), Remote user terminated connection"
,
pMsg
->
dm
.
connClose
.
reason
);
break
;
case
HCI_ERR_CONN_FAIL
:
LOG_INFO
(
"ble"
,
"Connection closed (0x%02X), Connection failed to be established"
,
pMsg
->
dm
.
connClose
.
reason
);
break
;
case
HCI_ERR_MIC_FAILURE
:
LOG_INFO
(
"ble"
,
"Connection closed (0x%02X), Connection terminated due to MIC failure"
,
pMsg
->
dm
.
connClose
.
reason
);
break
;
default:
LOG_INFO
(
"ble"
,
"Connection closed (0x%02X)"
,
pMsg
->
dm
.
connClose
.
reason
);
break
;
}
bleClose
(
pMsg
);
uiEvent
=
APP_UI_CONN_CLOSE
;
break
;
case
DM_SEC_PAIR_CMPL_IND
:
LOG_INFO
(
"ble"
,
"Secure pairing successful, auth: 0x%02X"
,
pMsg
->
dm
.
pairCmpl
.
auth
);
uiEvent
=
APP_UI_SEC_PAIR_CMPL
;
break
;
case
DM_SEC_PAIR_FAIL_IND
:
switch
(
pMsg
->
hdr
.
status
)
{
case
SMP_ERR_TIMEOUT
:
LOG_INFO
(
"ble"
,
"Secure pairing failed (0x%02X), Transaction timeout"
,
pMsg
->
hdr
.
status
);
break
;
case
SMP_ERR_ATTEMPTS
:
LOG_INFO
(
"ble"
,
"Secure pairing failed (0x%02X), Repeated attempts"
,
pMsg
->
hdr
.
status
);
break
;
default:
LOG_INFO
(
"ble"
,
"Secure pairing failed (0x%02X)"
,
pMsg
->
hdr
.
status
);
break
;
}
uiEvent
=
APP_UI_SEC_PAIR_FAIL
;
break
;
case
DM_SEC_ENCRYPT_IND
:
LOG_INFO
(
"ble"
,
"Encrypted handshake successful"
);
uiEvent
=
APP_UI_SEC_ENCRYPT
;
break
;
case
DM_SEC_ENCRYPT_FAIL_IND
:
LOG_INFO
(
"ble"
,
"Encrypted handshake failed"
);
uiEvent
=
APP_UI_SEC_ENCRYPT_FAIL
;
break
;
...
...
@@ -441,6 +496,7 @@ static void bleProcMsg(bleMsg_t *pMsg)
break
;
case
DM_HW_ERROR_IND
:
LOG_ERR
(
"ble"
,
"HW Error"
);
uiEvent
=
APP_UI_HW_ERROR
;
break
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment