From the documentation about dev_char_info_t conn_dev_list[DEVICE_CHAR_INFO_MAX_NUM];
* Used for store information of connected devices.
*
* MASTER_MAX_NUM SLAVE_MAX_NUM master slave
* 1 1 conn_dev_list[0] conn_dev_list[1]
I use configuration 1 master and 1 slave
In the previous version of the SDK (telink_b85m_ble_sdk_alpha_v4.0.0) this worked fine.
When I connected my phone to the module I had:
conn_dev_list[1].conn_role = LL_ROLE_SLAVE
conn_dev_list[1].conn_state = 1
When I connected the module to another BLE device, I had:
conn_dev_list[0].conn_role = LL_ROLE_MASTER
conn_dev_list[0].conn_state = 1
So, everything was working as I expected.
Now, with the latest SDK the results are:
When I connected my phone to the module I had:
conn_dev_list[1].conn_role = 0
conn_dev_list[1].conn_state =0
When I connected the module to another BLE device, I had:
conn_dev_list[0].conn_role = LL_ROLE_MASTER
conn_dev_list[0].conn_state = 1
So, when the phone is connected to the module conn_dev_list[1] is not set.
Is it something that was removed from the latest version of the SDK?
If so, why?
It is really hard to change project to newer versions of the SDK. Some definitions of the structures have been removed, some things that used to work don t work.
And there is lack of information about the changes, so you have to learn the hard way, by compiling the code, then seeing the error because something was changed/removed, and trying to find out why there is an error now, ... and so on.
Edit:
Regarding documentation and changes, just found out in Telink BLE Multi-connection SDK Developer Handbook AN-20050601-E1, paragraph 4.2.3 API blc_pm_setSuspendMask:
API for configuring low power management:
void blc_pm_setSuspendMask (u8 mask);
Use blc_pm_setSuspendMask to set blmsPm.suspend_mask
The problem is the function blc_pm_setSuspendMask doesn't exist in Mulit Connection SDK
So how do I disable Suspend mode?
Do I use blc_pm_setSleepMask(PM_SLEEP_DISABLE); Is this the same what used to be bls_pm_setSuspendMask(...)?
No related topics |
I did further checking.
I am using 1 master and 1 slave so in app_config.h I have:
#define CONN_MAX_NUM_CONFIG CONN_MAX_NUM_M1_S1
#define MASTER_MAX_NUM 1
#define SLAVE_MAX_NUM 1
In app_le_connection_complete_event_handle()
I added return value index to dev_char_info_insert_by_conn_event
int index = dev_char_info_insert_by_conn_event(pConnEvt);
After I connect my phone to the module, I receive in uart the following values:
index = 4 <- index should be 1 for 1 master and 1 slave
conn_dev_list[index].conn_state = 1
conn_dev_list[1].conn_state = 0 <- this should be 1
According to description in device_manage.c (line 67) and what I posted in previous post, for 1 master and 1 slave, index should be 1 not 4.
Am I correct?
So why is it happening?
Edit:
I changed in device_manage.h from 4 to 1, thinking that maybe it overrides what is defined in app_config.h.
#ifndef MASTER_MAX_NUM
#define MASTER_MAX_NUM 1
#endif
#ifndef SLAVE_MAX_NUM
#define SLAVE_MAX_NUM 1
#endif
And this work. So, define in device_manage.h ignores the defines in app_config.h.
Issue resolved by deleting and reinstalling Multi Connection SDK.
No idea why it happened though!