2016-06-30 5 views
1

계속 질문 게시 : How to get supported measurements of a device in Cumulocity?Cumulocity에서 fragmentType에 대해 지원되는 시리즈를 가져 오는 방법은 무엇입니까?

fragmentType에 대한 가능한 측정 단위 (또는 시리즈)를 가져올 수있는 방법은 무엇입니까?

Humidity sensor: { 
    Temperature: { 
     unit: "Celcius", 
     value: 26.28 
    }, 
    Humidity: { 
     unit: "RH%", 
     value: 30.3 
    } 
} 

가 어떻게 페치 수의 측정을 가져 오는 다음 일련의 표시임을 센서

  • 습도 센서

예를 들어 I는 다음과 같은 측정을 지원하는 장치를 가지고 특정 fragmentType에 대해 지원되는 시리즈? 예를 들어, 위에서 설명한 경우, 나는 이와 같은 목록을 얻고 싶습니다. [ "온도", "습도"]

답변

0

가장 최근의 Cumulocity 버전에서 지원되는 측정을 가져올 수 있습니다. 나는 이렇게 할 수 있었다 :

function fetchSupportedSeries(childDeviceId) { 
    var sensorsAndSeries = []; 
    var query = "inventory/managedObjects/" + childDeviceId + "/supportedSeries"; 
    getDataThroughRest(query).success(storeSensor); 
    return sensorsAndSeries; 

    function storeSensor(response){ 
     for (var i in response.c8y_SupportedSeries){ 
     var sensor = { 
      sensor: response.c8y_SupportedSeries[i].substring(0, response.c8y_SupportedSeries[i].indexOf('.')), 
      series: response.c8y_SupportedSeries[i].substring(response.c8y_SupportedSeries[i].indexOf('.') + 1) 
     }; 
     sensorsAndSeries.push(sensor); 
     } 
    } 
} 
관련 문제