Class Info |
|---|
public class ReadOptions Request class for reading data. The request can be used to specify the type of data to be read and grouped parameters. The read request requires the setting of a time range and allows data to be read in detail or summary mode. |
When constructing a ReadOptions object to read detailed data, you must specify the time range for the data, and specify one or more DataType or DataCollector objects as needed.
Sample code for building a ReadOptions object to read detailed data:
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() Build ReadOptions to read summary data by specifying the time range, summary mode, and grouping mode. These three options are mandatory.
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 | Builder for ReadOptions. |
Type | Name | Description |
|---|---|---|
int | Indicates that there is no limit for the returned data amount. |
Qualifier and Type | Method Name and Description |
|---|---|
List<DataCollector> | Obtains the data collectors for data reading. |
List<DataType> | Obtains the data types for data reading. |
long | getEndTime(TimeUnit timeUnit) Obtains the end time of the target data. |
long | getGroupPeriod(TimeUnit timeUnit) Obtains the group period. |
int | Obtains the group type. |
int | Obtains the maximum number of pages for the paginated query results. |
List<DataCollector> | getPolymerizedDataCollectors() Obtains the polymerized data collectors. |
List<DataType> | Obtains the polymerized data types. |
long | getStartTime(TimeUnit timeUnit) Obtains the start time of the target data. |
Constant |
|---|
public static final int NO_LIMIT Indicates that the returned results are not paginated. Constant value: 0 |
Method |
|---|
public List<DataCollector> getDataCollectors() Obtains the data collectors for data reading. |
Returns
Type | Description |
|---|---|
List<DataCollector> | Data collectors for data reading. |
Method |
|---|
public List<DataType> getDataTypes() Obtains the data types for data reading. |
Returns
Type | Description |
|---|---|
List<DataType> | Data types for data reading. |
Method |
|---|
public long getEndTime(TimeUnit timeUnit) Obtains the end time of the target data. |
Parameters
Name | Description |
|---|---|
timeUnit | Time unit. |
Returns
Type | Description |
|---|---|
long | End time in a specified time unit. |
Method |
|---|
public long getGroupPeriod(TimeUnit timeUnit) Obtains the group period. |
Parameters
Name | Description |
|---|---|
timeUnit | Time unit. |
Returns
Type | Description |
|---|---|
long | Duration for grouping. |
Method |
|---|
public int getGroupType() Obtains the group type. |
Returns
Type | Description |
|---|---|
int | Group type. |
Method |
|---|
public int getPageSize() Obtains the maximum number of pages for the paginated query results. |
Returns
Type | Description |
|---|---|
int | Maximum number of pages for the paginated query results. |
Method |
|---|
public List<DataCollector> getPolymerizedDataCollectors() Obtains the polymerized data collectors. |
Returns
Type | Description |
|---|---|
List<DataCollector> | Polymerized data collectors. |