通过initialTwin标签在Device Provisioning Service上搜索注册设备

时间:2018-10-23 10:38:53

标签: azure azure-iot-hub azure-iot-sdk azure-iot-hub-device-management

我想在DPS上搜索特定的注册设备(基于其“ OL”标签)。为此,我使用下一段代码:

QuerySpecification querySpecification = new QuerySpecificationBuilder("*",QuerySpecificationBuilder.FromType.ENROLLMENTS)
            .where("initialTwin.tags.OL='12345678ABCD'")
            .createSqlQuery();
Query query = provisioningServiceClient.createIndividualEnrollmentQuery(querySpecification);

但是,当我执行query.next()来获取结果时,总是返回DPS中的所有设备。

我也尝试在“ where”子句中使用deviceId,但它也会返回所有设备。

我做错了什么?

1 个答案:

答案 0 :(得分:1)

当前service不支持SELECT A.* , B.REPORTING_PERIOD , D.HPI AS CURRENT_HPI , E.USSWAP10 , B.DLQ_STATUS AS CURRENT_STATUS , C.DLQ_STATUS AS NEXT_STATUS FROM PORTFOLIO A JOIN ALL_PERFORMANCE B ON A.AGENCY = B.AGENCY AND A.LOAN_ID = B.LOAN_ID JOIN ALL_PERFORMANCE C ON A.AGENCY = C.AGENCY AND A.LOAN_ID = C.LOAN_ID AND DATEADD(MONTH, 1, B.REPORTING_PERIOD) = C.REPORTING_PERIOD LEFT JOIN CASE_SHILLER D ON A.GEO_CODE = D.GEO_CODE AND B.REPORTING_PERIOD = D.AS_OF_DATE LEFT JOIN SWAP_10Y E ON B.REPORTING_PERIOD = E.AS_OF_DATE 子句或任何过滤器选项。目前最好的选择是检索完整列表并进行客户端过滤。