Skip to content

Device Data Statistics

Feature Description

The device data statistics feature is mainly used to obtains device-related statistical information.

kotlin
QuecDeviceStatisticsService

Data Statistics

Query Device's Historical Trajectory

API

Query a device's historical trajectory.

kotlin
fun getLocationHistory(
    productKey: String,
    deviceKey: String,
    startTimestamp: Long,
    endTimestamp: Long,
    gatewayDk: String?,
    gatewayPk: String?,
    locateTypes: String?,
    callback: QuecCallback<List<QuecLocationHistoryModel>>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
startTimestampYStart time (timestamp in millisecond).
endTimestampYEnd time (timestamp in millisecond).
gatewayDkNGateway DeviceKey.
gatewayPkNGateway ProductKey.
locateTypesNPositioning type (query all types of positioning by default). Separate multiple positionings by commas.
GNSS-Global Navigation Satellite System
GPS-Global Positioning System
GL-Global Navigation Satellite System
GA-Galileo Positioning System
BD/PQ-BeiDou Navigation Satellite System
LBS-Location-Based Service
callbackYCallback function of the request.

QuecLocationHistoryModel Definition

FieldTypeDescription
bdLatDoubleDevice latitude (BD09).
bdLngDoubleDevice longitude (BD09).
deviceKeyStringDeviceKey.
gcjLatDoubleDevice latitude (GCJ02).
gcjLngDoubleDevice longitude (GCJ02).
hdopDoubleHorizontal dilution of precision (0.5 – 99.99).
locateIdStringTrajectory ID.
locateTypeintLocation method.
0-GNSS
1-LBS
2-Manual fixed-point
locationTimeStringLocation time.
productKeyStringProductKey.
satellitesintCurrent number of satellites.
tsLocateTimeintThe latest positioning time (timestamp).
wgsLatDoubleDevice latitude (WGS84).
wgsLngDoubleDevice longitude (WGS84).

Example

kotlin
QuecDeviceStatisticsService.getLocationHistory(
    "pk",
    "dk",
    System.currentTimeMillis() - 90000,
    System.currentTimeMillis(),
    null,
    null,
    "GNSS"
) {
    if (it.isSuccess) {
        val data = it.data //Query a device historical trajectory successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query List of Device Property Chart

API

Query a list of device property charts.

kotlin
fun getPropertyChartList(
    productKey: String,
    deviceKey: String,
    startTimestamp: Long,
    endTimestamp: Long,
    attributeCode: String,
    gatewayDk: String?,
    gatewayPk: String?,
    countType: Int,
    timeGranularity: Int,
    callback: QuecCallback<List<QuecPropertyChartListModel>>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
startTimestampYStart time (timestamp in millisecond).
endTimestampYEnd time (timestamp in millisecond).
attributeCodeNTSL model property identifier. Separate multiple properties by commas.
gatewayDkNGateway DeviceKey.
gatewayPkNGateway ProductKey.
countTypeNAggregation type (Default value: 3).
1-Maximum
2-Minimum
3-Average
4-Difference.
timeGranularityNStatistical time granularity (Default value: 3).
1-Month
2-Day
3-Hour
4-Minute
5-Second
callbackYCallback function of the request.

QuecPropertyChartListModel Definition

FieldTypeDescription
propertyCodeStringTSL code.
xaxisDataList<String>Recording time.
xaxisDataTsList<Double>Timestamp.
yaxisDataList<Any>Property content.

Example

kotlin
QuecDeviceStatisticsService.getPropertyChartList(
    "pk",
    "dk",
    System.currentTimeMillis() - 90000,
    System.currentTimeMillis(),
    "temperature",
    null,
    null,
    3,
    1
) {
    if (it.isSuccess) {
        val data = it.data //Query a list of device property charts successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query Device Property MoM Statistical Data

API

Query device property MoM statistical data.

kotlin
fun getPropertyStatisticsPath(
    productKey: String,
    deviceKey: String,
    currentTimestamp: Long,
    attributeCode: String,
    gatewayDk: String?,
    gatewayPk: String?,
    countType: Int,
    timeGranularities: String?,
    callback: QuecCallback<List<QuecPropertyStatisticsModel>>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
currentTimestampYCurrent time (timestamp in millisecond).
attributeCodeNTSL model property identifier. Separate multiple properties by commas.
gatewayDkNGateway DeviceKey.
gatewayPkNGateway ProductKey.
countTypeNAggregation type (Default value: 3).
1-Maximum
2-Minimum
3-Average
4-Difference.
timeGranularitiesNStatistical time granularity (Default value: 1). Separate multiple granularities by commas.
1-Day
2-Week
3-Month
4-Year
callbackYCallback function of the request.

QuecPropertyStatisticsModel Definition

FieldTypeDescription
statValueListList<Any>Current MoM value.
timeGranularityintTime units.
1-Day
2-Week
3-Month
4-Year

Example

kotlin
QuecDeviceStatisticsService.getPropertyStatisticsPath(
    "pk",
    "dk",
    System.currentTimeMillis(),
    "temperature",
    null,
    null,
    3,
    "1,2,3"
) {
    if (it.isSuccess) {
        val data = it.data //Query device property MoM statistical data successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query Property Data List

API

Query a property data list.

kotlin
fun getPropertyDataList(
    productKey: String,
    deviceKey: String,
    startTimestamp: Long,
    endTimestamp: Long,
    attributeCode: String,
    gatewayDk: String?,
    gatewayPk: String?,
    pageNumber: Int,
    pageSize: Int,
    callback: QuecCallback<QuecPageResponse<QuecPropertyDataListModel>>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
startTimestampYStart time (timestamp in millisecond).
endTimestampYEnd time (timestamp in millisecond).
attributeCodeNTSL property identifier. Separate multiple properties by commas.
gatewayDkNGateway DeviceKey.
gatewayPkNGateway ProductKey.
pageNumberNCurrent Page. Default value: 1.
pageSizeNPage size: Default value: 10.
callbackYCallback function of the request.

Example

kotlin
QuecDeviceStatisticsService.getPropertyDataList(
    "pk",
    "dk",
    System.currentTimeMillis() - 90000,
    System.currentTimeMillis(),
    "temperature",
    null,
    null,
    1,
    10
) {
    if (it.isSuccess) {
        val data = it.data //Query a property data list successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}