如何创建服务使用16位UUID

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
4个帖子/ 0新
最后一篇
托尼潘
离线
最后一次露面:6个月前1年
加入:2017-04-12 15:25
如何创建服务使用16位UUID

SDK5.0.3:如何创建服务使用16位UUID,Cust_prf_func_callbacks仅适用于128位UUID

关键词:
设备:
wi_dialog.
离线
最后一次露面:3天23小时前
职员
加入:2014-01-03 16:21
你好,

你好,

相同的数据结构可用于定义16位UUID服务。使用“structAttm_desc_128”的原因是允许相同的数据结构来覆盖16位和128位UUID元素。仔细查看Custom1数据库的声明,您可以看到服务被声明为16位UUID,LED状态特性为128位UUID。该数据库包含16位和128位UUID元素的混合。您可以将此作为参考以创建自己的自定义配置文件。

///属性描述(用于创建数据库)
struct attm_desc_128
{
/ / /元素UUID
UINT8_T * UUID;// <<<<< UUID阵列
/// uuid大小
UINT8_T UUID_SIZE;// <<<<<用于定义UUID的长度,(ATT_UUID_128_LEN或ATT_UUID_16_LEN)
///属性权限
uint16_t perm;
///元素的最大长度
att_size_t max_length;
///元素的当前长度
ATT_SIZE_T长度;
///元素值数组
UINT8_T *值;
};

/ * ---------------声明----------------- * /
///主要服务声明
ATT_DECL_PRIMARY_SERVICE = 0x2800,
///二级服务声明
att_decl_secondary_service,
///包括声明
att_decl_include,
///特征声明
ATT_DECL_CHAROMATION,

静态UINT16_T ATT_DECL_SVC = ATT_DECL_PRIMARY_SERVICE;
静态UINT16_T ATT_DECL_CHAR = ATT_DECL_CHAROMATION;

#define def_cust1_svc_uuid_128 {0x2f,0x2a,0x93,0xa6,0xbd,0xd8,0x41,0x52,0xac,0x0b,0x10,0x99,0x2e,0xc6,0xFe,0xed}

#define def_cust1_ctrl_point_uuid_128 {0x20,0xee,0x8d,0x0c,0xe1,0xf0,0x4a,0x0c,0xb3,0x25,0xdc,0x53,0x6a,0x68,0x86,0x2d}
#define def_cust1_led_state_uuid_128 {0x4f,0x43,0x31,0x3c,0x93,0x92,0x42,0xe6,0xa8,0x76,0xfa,0x3b,0xef,0xb4,0x87,0x5a}
#define def_cust1_adc_val_1_uuid_128 {0x17,0xb9,0x67,0x98,0x4c,0x66,0x4c,0x01,0x96,0x33,0x31,0xb1,0x91,0x59,0x00,0x15}
#define def_cust1_adc_val_2_uuid_128 {0x23,0x68,0xec,0x52,0x1e,0x62,0x44,0x74,0x9a,0x1b,0xd1,0x8b,0xab,0x75,0xb6,0x6e}
#define def_cust1_button_state_uuid_128 {0x9e,0xe7,0xba,0x08,0xb9,0xa9,0x48,0xab,0xa1,0xac,0x03,0x1c,0x2e,0x0d,0x29,0x6c}
#define DEF_CUST1_INDICATEABLE_UUID_128 {0x28, 0xD5, 0xE1, 0xC1, 0xE1, 0xC5, 0x47, 0x29, 0xB5, 0x57, 0x65, 0xC3, 0xBA, 0x47, 0x15, 0x9E}
#define def_cust1_long_value_uuid_128 {0x8c,0x09,0xe0,0xd1,0x81,0x54,0x42,0x40,0x8e,0x4f,0xd2,0xb3,0x77,0xe3,0x2a,0x77}

#define att_uuid_16_len 0x0002
#定义x0010 ATT_UUID_128_LEN 0

// ================================================================================================================.

///全自定义数据库描述 - 用于将属性添加到数据库中
struct attm_desc_128 custs1_att_db [cust1_idx_nb] =
{
// custom1服务声明
[cust1_idx_svc] = {(uint8_t *)和att_decl_svc,att_uuid_16_len,perm(rd,beasen),
sizeof(custs1_svc),sizeof(custs1_svc),(uint8_t *)&custs1_svc},

//控制点特征声明
[cust1_idx_control_point_char] = {(uint8_t *)和att_decl_char,att_uuid_16_len,perm(rd,启用),
sizeof(custs1_ctrl_point_char),sizeof(custs1_ctrl_point_char),(uint8_t *)&custs1_ctrl_point_char},

//控制点特征值
[cust1_dx_control_point_val] = {cust1_ctrl_point_uuuid_128,Att_uuid_128_len,perm(wr,启用),
def_cust1_ctrl_point_char_len,0,null},

//控制点特征用户描述
[cust1_idx_control_point_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_control_point_user_desc) - 1,sizeof(cust1_control_point_user_desc) - 1,cust1_control_point_user_desc},

// LED状态特性声明
[cust1_idx_lex_state_char] = {(uint8_t *)和att_decl_char,att_uuid_16_len,perm(rd,启用),
sizeof(custs1_led_state_char),sizeof(custs1_led_state_char),(uint8_t *)&custs1_led_state_char},

// LED状态特性值
[cust1_dx_led_state_val] = {cust1_led_state_uuuid_128,att_uuid_128_len,perm(wr,启用),
def_cust1_led_state_char_len,0,null},

// LED状态特性用户描述
[cust1_idx_led_state_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_led_state_user_desc) - 1,sizeof(cust1_led_state_user_desc) - 1,cust1_led_state_user_desc},

// ADC值1特征声明
[cust1_idx_adc_val_1_char] = {(uint8_t *)和att_decl_char,att_uuid_16_len,perm(rd,启用),
sizeof(custs1_adc_val_1_char),sizeof(custs1_adc_val_1_char),(uint8_t *)&custs1_adc_val_1_char},

// ADC值1特征值
[cust1_idx_adc_val_1_val] = {cust1_adc_val_1_uuid_128, att_uuid_128_len, perm (rd, enable) | perm (ntf, enable),
def_cust1_adc_val_1_char_len,0,null},

// ADC值1客户端特征配置描述符
[cust1_idx_adc_val_1_ntf_cfg] = {(uint8_t *)&att_decl_cfg,att_uuid_16_len,perm(rd,启用)|perm(wr,启用),
sizeof(uint16_t),0,null},

// ADC值1特征用户描述
[cust1_idx_adc_val_1_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_adc_val_1_user_desc) - 1,sizeof(cust1_adc_val_1_user_desc) - 1,cust1_adc_val_1_user_desc},

// ADC值2特征声明
[cust1_idx_adc_val_2_char] = {(uint8_t *)和att_decl_char,att_uuid_16_len,perm(rd,启用),
sizeof (custs1_adc_val_2_char), sizeof (custs1_adc_val_2_char), (uint8_t *) &custs1_adc_val_2_char},

// ADC值2特征值
[cust1_idx_adc_val_2_val] = {cust1_adc_val_2_uuid_128,att_uuid_128_len,perm(rd,启用),
def_cust1_adc_val_2_char_len,0,null},

// ADC值2特征用户描述
[cust1_idx_adc_val_2_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_adc_val_2_user_desc) - 1,sizeof(cust1_adc_val_2_user_desc) - 1,cust1_adc_val_2_user_desc},

//按钮状态特征声明
[cust1_idx_button_state_char] = {(uint8_t *)和att_decl_char,att_uuid_16_len,perm(rd,启用),
sizeof(custs1_button_state_char),sizeof(custs1_button_state_char),(uint8_t *)&custs1_button_state_char},

//按钮状态特征值
[cust1_idx_button_state_val] = {cust1_button_state_uuuid_128,att_uuid_128_len,perm(rd,启用)|perm(ntf,启用),
def_cust1_button_state_char_len,0,null},

//按钮状态客户端特征配置描述符
[cust1_dx_button_state_ntf_cfg] = {(uint8_t *)&att_decl_cfg,att_uuid_16_len,perm(rd,启用)|perm(wr,启用),
sizeof(uint16_t),0,null},

//按钮状态特征用户描述
[cust1_idx_button_state_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_button_state_user_desc) - 1,sizeof(cust1_button_state_user_desc) - 1,cust1_button_state_user_desc},

//可指示的特征声明
[cust1_idx_indicatable_char] = {(uint8_t *)和att_decl_char,att_uuid_16_len,perm(rd,启用),
sizeof(custs1_indicateable_char),sizeof(custs1_indicateable_char),(uint8_t *)&custs1_indicatable_char},

//可指示的特征值
[cust1_idx_indicateable_val] = {cust1_indicatebers_uuuid_128,Att_uuid_128_len,Perm(RD,Enable)|perm(ind,启用),
def_cust1_indicatable_char_len,0,null},

//可指示的客户端特征配置描述符
[cust1_idx_indicateable_ind_cfg] = {(uint8_t *)和att_decl_cfg,att_uuid_16_len,perm(rd,启用)|perm(wr,启用),
sizeof(uint16_t),0,null},

//可指示特征用户描述
[cust1_idx_indicatabled_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_indicateable_user_desc) - 1,sizeof(cust1_indicateable_user_desc) - 1,cust1_indicateable_user_desc},

//长价特征声明
[cust1_idx_long_value_char] = {(uint8_t *)&att_decl_char,att_uuid_16_len,perm(rd,启用),
sizeof(custs1_long_value_char),sizeof(custs1_long_value_char),(uint8_t *)&custs1_long_value_char},

// Long Value特征值
[cust1_idx_long_value_val] = {cust1_long_value_uuid_128,att_uuid_128_len,perm(rd,启用)|perm(wr,启用)|perm(ntf,启用),
DEF_CUST1_LONG_VALUE_CHAR_LEN 0零},

//长值客户端特征配置描述符
[cust1_idx_long_value_ntf_cfg] = {(uint8_t *)和att_decl_cfg,att_uuid_16_len,perm(rd,启用)|perm(wr,启用),
sizeof(uint16_t),0,null},

//长值特征用户描述
[cust1_idx_long_value_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_long_value_char_user_desc) - 1,sizeof(cust1_long_value_char_user_desc) - 1,cust1_long_value_char_user_desc},
};

问候,

Anghockleong50
离线
最后一次露面:1年11个月前
加入:2019-07-17 09:05
嗨对话工程师,

嗨对话工程师,

只需一个快速的问题,将ADC1发送到App(Beacon),我可以修改哪个参数。

我正在从ADC读取温度,并希望在App(Beacon)上显示该ADC服务。

// ADC值1特征用户描述
[cust1_idx_adc_val_1_user_desc] = {(uint8_t *)&att_decl_user_desc,att_uuid_16_len,perm(rd,启用),
sizeof(cust1_adc_val_1_user_desc) - 1,sizeof(cust1_adc_val_1_user_desc) - 1,cust1_adc_val_1_user_desc},

PM_DIALOG.
离线
最后一次露面:3天17小时前
职员
加入:2018-02-08 11:03
嗨anghockleong50,

嗨anghockleong50,

请查看SDK5.0.4的BLE_APP_PERIALAL示例以及如何定义ADC值1特征。您应该遵循类似的实现。通过通知发送测量的ADC值的函数是App_AdCVAL1_TIMER_CB_HANDLER()回调。

谢谢,PM_DIALOG.