设备名称和NVDS

17 posts / 0 new
Last post
Zwang308.
离线
Last seen:4年2个月前
Master
Joined:2014-07-02 14:15
设备名称和NVDS

嗨对话框,

在Sample128项目中,我在app_adv_function中将设备名称设置为“12345”。我还将NVDS中的设备名称设置为“ABC”,同时unefine CFG_NVDS。在这种情况下,我认为BLE堆栈不会再使用NVD。

But, I found in LightBlue app, only in scanning mode(when we could see a list of devices), the device name is showed as what I expected( "12345"). Once I connect to the device through the app, the device name change to the value in NVDS("abc"). If I pair the device with iOS, the device name in pair list is also "abc", NVDS value. I don't think the device name store in NVDS should appear in any case because I have already undefined CFG_NVDS.

所以,我的问题将是:

1. Why sometimes the device name is the value I set in app_adv_func and sometime it is the value store in NVDS even after I undefine CFG_NVDS.

2.如果我想动态地设置设备名称(通过I2C事件),我如何维护统一的设备名称?

Thanks a lot and looking forward to your response.

最好的祝福,

Zwang308.
离线
Last seen:4年2个月前
Master
Joined:2014-07-02 14:15
问题更新:

问题更新:

在BLE Init函数之前,我在BLE堆栈之前更改Main_Func中的NVDS中的设备名称。现在设备名称正常工作。

但我遇到了一个发现一个新问题:

我在我的应用程序中生成了已解析的私有随机地址和安全模式1级别3。如果我只是将一个设备与我的iPhone配对,一切都正确。但是如果我配对第二个设备,我的第一个设备甚至不会在LightBlue应用程序的设备列表中显示。如果我在iOS设置中删除了第二个设备的配对信息,则第一个设备将再次显示在列表中。

您认为此问题也与某些NVDS值相关吗?我相信这两个设备的iRK是不同的,因为我在app_configuration_func中手动设置两个不同的值。

Thanks a lot,

TR_Dialog
离线
Last seen:2 weeks 6 days ago
Staff
Joined:2014-06-30 23:52
你好Zeyu,

你好Zeyu,

你能否重新陈述你的目标。您希望看到什么行为。

The description above is based on the changes you have made.

如果您可以澄清您的最终目标,则会更容易,然后我们可以建议进行一些修改。

谢谢,

TR_DIALOG

Zwang308.
离线
Last seen:4年2个月前
Master
Joined:2014-07-02 14:15
嗨tr_dialog,

嗨tr_dialog,

非常感谢您的回复。在一切之前,我的代码都基于您的示例128项目。

1.i unefine cfg_nvds和app_adv_func中的设置设备名称。当我尝试发现iOS的灯蓝色应用程序下的设备时,设备名称显示为App_adv_func中的值。但在我连接到设备后,设备名称会更改为NVDS中的值。iOS配对设备列表中的设备名称也与NVDS设备名称值相同。
我通过在ove堆栈中设置了NVDS中的设备名称来解决此问题,但我非常好奇地对NVDS中的设备名称存储仍然显示在某个地方,即使是拒绝CFG_NVD。

2.我在我的应用程序中使用生成的可解变私有随机地址和安全模式1级别3。我将两个设备与同一iPhone配对,每个设备都有一个唯一的irk和设备名称。我可以在iOS配对设备列表中看到两个配对的设备。但在我配对第二个设备后,第一个设备将显示为第二设备的名称。我在NVDS中更改设备地址,一切都是对的。

从我观察到的所有事情,我真的很想知道:
1为什么在i unefine cfg_nvds之后,为什么BLE仍然在NVDS中使用信息。
2.在app_adv_func和nvds数据部分中设置广告数据的区别是什么。
3.是,生成的可解析私有随机地址是否基于NVDS中的设备地址值?

如果需要任何其他信息,请随时与我联系。

非常感谢和waiting for your reply.

TR_Dialog
离线
Last seen:2 weeks 6 days ago
Staff
Joined:2014-06-30 23:52
你好Zeyu:

你好Zeyu:

Thanks for describing your modifications. From that I infer the following as your objective:

- 您想在加载到两个不同设备上的两个不同图像中更改广告中的设备名称?这是您尝试实现的目标。如果这是您只需修改NVDS.C中的字段NVDS_TAG_DEVICE_NAME的目标

拒绝CFG_NVDS需要什么?

谢谢,

TR_DIALOG

Zwang308.
离线
Last seen:4年2个月前
Master
Joined:2014-07-02 14:15
嗨tr_dialog,

嗨tr_dialog,

The reason why I undefined CFG_NVDS is I want to set the BLE parameter(device name, IRK...) through I2C bus by another processor.

So, to start with, I make the program wait at main_func for an I2C set device name package. After that, I store the device name in a buffer and use the buffer date to set device name and IRK in app_adv_func and app_configuration_func. Since I get the device name from my buffer, not from NVDS, so I disable CFG_NVDS.

以这种方式,设备名称在将DA连接到iPhone之前显示缓冲区值。但在我连接到我的iPhone后,设备名称更改为NVDS的值。我的设备显示为两种不同的名称,以及在NVDS中设置设备名称的设置设备名称的区别是什么感到困惑。

I solve this problem by setting the device name in NVDS according to my buffer data before BLE stack init. But I am still wondering why the device name stored in NVDS is still being used even I undefined CFG_NVDS and when exactly the information in NVDS is used.

后者,我发现了如果我将两个设备配对到同一个iPhone,请将第一设备视为第二个(后一个配对设备)。我相信他们每个人都有一个独特的虹膜。后者,我根据我的i2c包在ble堆栈是init和解决问题之前,根据我的i2c包更改NVDS的设备地址值。我认为这里的原因是我使用私有可解变的随机地址和未定义的CFG_NVDS,BLE堆栈仍然在NVDS中的信息上生成可解析的随机地址基础。

同样,我通过在我认为我完全禁用NVDS的情况下更改NVDS中的值来解决两个问题。所以,我想问的问题是:

1.为什么即使我未定义的CFG_NVDS也仍在使用NVDS中的日期。

2. When device name stored in NVDS is used and when device set in app_adv_func is used? Why if the device name in NVDS is different from the on I set in app_adv_func, I could get two different names of the same device before and after the connection is built.

3.是生成的可解析私有随机地址与NVDS中的设备地址存储有关吗?要扩展此问题,请使用NVDS中的数据存储?

我清楚了吗?

Thanks a lot.

cdeclarens.
离线
Last seen:4年3个月前
Joined:2015-06-10 16:43
hello Dialog:

hello Dialog:
I modifiy field dA14580 to Dialog_14580. Now i face problem of length of field. How to increase the length of this field so that we can have longer Name .

redbear.
离线
Last seen:5年7个月前
Joined:2015-01-30 08:50
in nvds.c

in nvds.c
device_name_tag_len.

TR_Dialog
离线
Last seen:2 weeks 6 days ago
Staff
Joined:2014-06-30 23:52
你好Zeyu:

你好Zeyu:

您能否澄清以下注释:“以这种方式,设备名称在将DA连接到iPhone之前显示缓冲区值。但在我连接到我的iPhone后,设备名称将更改为NVDS中的值。”。它显示在广告中吗?我可以在app_adv_func中说,无论您提出的任何名称都会显示在广告中。如果您看到设备名称更改,请告诉我们,以下顺序:广告 - > Connect - > Disconnect - >广告。设备名称不应通过此序列进行Chnage。

To answer one of your questions: BLE stack retrieves parameters via custom_nvds_get_func when it is reset.

你能为函数app_adv_func发布代码吗?

此外,您可能希望查看以下文档:http://support.dialog-seminile.com/system/files/resources/an-b-022_da14580_resolvable_private_address_guidelines.pdf.

谢谢,

TR_DIALOG

Zwang308.
离线
Last seen:4年2个月前
Master
Joined:2014-07-02 14:15
嗨tr_dialog,

嗨tr_dialog,

If you use Light Blue app, you will see the device name change after I connect to the device. After connected, you could also find the Device name shown at the TOP is different from the advertisement package. Please make the device name in app_adv_func differ from value in NVDS. undefine NVDS and see whether you will get the same result as me.

My app_adv_func:

void app_adv_func(struct gapm_start_advertise_cmd * cmd)
{

// Start advertising. Fill GAPM_START_ADVERTISE_CMD message

//设备名称长度
uint8_t device_name_length;
Int8_t device_name_avail_space;
uint8_t device_name_temp_buf [64];
uint8_t manufacture_date[10];

cmd-> op.code = gapm_adv_undirect;
cmd-> op.addr_src = gapm_gen_rslv_addr; / * gapm_gen_static_rnd_addr; * /// gapm_public_addr;
cmd->op.renew_dur = 15000;
cmd-> intv_min = app_adv_int_min;
cmd-> intv_max = app_adv_int_max;
cmd-> channel_map = app_adv_chmap;

cmd-> info.host.mode = gap_gen_disoverable;

/ * ------------------------------------------------------------------------
* Set the Advertising Data and the Scan Response Data
* ------------------------------------------------------------------------ * /
cmd-> info.host.adata_len = app_add_data_max_size;
cmd->info.host.scan_rsp_data_len = APP_SCAN_RESP_DATA_MAX_SIZE;
#ifdef has_white_list.
if (white_list_written)
cmd-> info.host.adv_filt_policy = adv_allow_scan_wlst_con_wlst;
别的
cmd->info.host.adv_filt_policy = ADV_ALLOW_SCAN_ANY_CON_ANY;
#别的
cmd->info.host.adv_filt_policy = ADV_ALLOW_SCAN_ANY_CON_ANY;
#万一

//cmd--ingfo.host.adv_filt_policy = adv_allow_scan_any_con_any;

// Advertising Data
#if(nvds_support)
if(nvds_get(nvds_tag_app_ble_adv_data,&cmd-> info.host.adv_data_len,
&cmd->info.host.adv_data[0]) != NVDS_OK)
#万一//(NVDS_SUPPORT)
{
//GPIO_SetActive(GPIO_PORT_1,GPIO_PIN_0);
cmd-> info.host.adv_data_len = 10;

memcpy(&makessure_date [0],“\ x09 \ xff”,2);
memcpy(&manufacture_date[0] + 2, &bb_device_name[0] + 4, 8);
Memcpy(&cmd-> info.host.addata [0],&manualure_date [0],cmd-> info.host.adv_data_len);
}

//扫描响应数据
#if(nvds_support)
if(nvds_get(nvds_tag_app_ble_scan_resp_data,&cmd-> info.host.scan_rsp_data_len,
&cmd-> info.host.scan_rsp_data [0])!= nvds_ok)
#万一//(NVDS_SUPPORT)
{
cmd-> info.host.scan_rsp_data_len = app_scnrsp_data_length;
memcpy(&cmd-> info.host.scan_rsp_data [0],app_scnrsp_data,cmd-> info.host.scan_rsp_data_len);
}

//在广告数据中获取剩余空间 - 2个字节用于名称长度/标志
device_name_avail_space = APP_ADV_DATA_MAX_SIZE - cmd->info.host.adv_data_len - 2;

//检查数据是否可以添加到广告数据中
if (device_name_avail_space > 0)
{

//获取设备名称以添加在广告数据中(默认为1或nvds)
/ *#if(nvds_support)
device_name_length = nvds_len_device_name;
if (nvds_get(NVDS_TAG_DEVICE_NAME, &device_name_length, &device_name_temp_buf[0]) != NVDS_OK)
#万一//(NVDS_SUPPORT)
{
//获取默认的设备名称(如果没有足够的空间,则无名称)
device_name_length = strlen(app_device_name);
memcpy(&device_name_temp_buf [0],app_device_name,device_name_length);
}
* /
device_name_length = bb_devicename_size;
memcpy(&device_name_temp_buf [0],bb_device_name,bb_devicename_size);
// memcpy(device_name_temp_buf,“bfob01234567”,12);
if(device_name_length > 0)
{
// Check available space
device_name_length = co_min(device_name_length,device_name_avail_space);

//填充长度
cmd-> info.host.adv_data [cmd-> info.host.adv_data_len] = device_name_length + 1;
//填充设备名称标志
cmd->info.host.adv_data[cmd->info.host.adv_data_len + 1] = '\x09';
//复制设备名称
memcpy(&cmd-> info.host.addata [cmd-> info.host.add_data_len + 2],device_name_temp_buf,device_name_length);

//更新广告数据长度
cmd-> info.host.adv_data_len + =(device_name_length + 2);
}
}

return;
}

谢谢!

TR_Dialog
离线
Last seen:2 weeks 6 days ago
Staff
Joined:2014-06-30 23:52
你好Zeyu:

你好Zeyu:

有一件事我想指出你在iPhone上浅蓝色看到的设备名称不一定是设备名称DA14580放在空中。iOS确实缓存了一些信息,从而差异。为了解决这个问题,在开发代码时,我总是在空中使用前线。

I will review your app_adv_func and provide feedback. Did you have a chance to review the document:http://support.dialog-seminile.com/system/files/resources/an-b-022_da14580_resolvable_private_address_guidelines.pdf.

谢谢,

TR_DIALOG

Zwang308.
离线
Last seen:4年2个月前
Master
Joined:2014-07-02 14:15
嗨tr_dialog,

嗨tr_dialog,

我理解IO中有一些特殊的BLE策略,但似乎在IOS连接后呈浅蓝色显示的设备名称将始终保持与NVDS中的一个商店相同。

Also, I changed Sample128 project as AN-B-022 and I think the resolvable random address works fine for a single device: each time the device will show as a different address and iOS could reconnect to it after paired. But if I turn on two device at the same time and paired both of my device to the same iPhone. IPhone will regard both of them as the latter paired one.
Latter on, I changed the device in NVDS. After that, my iPhone could distinguish these two devices without any error.

同样,我猜我甚至是unefine cfg_nvds,并在那些app_xxx函数中设置自己的ble设置,ble仍然在nvds中使用信息存储。所以,我真的想用你的家伙检查我是否配置了错误,并且通过BLE堆栈使用了NVDS的使用程度。

谢谢!

redbear.
离线
Last seen:5年7个月前
Joined:2015-01-30 08:50
你好,

你好,
.NVDS_TAG_APP_BLE_SCAN_RESP_DATA = "xxx"
#define app_scnrsp_data“xxx”
what are the relationship and difference between them?
谢谢!

summer20100514
离线
Last seen:4年2个月前
格鲁鲁
Joined:2014-12-30 05:01
when you can read scan

当您可以成功读取扫描响应数据时,使用NVDS_TAG_APP_BLE_SCAN_RESP_DATA。如果存在错误,则使用app_scnrsp_data。

if(nvds_get(nvds_tag_app_ble_scan_resp_data,&cmd-> info.host.scan_rsp_data_len,
&cmd-> info.host.scan_rsp_data [0])!= nvds_ok)
{
cmd-> info.host.scan_rsp_data_len = app_scnrsp_data_length;
memcpy(&cmd-> info.host.scan_rsp_data [0],app_scnrsp_data,cmd-> info.host.scan_rsp_data_len);
}

安东尼42.
离线
Last seen:5年4个月前
Joined:2015-07-17 08:21
I have a app to connect the

谢谢,夏天2014年
我有一个应用程序来连接DA14580,当uuid包含在扫描响应数据中时,该应用程序将显示设备,我可以连接,
我更改app_scnrsp_data,应用程序工作正常,
I change the response data in nvds.c, from app I can't see the device,
that means nvds_get is always not ok, when it will become ok, and why define in two different places?

summer20100514
离线
Last seen:4年2个月前
格鲁鲁
Joined:2014-12-30 05:01
一定是有问题的

一定是有问题的with your settings of response data in nvds.c, you may check the format and length of it.

安东尼42.
离线
Last seen:5年4个月前
Joined:2015-07-17 08:21
Thank you for your reply!

Thank you for your reply!
代码是:
#define app_scnrsp_data“\ x11 \ x06 \ xde \ x12 \ xa5 \ x98 \ x1a \ x03 \ x34 \ xf7 \ xab \ xa8 \ x95 \ xa2 \ x80 \ x29 \ x70 \ x70”
.NVDS_TAG_APP_BLE_SCAN_RESP_DATA = " \ x09 \ xFF \ x00 \ x60\x52\x57\x2D\x42\x4C\x45",
.SCAN_RESP_DATA_TAG_LEN = 10,
why app scan, da14580 always response data from APP_SCNRSP_DATA, but the dev name is always from nvds.c?
将使用NVDS_TAG_APP_BLE_SCAN_RESP_DATA时,为什么使用“\ x”?