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.

[参考译文] LP-CC2652R7:为什么不能##39;将温度传感器中的 CoAP 发送到边界路由器中的 CoAP 服务器?

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

https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1395009/lp-cc2652r7-why-can-t-the-coap-in-the-temperature-sensor-be-sent-to-the-coap-server-in-the-border-router

器件型号:LP-CC2652R7
主题中讨论的其他器件:CC2652R7

工具与软件:

SDK:simplelink_cc13xx_cc26xx_sdk_6_41_00_17

示例程序:temp_sensor_lp_CC2652R7_tirtos7_ticlang

背景:
主机和边界路由器位于同一个 WiFi 上、温度传感器连接到边界路由器、Espressif CoAP_server 建立在边界路由器上、用来接收温度传感器发送的值

问题:
为什么不能将温度传感器示例中的 CoAP 帖子发送到 Espressif CoAP_server 示例服务器?

试用流程:
我尝试了 FF02::1和服务器的 IPv6地址作为发送地址,但我没有从 CoAP 服务器获得任何反馈。

我使用 aiocoap 库在主机上编写了一个程序以获取温度传感器中的值、并成功(使用温度传感器的 IPv6地址)。 我还尝试使用 GET 来获取边界路由器上 CoAP_server 的值、并使用 POST 来推送该值、结果也成功。 但我不知道为什么温度传感器中的 CoAP 不能发送到边界路由器中的服务器
这是我编写的 python 代码:

import logging
import asyncio
import time

from aiocoap import *

# logging.basicConfig(level=logging.INFO)
count = 0


async def main():
    global count
    
    sensor_address = "fd01:2c48:84a3:1:ef0f:45ea:99dc:ca90"  
    resource_path = "/tempsensor/temperature" 

    protocol1 = await Context.create_client_context()

    request = Message(code=GET, uri=f"coap://[{sensor_address}]{resource_path}")

    try:
        response = await protocol1.request(request).response

    except Exception as e:
        print("Failed...")
        # print(e)
    else:
        print("%d: %r" % (count, response.payload))
        count += 1


if __name__ == "__main__":
    while 1:
        time.sleep(1)
        asyncio.run(main())

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

    您好!

    您是否看到在线程通道上通过无线发送的 CoAP 数据包?

    您能先确认吗?

    谢谢!
    Toby

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

    您好、Toby


    我找到了答案。  TEMPSENSOR_TEMP_URI 是 tempsensor 中 CoAP 服务器的资源 URL、而另一个是 Espressif CoAP_server 中的资源 URL。

    谢谢!

    Gasen