Class Info |
|---|
public class ReadOptions 数据读取请求类,使用此请求可以指定要读取的数据类型以及聚合参数,读取请求需要设置时间范围,并允许以详细或汇总的方式读取数据。 |
构建ReadOptions查询详情数据,需要指定详情数据的时间区间(必填),一个或多个特定的DataType或DataCollector。
构建ReadOptions查询数据详情的示例代码如下:
“Java”
ReadOptions readOptions = new ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.read(DataType.DT_CONTINUOUS_STEPS_DELTA)
.build(); “Kotlin”
val readOptions = ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.read(DataType.DT_CONTINUOUS_STEPS_DELTA)
.build() “Java”
ReadOptions readOptions = new ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.read(DataType.DT_CONTINUOUS_STEPS_DELTA)
.read(DataType.DT_INSTANTANEOUS_HEIGHT)
.build(); “Kotlin”
val readOptions = ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.read(DataType.DT_CONTINUOUS_STEPS_DELTA)
.read(DataType.DT_INSTANTANEOUS_HEIGHT)
.build() “Java”
ReadOptions readOptions = new ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.read(dataCollectorDevices)
.build(); “Kotlin”
val readOptions = ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.read(dataCollectorDevices)
.build() 构建ReadOptions查询汇总数据,需要指定汇总数据的时间区间(必填),汇总方式(必填),分组方式(必填)。
“Java”
ReadOptions readOptions = new ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.polymerize(DataType.DT_CONTINUOUS_STEPS_DELTA, DataType.DT_CONTINUOUS_STEPS_TOTAL)
.groupByTime(1, TimeUnit.HOURS)
.build(); “Kotlin”
val readOptions = ReadOptions.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.polymerize(DataType.DT_CONTINUOUS_STEPS_DELTA, DataType.DT_CONTINUOUS_STEPS_TOTAL)
.groupByTime(1, TimeUnit.HOURS)
.build()
Qualifier and Type | Class Name and Description |
|---|---|
public static class | ReadOptions的构造器。 |
Qualifier and Type | Method Name and Description |
|---|---|
List<DataCollector> | 获取要读取的数据采集器。 |
List<DataType> | 获取要读取的数据类型。 |
long | getEndTime(TimeUnit timeUnit) 获取读取数据区间的结束时间。 |
long | getGroupPeriod(TimeUnit timeUnit) 获取数据的分组时长。 |
int | 获取分组的类型。 |
int | 获取结果分页的上限数量。 |
List<DataCollector> | getPolymerizedDataCollectors() 获取聚合后的数据采集器。 |
List<DataType> | 获取聚合后的数据类型。 |
long | getStartTime(TimeUnit timeUnit) 获取读取数据区间的开始时间。 |
Method |
|---|
public List<DataCollector> getDataCollectors() 获取要读取的数据采集器。 |
Returns
Type | Description |
|---|---|
List<DataCollector> | 获取要读取的数据采集器。 |
Method |
|---|
public List<DataType> getDataTypes() 获取要读取的数据类型。 |
Returns
Type | Description |
|---|---|
List<DataType> | 获取要读取的数据类型。 |
Method |
|---|
public long getEndTime(TimeUnit timeUnit) 获取读取数据区间的结束时间。 |
Parameters
Name | Description |
|---|---|
timeUnit | 时间单位。 |
Returns
Type | Description |
|---|---|
long | 返回指定时间单位的结束时间。 |
Method |
|---|
public long getGroupPeriod(TimeUnit timeUnit) 获取数据的分组时长。 |
Parameters
Name | Description |
|---|---|
timeUnit | 时间单位。 |
Returns
Type | Description |
|---|---|
long | 获取分组的持续时间。 |
Method |
|---|
public int getPageSize() 获取结果分页的上限数量。 |
Returns
Type | Description |
|---|---|
int | 获取结果分页的上限数量。 |
Method |
|---|
public List<DataCollector> getPolymerizedDataCollectors() 获取聚合后的数据采集器。 |
Returns
Type | Description |
|---|---|
List<DataCollector> | 获取聚合后的数据采集器。 |