雷竞技电竞平台对话框半导体客户支持 - SDK_1.0.14.1081 https://support.dialog-seminile.com/resource-keywords/sdk10141081 EN. 我们如何通过BLE发送负值? https://support.dialog-semicondiondiondiondiondum/forums/post/dialog-martbond-bluetooth-low-energy-%2%80%93-software/how-can-we-send-negative-value -ble
论坛:
dialog smartbond蓝牙低能–软件=“隐藏摘要字段标签的字段名称正文字段类型文本”>

Hi dialog

我正在基于DA14681和sdk为1.0.14.1081的定制板上工作。
在ble_gatts.c文件中,所有函数都将输入作为uint16_t。
我的问题是,我是否要发送像int8或int16这样的负值数据。我怎样才能寄出去?因为,因为Able-UU GATTTs.c是一个sdk文件,我不想更改。

<因为因为因为Able-U GATTTs.c是一个我不想更改的sdk文件。c是一个sdk文件,是一个sdk文件,我不想更改。

/p>

版权所有(c)2015-2017 Dialog Semiconductor。
*此计算机程序包含Dialog Semiconductor的机密专有信息。版权所有。
************************************************************************************************************************************************************************
/

包括<;标准h>
包括<;字符串.h><(b)包括,包括,包括,包括,包括,雷竞技电竞平台包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括“普通.普通.h”
(br)包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,包括,配置的,包括,包括,包括,包括,包括,包括,包括,配置的,包括,包括,包括,包括,包括,配置的。服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服服务(const att\u uuid\u t*uuid,const gatt\u service\u type,
uint16\u num\u attrs)
{ble\u mgr\u gatts\u service\u add\u cmd\u cmd;
ble\u mgr\u gatts\u service\u add\u rsp\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r






>>CMP>>CMP>>CMP><
CMP>
CMP>
CMP>
CMP>
CMP>
CMP>

CMP>


CMP>CMP>CMP>CMP>CMP>CMP><

CMP>

CMP>

CMP>若若若(

若(

p>p>p>若(

p>p>若(

p>p>p>p>p>p>若若若(

若_包括(uint16\u t handle,uint16\u t*h\u offset)
{
ble\u mgr\u gatts\u service\u add\u include\u cmd\u t*cmd;
ble\u mgr\u gatts\u service\u add\u include\u rsp\u rsp;
ble\u error\u ret ble\u error\u FAILED;

/*创建新命令并填充它*/
cmd alloc\u ble\u msg(gatble\mgr\cmd service\u add
cmd->;handle=handle;

如果(!ble_cmd_execute(cmd,(void**)&rsp,ble_mgr_gatts_service_add_include_cmd_handler){
返回ret

ble\U error\U t ble\U gatts\U add\U特征(常量att\U uuid\U t*uuid,gatt\U prop\t prop,att perm\U perm,
uint16\U max\U len,gatts\U标志,uint16\U t*h\U偏移,
uint16\U*h\U val\U偏移量)
{
ble_-mgr_-gatts_-service_-add_-characteristic_-cmd_-gt*cmd;
ble_-mgr_-gatts_-service_-add_-characteristic_-rsp_-t*rsp;
ble-error_-ret=ble_-error_-error_失败;

/*创建新命令并填充它*/
cmd
cmd->;uuid=*uuid;
cmd->;prop=prop;
cmd->;perm=perm;
cmd->;max\u len=max\u len;
cmd->;flags=flags;

如果(!ble\u cmd\u执行(cmd,(void**)rsp,ble\u管理器\u gatts服务\u添加特性\u cmd处理程序){br/>返回ret《p>

<

如果(h>p>>p>如果p>>p

p>p>p>p>p>p>p>p>p>p>p>p>p>p>由于由于错误,我们的错误,我们的错误,我们的错误,我们的错误,我们是在测试,我们的错误,我们在在测试测试中,_标志_t标志,uint16_t*h_偏移量)
{
ble\u mgr\u gatts\u service\u add\u descriptor\u cmd\u t*cmd;
ble\u mgr\u gatts\u service\u add\u descriptor\u rsp\u t*rsp;
ble\u error\u ret=ble\u error\u失败;

/*创建新命令并填充它*/
cmd alloc\u sible\u msg(ble\u mgr\u gatts\u service\u descriptor,EOF cmd)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>cmd>>>>>>>>>
>>>>>
>>>>>>>cmd>>>>>cmd>cmd>cmd>cmd>>cmd>cmd>难难难难难难>难难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>难>/>}

/*免费信息*/
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_register_service(uint16_t *handle, ...)
{
va_list ap;
ble_mgr_gatts_service_register_cmd_t *cmd;
ble_mgr_gatts_service_register_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SERVICE_REGISTER_CMD, sizeof(*cmd));

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_service_register_cmd_handler)) {
return ret;
}

ret = rsp->status;

if (handle) {
*handle = rsp->handle;
}

va_start(ap, handle);
for (;;) {
uint16_t *h = va_arg(ap, uint16_t*);

if (!h) {
break;
}

*h = *h + rsp->handle;
}
va_end(ap);

/* free message */
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_enable_service(uint16_t handle)
{
ble_mgr_gatts_service_enable_cmd_t *cmd;
ble_mgr_gatts_service_enable_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SERVICE_ENABLE_CMD, sizeof(*cmd));
cmd->handle = handle;

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_service_enable_cmd_handler)) {
return ret;
}

ret = rsp->status;

/* free message */
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_disable_service(uint16_t handle)
{
ble_mgr_gatts_service_disable_cmd_t *cmd;
ble_mgr_gatts_service_disable_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SERVICE_DISABLE_CMD, sizeof(*cmd));
cmd->handle = handle;

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_service_disable_cmd_handler)) {
return ret;
}

ret = rsp->status;

/* free message */
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_get_characteristic_prop(uint16_t handle, gatt_prop_t *prop, att_perm_t *perm)
{
ble_mgr_gatts_service_characteristic_get_prop_cmd_t *cmd;
ble_mgr_gatts_service_characteristic_get_prop_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SERVICE_CHARACTERISTIC_GET_PROP_CMD, sizeof(*cmd));
cmd->handle = handle;

if (!ble_cmd_execute(cmd, (void **) &rsp,
ble_mgr_gatts_service_characteristic_get_prop_cmd_handler)) {
return ret;
}

ret = rsp->status;

if (ret == BLE_STATUS_OK) {
if (prop) {
*prop = rsp->prop;
}

if (perm) {
*perm = rsp->perm;
}
}

/* free message */
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_set_characteristic_prop(uint16_t handle, gatt_prop_t prop, att_perm_t perm)
{
ble_mgr_gatts_service_characteristic_set_prop_cmd_t *cmd;
ble_mgr_gatts_service_characteristic_set_prop_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SERVICE_CHARACTERISTIC_SET_PROP_CMD, sizeof(*cmd));
cmd->handle = handle;
cmd->prop = prop;
cmd->perm = perm;

if (!ble_cmd_execute(cmd, (void **) &rsp,
ble_mgr_gatts_service_characteristic_set_prop_cmd_handler)) {
return ret;
}

ret = rsp->status;

/* free message */
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_get_value(uint16_t handle, uint16_t *length, void *value)
{
ble_mgr_gatts_get_value_cmd_t *cmd;
ble_mgr_gatts_get_value_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;
uint16_t copy_length;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_GET_VALUE_CMD, sizeof(*cmd));
cmd->handle = handle;
cmd->max_len = *length;
copy_length = *length; // save for later

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_get_value_cmd_handler)) {
return ret;
}

/*
* Update length with actual attribute value length.
* Copy as much data as will fit in buffer or what was returned (if buffer provided).
*/
*length = rsp->length;
if (value) {
if (rsp->length < copy_length) {
copy_length = rsp->length;
}
memcpy(value, rsp->value, copy_length);
}

ret = rsp->status;
/* free message */
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_set_value(uint16_t handle, uint16_t length, const void *value)
{
ble_mgr_gatts_set_value_cmd_t *cmd;
ble_mgr_gatts_set_value_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SET_VALUE_CMD, sizeof(*cmd) + length);
cmd->handle = handle;
cmd->length = length;
memcpy(cmd->value, value, length);

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_set_value_cmd_handler)) {
return BLE_ERROR_FAILED;
}

ret = rsp->status;
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_read_cfm(uint16_t conn_idx, uint16_t handle, att_error_t status,
uint16_t length, const void *value)
{
ble_mgr_gatts_read_cfm_cmd_t *cmd;
ble_mgr_gatts_read_cfm_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

if (length && !value) {
return ret;
}

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_READ_CFM_CMD, sizeof(*cmd) + length);
cmd->conn_idx = conn_idx;
cmd->handle = handle;
cmd->status = status;
cmd->length = length;
if (value) {
memcpy(cmd->value, value, length);
}

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_read_cfm_cmd_handler)) {
return BLE_ERROR_FAILED;
}

ret = rsp->status;
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_write_cfm(uint16_t conn_idx, uint16_t handle, att_error_t status)
{
ble_mgr_gatts_write_cfm_cmd_t *cmd;
ble_mgr_gatts_write_cfm_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_WRITE_CFM_CMD, sizeof(*cmd));
cmd->conn_idx = conn_idx;
cmd->handle = handle;
cmd->status = status;

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_write_cfm_cmd_handler)) {
return BLE_ERROR_FAILED;
}

ret = rsp->status;
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_prepare_write_cfm(uint16_t conn_idx, uint16_t handle, uint16_t length,
att_error_t status)
{
ble_mgr_gatts_prepare_write_cfm_cmd_t *cmd;
ble_mgr_gatts_prepare_write_cfm_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_PREPARE_WRITE_CFM_CMD, sizeof(*cmd));
cmd->conn_idx = conn_idx;
cmd->handle = handle;
cmd->length = length;
cmd->status = status;

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_prepare_write_cfm_cmd_handler)) {
return BLE_ERROR_FAILED;
}

ret = rsp->status;
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_send_event(uint16_t conn_idx, uint16_t handle, gatt_event_t type,
uint16_t length, const void *value)
{
ble_mgr_gatts_send_event_cmd_t *cmd;
ble_mgr_gatts_send_event_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SEND_EVENT_CMD, sizeof(*cmd) + length);
cmd->conn_idx = conn_idx;
cmd->handle = handle;
cmd->type = type;
cmd->length = length;
memcpy(cmd->value, value, length);

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_send_event_cmd_handler)) {
return BLE_ERROR_FAILED;
}

ret = rsp->status;
OS_FREE(rsp);

return ret;
}

ble_error_t ble_gatts_service_changed_ind(uint16_t conn_idx, uint16_t start_handle,
uint16_t end_handle)
{
ble_mgr_gatts_service_changed_ind_cmd_t *cmd;
ble_mgr_gatts_service_changed_ind_rsp_t *rsp;
ble_error_t ret = BLE_ERROR_FAILED;

/* Create new command and fill it */
cmd = alloc_ble_msg(BLE_MGR_GATTS_SERVICE_CHANGED_IND_CMD, sizeof(*cmd));
cmd->conn_idx = conn_idx;
cmd->start_handle = start_handle;
cmd->end_handle = end_handle;

if (!ble_cmd_execute(cmd, (void **) &rsp, ble_mgr_gatts_service_changed_ind_cmd_handler)) {
return BLE_ERROR_FAILED;
}

ret = rsp->status;
OS_FREE(rsp);

return ret;
}
#endif /* (dg_configBLE_GATT_SERVER == 1) */

Device: 
星期二,2019年8月20日11:36:20 +0000 Mahmed106. 319306在https://support.dialog-semicondiondum. https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/how-can-we-send-negative-value-ble#comments