跳到主要内容

GATT外围模式写CHAR尺寸

6个月前

GATT外围模式写CHAR尺寸

张贴了有限公司0分 3回复
0旋转

嗨,我们为GATT外围模式实现了一个项目。我们在服务中有1服务和2个属性。每种属性也有1个特征。

const struct attm_desc_128 custs1_att_db [svc_index_max] =
{
[svc_index_service] = {(uint8_t *)和att_decl_service,att_uuid_128_len,perm(rd,启用),
sizeof(lt_service_uuid),sizeof(svc_uuid),(uint8_t *)&svc_uuid},

[svc_index_get_char] = {(uint8_t *)&att_decl_characterativer,att_uuid_16_len,perm(rd,disable),
0,0,null},

[svc_index_get_val] = {get_char_uuid,att_uuid_128_len,perm(wr,启用)|perm(write_req,启用),
perm(ri,启用)|1024,0,null},


[svc_index_send_char] = {(uint8_t *)和att_decl_characterativer,att_uuid_16_len,perm(rd,启用),
0,0,null},

[svc_index_send_val] = {send_char_uuid,att_uuid_128_len,perm(rd,启用),
perm(ri,启用)|1024,0,null},

};

我们定义了cust_att_db。但是当我们连接它们时,我们可以在一个命令中发送256字节。但我们想在接受写请求后冻结的应用程序(来自user_catch_rest_hndl中的custs1_att_info_req)冻结的应用程序。

摘要,在外围模式下将(从Central)写入(从Central)到DA14585?我们在哪里犯错?

辅助,我们如何捕获写缓冲区溢出?我们可以向Custs1_att_db提供另一个缓冲区。那样的例子?

extern UserBuffer [1024];

const struct attm_desc_128 custs1_att_db [svc_index_max] =
{
[svc_index_service] = {(uint8_t *)和att_decl_service,att_uuid_128_len,perm(rd,启用),
sizeof(lt_service_uuid),sizeof(svc_uuid),(uint8_t *)&svc_uuid},

[svc_index_get_char] = {(uint8_t *)&att_decl_characterativer,att_uuid_16_len,perm(rd,disable),
0,0,null},

[svc_index_get_val] = {get_char_uuid,att_uuid_128_len,perm(wr,启用)|perm(write_req,启用),
perm(ri,启用)|1024,0,UserBuffer},


[svc_index_send_char] = {(uint8_t *)和att_decl_characterativer,att_uuid_16_len,perm(rd,启用),
0,0,null},

[svc_index_send_val] = {send_char_uuid,att_uuid_128_len,perm(rd,启用),
perm(ri,启用)|1024,0,null},

};

此致...

6个月前

PM_DIALOG.

嗨Ltdev,

根据BKLE Specs,属性的最大长度为512字节。SDK的BLE_APP_PERIALAL示例嵌入了“写入长度特性”。请看看SDK的这个例子。如果要写入的特征值的长度大于20字节,则将触发user_catch_rest_hndl()函数中的user_svc1_long_val_att_info_req_handler()。如果长度小于20字节,则将执行user_svc1_long_val_wr_ind_handler()。因此,如果要在没有MTU Exchange的情况下发送超过20个字节的字节,则应在BLE_APP_PERITIALLAL示例的user_svc1_long_val_att_info_req_handler()函数中执行相同的实现。由于您这样做,主机将发送“准备写入请求”,从设备将响应“准备写入响应”。表达的特点应该有512字节长度 - def_svc1_long_value_char_len。

谢谢,PM_DIALOG.

6个月前

有限公司 0分

嗨,我想我无法解释我的问题。我已经可以编写了20多个字节。但是当我定义Char_len为512字节时,我只能编写315个字节。如果我尝试编写超过315个字节,应用程序冻结和看门狗无法正常工作。

辅助我可以捕获写缓冲区溢出吗?我可以使用任何缓冲区进行char值缓冲区吗?

编辑:使用NRF Connect Mobile的调试;

我定义;#define def_svc1_long_value_char_len 50.

我想发送51bytes nrf connect get gatt_attr_len错误。我可以在我的申请中捕获吗?

6个月前

PM_DIALOG.

嗨Ltdev,

是否有可能共享屏幕截图,显示应用程序冻结的位置?是由于WDOG到期吗?

如果增加DEF_SVC1_LONG_VALUE_CHAR_LEN,您是否能够发送超过51个字节?

>>>“辅助我可以捕获写缓冲区溢出吗?”

你能澄清上面的声明吗?

谢谢,PM_DIALOG.