Search in sources :

Example 6 with SensorRecord

use of org.wso2.iot.sampledevice.api.dto.SensorRecord in project product-iots by wso2.

the class APIUtil method createSensorData.

/**
 * @param record Record to convert to SensorRecord
 * @return SensorRecord
 */
public static SensorRecord createSensorData(Record record) {
    SensorRecord recordBean = new SensorRecord();
    recordBean.setId(record.getId());
    recordBean.setValues(record.getValues());
    return recordBean;
}
Also used : SensorRecord(org.wso2.iot.sampledevice.api.dto.SensorRecord)

Example 7 with SensorRecord

use of org.wso2.iot.sampledevice.api.dto.SensorRecord in project product-iots by wso2.

the class APIUtil method createSensorData.

/**
 * Creates the SensorDatas from records.
 *
 * @param records the records
 * @return the Map of SensorRecord <id, SensorRecord>
 */
public static Map<String, SensorRecord> createSensorData(List<Record> records) {
    Map<String, SensorRecord> sensorDatas = new HashMap<>();
    for (Record record : records) {
        SensorRecord sensorData = createSensorData(record);
        sensorDatas.put(sensorData.getId(), sensorData);
    }
    return sensorDatas;
}
Also used : HashMap(java.util.HashMap) Record(org.wso2.carbon.analytics.datasource.commons.Record)

Aggregations

SensorRecord (org.wso2.iot.sampledevice.api.dto.SensorRecord)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 AnalyticsDataAPI (org.wso2.carbon.analytics.api.AnalyticsDataAPI)2 AnalyticsDataResponse (org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse)2 SearchResultEntry (org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry)2 SortByField (org.wso2.carbon.analytics.dataservice.commons.SortByField)2 Record (org.wso2.carbon.analytics.datasource.commons.Record)2 AnalyticsException (org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException)2 DeviceIdentifier (org.wso2.carbon.device.mgt.common.DeviceIdentifier)2 DeviceAccessAuthorizationException (org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException)2 SensorRecord (org.coffeeking.api.util.SensorRecord)1