Skip to content

Commit 219707d

Browse files
committed
messing around, but have somehow have ble_att_tx_with_conn printing
1 parent 505c190 commit 219707d

4 files changed

Lines changed: 59 additions & 4 deletions

File tree

src/NimBLELog.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@
173173
# define NIMBLE_LOGE(tag, format, ...) (void)tag
174174
# endif
175175

176+
# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 0
177+
# define NIMBLE_LOGC(tag, format, ...) console_printf("C (%lu) %s: " format "\n", millis(), tag, ##__VA_ARGS__)
178+
# else
179+
# define NIMBLE_LOGC(tag, format, ...) (void)tag
180+
# endif
181+
176182
# endif /* !USING_NIMBLE_ARDUINO_HEADERS */
177183

178184
# define NIMBLE_LOGD_IF(cond, tag, format, ...) { if (cond) { NIMBLE_LOGD(tag, format, ##__VA_ARGS__); }}

src/nimble/nimble/host/src/ble_gap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5809,6 +5809,8 @@ ble_gap_connect(uint8_t own_addr_type, const ble_addr_t *peer_addr,
58095809
const struct ble_gap_conn_params *conn_params,
58105810
ble_gap_event_fn *cb, void *cb_arg)
58115811
{
5812+
printf("HIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\n");
5813+
BLE_HS_LOG(INFO, "YOUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\n");
58125814
#if MYNEWT_VAL(BLE_ROLE_CENTRAL)
58135815
#if MYNEWT_VAL(BLE_EXT_ADV)
58145816
return ble_gap_ext_connect(own_addr_type, peer_addr, duration_ms,
@@ -5889,6 +5891,7 @@ ble_gap_connect(uint8_t own_addr_type, const ble_addr_t *peer_addr,
58895891
}
58905892

58915893
BLE_HS_LOG(INFO, "GAP procedure initiated: connect; ");
5894+
printf("HHIIIIIIIIIIIIIIIIIIIIIII");
58925895
ble_gap_log_conn(own_addr_type, peer_addr, conn_params);
58935896
BLE_HS_LOG(INFO, "\n");
58945897

src/nimble/porting/npl/freertos/include/nimble/nimble_npl_os_log.h

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#ifndef _NIMBLE_NPL_OS_LOG_H_
2121
#define _NIMBLE_NPL_OS_LOG_H_
22+
#include <stdio.h>
2223

2324
#ifdef ESP_PLATFORM
2425
#include <stdarg.h>
@@ -60,7 +61,52 @@
6061
}
6162

6263
# else
63-
#define BLE_NPL_LOG_IMPL(lvl) \
64-
static inline void _BLE_NPL_LOG_CAT(BLE_NPL_LOG_MODULE, _BLE_NPL_LOG_CAT(_, lvl))(const char *fmt, ...) { }
64+
#include "NimBLELog.h"
65+
#include "syscfg.h"
66+
67+
#define BLE_NPL_LOG_IMPL(lvl) \
68+
static inline void _BLE_NPL_LOG_CAT( \
69+
BLE_NPL_LOG_MODULE, _BLE_NPL_LOG_CAT(_, lvl))(const char *fmt, ...) \
70+
{ \
71+
printf("OH SO YOU MADE IT!!!\n"); \
72+
if (MYNEWT_VAL_BLE_HS_LOG_LVL <= _BLE_LOG_LEVEL_VALUE(lvl)) { \
73+
va_list args; \
74+
va_start(args, fmt); \
75+
/* or NIMBLE_LOGD/I/W/E-style dispatch if you want it tagged */ \
76+
vprintf(fmt, args); \
77+
va_end(args); \
78+
} \
79+
}
80+
81+
# if MYNEWT_VAL_BLE_HS_LOG_LVL <= 4
82+
# define BLE_HS_LOG_CRITICAL(...) NIMBLE_LOGC(BLE_NPL_LOG_MODULE, __VA_ARGS__)
83+
# else
84+
# define BLE_HS_LOG_CRITICAL(...) (void)tag
85+
# endif
86+
87+
# if MYNEWT_VAL_BLE_HS_LOG_LVL <= 3
88+
# define BLE_HS_LOG_ERROR(...) NIMBLE_LOGE(BLE_NPL_LOG_MODULE, __VA_ARGS__)
89+
# else
90+
# define BLE_HS_LOG_ERROR(...) (void)tag
91+
# endif
92+
93+
# if MYNEWT_VAL_BLE_HS_LOG_LVL <= 2
94+
# define BLE_HS_LOG_WARN(...) NIMBLE_LOGW(BLE_NPL_LOG_MODULE, __VA_ARGS__)
95+
# else
96+
# define BLE_HS_LOG_WARN(...) (void)tag
97+
# endif
98+
99+
# if MYNEWT_VAL_BLE_HS_LOG_LVL <= 1
100+
# define BLE_HS_LOG_INFO(...) NIMBLE_LOGI(BLE_NPL_LOG_MODULE, __VA_ARGS__)
101+
# else
102+
# define BLE_HS_LOG_INFO(...) (void)tag
103+
# endif
104+
105+
# if MYNEWT_VAL_BLE_HS_LOG_LVL <= 0
106+
# define BLE_HS_LOG_DEBUG(...) NIMBLE_LOGD(BLE_NPL_LOG_MODULE, __VA_ARGS__)
107+
# else
108+
# define BLE_HS_LOG_DEBUG(...) (void)tag
109+
# endif
110+
65111
#endif
66112
#endif /* _NIMBLE_NPL_OS_LOG_H_ */

src/nimconfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Values: 0 = DEBUG, 1 = INFO, 2 = WARNING, 3 = ERROR, 4 = CRITICAL, 5+ = NONE\n
1919
* Uses approx. 32kB of flash memory.
2020
*/
21-
// #define MYNEWT_VAL_BLE_HS_LOG_LVL 5
21+
#define MYNEWT_VAL_BLE_HS_LOG_LVL 0
2222

2323
/** @brief Un-comment to change the default GAP appearance */
2424
// #define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE 0x0
@@ -106,7 +106,7 @@
106106
* Values: 0 = NONE, 1 = ERROR, 2 = WARNING, 3 = INFO, 4+ = DEBUG\n
107107
* Uses approx. 32kB of flash memory.
108108
*/
109-
// #define MYNEWT_VAL_NIMBLE_CPP_LOG_LEVEL 0
109+
#define MYNEWT_VAL_NIMBLE_CPP_LOG_LEVEL 4
110110

111111
/** @brief Un-comment to enable the debug asserts in NimBLE CPP wrapper.*/
112112
// #define MYNEWT_VAL_NIMBLE_CPP_DEBUG_ASSERT_ENABLED 1

0 commit comments

Comments
 (0)