SDK为应用程序绑定数据库函数提供回调,可以用用户函数替换。但是,struct bond\u db是在app\u bond\u db.c文件中定义的(不在头文件中),而bond\u db声明在app\u bond\u db.c中是静态的,因此在不修改SDK文件的情况下,很难为app\u bond\u db\u回调提供有意义的用户定义替换。我尽量不这样做,因为这使得在进行自定义修改时升级SDK非常困难。
在设计中,我们的应用程序会将bond DB存储在另一个处理器的flash存储器中,因此封装的SPI\u flash和I2C\u EEPROM功能不适用。如果SDK提供了一个函数来检索bond\u db结构的地址和大小,这将非常好,这将允许在不修改SDK的情况下重写默认回调。现在,我需要修改SDK来提供这个功能。
Device:
As a followup to my first post, is there a good way to handle retrieval of the bond database "asynchronously"? For example, as mentioned our system will store the bond database in a separate processor. So when it is time to initialize the bond db, the DA14585 will request (via SPI bus) transfer of the bond db from the other processor; the actual transfer will complete some time later. The SPI processing is handled via callback (specifically during the user_on_system_powered() callback), so I can't just block the app_bdb_init() call while I wait for this transfer to take place.
I could just return from the app_bdb_init() function and "backfill" the bond db when it has been received, but I fear this could cause other problems. Any suggestions on handling this situation? Thanks.
Hi mkelwood,
你能再解释一下你想完成什么吗?如果我能从你的线程中理解,你想完成的是开始读取键合数据,但你想在程序没有完成之前启动程序?当键合过程完成后,应该触发回调吗?请进一步说明。
谢谢,下午好
Hello PM_Dialog,
That's roughly correct. The problem is that I will either need to return from app_bdb_init() before the bond database is retrieved, or block in app_bdb_init() while calling the scheduler to allow the SPI bus processing in the user_on_system_powered() callback to continue, similar to what is done in bond_db_erase_flash_sectors(). In the first case I would populate the bond_db structure either by message handling or directly in the SPI processing code once the bond database was retrieved from the other processor. This case is easier to implement, but it may be dangerous to return from app_dbd_init() without a valid bond database in place. The second case (block and call scheduler from within app_dbd_init()) may be safer but is more difficult to implement correctly, and it will only work if the rwip_schedule() call will allow the SPI processing to continue by calling user_on_system_powered() as needed.
So my question is (A) is it safe to return from app_bdb_init() and proceed with the application startup before the bond database is available, and if not, then (B) will the block-and-schedule scheme work by calling user_on_system_powered() as needed until the bond database is received?
Also, per my first post, since the bond database load and store mechanisms are not hooked to app_bond_db_callbacks, I have no choice but to modify the SDK to implement custom load and store mechanisms, which is unfortunate.
Hi mkelwood,
Thanks for your information. I will check your issue and I will let you know shortly.
谢谢,下午好
Hello PM_Dialog,
I implemented Scheme A above: proceed from app_bdb_init() with an invalid database and back-fill the bond database after it is retrieved from other processor. This seems to work properly. I suppose there is a small window where a pairing event could occur without a valid database in place (any modifications would get over-written), but I estimate that the whole process is complete before the first advertise packet even goes out on the radio. In any case we will probably have to live with that risk.
It would be nice to get confirmation that this scheme does not have other (unknown to me) caveats. Any information you can provide would be appreciated.
Hi mkelwood,
由于延误深表歉意or the procedure you have provided. Could you please clarify if this procedure fixes your issue? As you mentioned you SDK modify the SDK (I would not recommend it), but I don’t have any news on this.
谢谢,下午好
Hi PM_Dialog,
The described procedure seems to be working fine for us. I closed the window by delaying the start of advertising until the bond database was retrieved and in place, so there should be no possibility of a connection attempt with an invalid database. This procedure does require changes to the SDK in app_bond_db.c. I agree that this is unfortunate, but the published callback structure for the bond database does not support implementation of a custom storage method for the bond database (which was the reason for my original post here). I hope the development team will rectify this at some point.
致以最诚挚的问候,
MKE公司
Hi mkelwood,
As it is mentioned in the last post, it is not recommended to modify the SDK, but glad that you figured your issue out and thank you for your indication.
谢谢,下午好