This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC2640R2F:队列消息被擦除或损坏?

Guru**** 2587365 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/597502/cc2640r2f-queue-message-gets-erase-or-corrupted

器件型号:CC2640R2F

您好!

   我正在 TestApp__QueueWriteTagID()中对该字符串"22222222222"进行排队。 在主任务中处理应用程序消息后、"22222222222222222222222"会被擦除或损坏。

静态空 TestApp_QueueWriteTagID (byte* msg)
{
uint8_t *pData;
//为事件数据分配空间。
if (((pData = iCall_malloc (sizeof (uint8_t)))))
{
pData = msg;
XXBLEPeripheral_EnqueueMsg (SBP_WRITE_TAG_EVT、NULL、pData);
}

返回;
} 

消息在 XBLEPeripheral_EnqueueMsg()处排队。 如您所见、"2222222222222222222222222"存储在 pData 中。

在 XBLEPeripheral_ProcessAppMsg()中,"2222222222222222222"会被擦除或损坏。

为什么会擦除"222222222222222222222222222"?  

-克尔

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我已经开始工作了。 我为消息分配足够的内存、然后使用 memcpy 将 msg 内容传输到 pData。

    静态空 TestApp_QueueWriteTagID (byte* msg)
    {
    uint8_t *pData;
    if (strlen (msg)<= XX_TAG_ID_LEN)
    {
    //为事件数据分配空间。
    如果((pData = iCall_malloc (XX_TAG_ID_LEN + 1))))
    {
    memcpy (pData、msg、strlen (msg));
    XXBLEPeripheral_EnqueueMsg (SBP_WRITE_TAG_EVT、NULL、pData);
    }
    }
    其他
    {
    UartApp_WriteString ("INV TAGID LEN\r\n");
    }
    
    返回;
    }
    

    -克尔

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    好的、好的。 我开始认为这是另一个双指针问题:)

    祝你一切顺利