如何使用 Azure Iot 获取设备的当前位置
How to get current location of device with Azure Iot
我们正在使用 Azure 的 IOT Hub 来连接我们的设备,目前,这些设备连接到 pc。
我们如何从 azure IOT Hub 获取这些设备的 IP 或当前位置?有什么建议或建议吗?
是否可以使用 azure 功能连接 IOT Hub 以获取 IP,然后使用 azure 地图获取国家/地区以插入 azure sql 数据库?
感谢您的回答!我对 azure
很陌生
您尝试过设备遥测 API 吗?
您可以发送 get/ post 请求来获取设备的遥测详细信息。 API 将 return 设备的地理位置。
提供API的用法at this location on GitHub。
示例获取请求:
GET {Device Telemetry endpoint}/messages?from={time}&to={time}&order=desc&grouplimit=1&devices=id1,id2,id3,...
示例Post请求:
POST {Device Telemetry endpoint}/messages-query
Content-Type: application/json; charset=utf-8
{
From: {time}
To: {time}
Order: desc
GroupLimit: 1
Devices: [ id1, id2, id3, ... ]
}
响应示例:
Content-Type: application/json; charset=utf-8
{
Items: [
{
deviceid
time
value 1
value 2
value N
$metadata
},
{
deviceid
time
value 1
value 2
value N
$metadata
},
...
],
"$metadata": {
$type: MessagesList;1
$uri: ...
}
}
希望对您有所帮助。
我们正在使用 Azure 的 IOT Hub 来连接我们的设备,目前,这些设备连接到 pc。
我们如何从 azure IOT Hub 获取这些设备的 IP 或当前位置?有什么建议或建议吗?
是否可以使用 azure 功能连接 IOT Hub 以获取 IP,然后使用 azure 地图获取国家/地区以插入 azure sql 数据库?
感谢您的回答!我对 azure
很陌生您尝试过设备遥测 API 吗?
您可以发送 get/ post 请求来获取设备的遥测详细信息。 API 将 return 设备的地理位置。
提供API的用法at this location on GitHub。
示例获取请求:
GET {Device Telemetry endpoint}/messages?from={time}&to={time}&order=desc&grouplimit=1&devices=id1,id2,id3,...
示例Post请求:
POST {Device Telemetry endpoint}/messages-query
Content-Type: application/json; charset=utf-8
{
From: {time}
To: {time}
Order: desc
GroupLimit: 1
Devices: [ id1, id2, id3, ... ]
}
响应示例:
Content-Type: application/json; charset=utf-8
{
Items: [
{
deviceid
time
value 1
value 2
value N
$metadata
},
{
deviceid
time
value 1
value 2
value N
$metadata
},
...
],
"$metadata": {
$type: MessagesList;1
$uri: ...
}
}
希望对您有所帮助。