使用Telit ME910C1调制解调器与Azure设备配置服务进行通信

问题描述

我正在尝试使用Telit ME910C1-AU调制解调器连接到Azure DPS。我最初使用HTTP命令(即HTTPSNDHTTPRCV)将数据发送到postman-echo.com并获得了一些成功。但是,当发送到Azure时,我需要添加对称密钥。不幸的是,HTTPSND命令仅允许将内容添加到最大长度为100(无法调整)的标题中,并且密钥超过100个字符,这意味着我无法使用HTTP命令来执行此操作这个。

Telit建议我自己使用SSL命令(SSLDSSLEN等)打开套接字。同样,将数据发送到postman-echo.com还是成功的,但是将数据发送到Azure将返回(看似)格式错误的标头。这些是我发送/接收的命令/响应(为了使内容更清楚,缩进了响应):

at#sgact=1,1
    #SGACT: 10.37.xxx.xxx
    OK
at#sslen=1,1
    OK
at#ssld=1,443,"global.azure-devices-provisioning.net",0
    CONNECT
PUT /<redacted1>/registrations/test-something/register?api-version=2018-11-01 HTTP/1.1\r\nauthorization: SharedAccessSignature sr=<redacted2>\r\nContent-Type: application/json\r\nHost: global.azure-devices-provisioning.net\r\nContent-Length: 35\r\n\r\n{"registrationId":"test-something"}\r\n\r\n
    HTTP/1.1 202 Accepted
    Date: Wed,07 Oct 2020 23:17:53 GMT
    Content-Type: application/json; charset=utf-8
    transfer-encoding: chunked
    Location: https://global.azure-devices-provisioning.net/<redacted1>/registrations/test-something/register
    x-ms-request-id: <redacted3>
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    st
    Connection: close
    Date: Wed,07 Oct 2020 23:17:53 GMT
    Content-Length: 0


    NO CARRIER  

如果我使用Postman,则会收到以下答复。

HTTP/1.1 202 Accepted
Date: Wed,07 Oct 2020 23:09:20 GMT
Content-Type: application/json; charset=utf-8
transfer-encoding: chunked
Location: https://global.azure-devices-provisioning.net/<redacted1>/registrations/test-something/register
x-ms-request-id: <redacted3>
Strict-Transport-Security: max-age=31536000; includeSubDomains
{"operationId":"<redacted5>","status":"assigning"}

这正是我要查看的内容,因为它返回了DPS所需的操作ID。

邮递员和调制解调器发送的标头完全相同,因此我看不到它们返回不同内容的任何原因。它们也都关闭了SSL证书验证。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)