Skip to content

Device Data Statistics

Feature Description

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

objc
#import <QuecDeviceKit/QuecDeviceKit.h>
/// Initialize
[QuecDeviceStatisticsService sharedInstance]

Data Statistics

Query Device's Historical Trajectory

API

Query a device's historical trajectory.

objc
- (void)getLocationHistoryWithProductKey:(NSString *)productKey
                                 deviceKey:(NSString *)deviceKey
                           startTimestamp:(NSInteger)startTimestamp
                             endTimestamp:(NSInteger)endTimestamp
                                gatewayDk:(NSString *)gatewayDk
                                gatewayPk:(NSString *)gatewayPk
                              locateTypes:(NSString *)locateTypes
                                  success:(void(^)(NSArray<QuecLocationHistoryModel *> *list))success
                                  failure:(QuecErrorBlock)failure;

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
successNCallback function of successful request.
failureNCallback function of failed request.

QuecLocationHistoryModel Definition

FieldTypeDescription
bdLatNSNumberDevice latitude (BD09).
bdLngNSNumberDevice longitude (BD09).
deviceKeyNSStringDeviceKey.
gcjLatNSNumberDevice latitude (GCJ02).
gcjLngNSNumberDevice longitude (GCJ02).
hdopNSNumberHorizontal dilution of precision (0.5 – 99.99).
locateIdNSStringTrajectory ID.
locateTypeNSIntegerLocation method.
0-GNSS
1-LBS
2-Manual fixed-point
locationTimeNSStringPositioning time.
productKeyNSStringProductKey.
satellitesNSIntegerCurrent number of satellites.
tsLocateTimeNSIntegerThe latest positioning time (timestamp).
wgsLatNSNumberDevice latitude (WGS84).
wgsLngNSNumberDevice longitude (WGS84).

Example

objc
[QuecDeviceStatisticsService.sharedInstance getLocationHistoryWithProductKey:@"productKey"
                                                                       deviceKey:@"deviceKey"
                                                                  startTimestamp:startTimestamp
                                                                    endTimestamp:endTimestamp
                                                                       gatewayDk:@"gatewayDk"
                                                                       gatewayPk:@"gatewayPk"
                                                                     locateTypes:locateTypes
                                                                         success:^(NSArray<QuecLocationHistoryModel *> * _Nonnull list) {
/// Next Action
} failure:^(NSError *error) {
NSLog(@"check error: %@", error);
}];

Query List of Device Property Chart

API

Query a list of device property charts.

objc
- (void)getPropertyChartListWithProductKey:(NSString *)productKey
                                   deviceKey:(NSString *)deviceKey
                             startTimestamp:(NSInteger)startTimestamp
                               endTimestamp:(NSInteger)endTimestamp
                              attributeCode:(NSString *)attributeCode
                                  gatewayDk:(NSString *)gatewayDk
                                  gatewayPk:(NSString *)gatewayPk
                                  countType:(NSInteger)countType
                            timeGranularity:(NSInteger)timeGranularity
                                    success:(void(^)(NSArray<QuecPropertyChartListModel *> *dataArray))success
                                    failure:(QuecErrorBlock)failure;

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
successNCallback function of successful request.
failureNCallback function of failed request.

QuecPropertyChartListModel Definition

FieldTypeDescription
propertyCodeNSStringTSL code.
xaxisDataNSArray<NSString *>Recording time.
xaxisDataTsNSArray<NSNumber *>Timestamp.
yaxisDataNSArrayProperty content.

Example

objc
[QuecDeviceStatisticsService.sharedInstance getPropertyChartListWithProductKey:@"productKey"
                                                                         deviceKey:@"deviceKey"
                                                                    startTimestamp:startTimestamp
                                                                      endTimestamp:endTimestamp
                                                                     attributeCode:@"code1,code2,code3"
                                                                         gatewayDk:@"gatewayDk"
                                                                         gatewayPk:@"gatewayPk"
                                                                         countType:countType
                                                                   timeGranularity:timeGranularity
                                                                           success:^(NSArray<QuecPropertyChartListModel *> * _Nonnull dataArray) {
    /// Next Action
} failure:^(NSError *error) {
NSLog(@"check error: %@", error);
}];

Query Device Property MoM Statistical Data

API

Query device property MoM statistical data.

objc
- (void)getPropertyStatisticsPathWithProductKey:(NSString *)productKey
                                        deviceKey:(NSString *)deviceKey
                                 currentTimestamp:(NSInteger)currentTimestamp
                                    attributeCode:(NSString *)attributeCode
                                        gatewayDk:(NSString *)gatewayDk
                                        gatewayPk:(NSString *)gatewayPk
                                        countType:(NSInteger)countType
                                timeGranularities:(NSString *)timeGranularities
                                          success:(void(^)(NSArray<QuecPropertyStatisticsModel *> *dataArray))success
                                          failure:(QuecErrorBlock)failure;

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
successNCallback function of successful request.
failureNCallback function of failed request.

QuecPropertyStatisticsModel Definition

FieldTypeDescription
statValueNSArrayCurrent MoM value.
timeGranularityNSIntegerTime units.
1-Day
2-Week
3-Month
4-Year

Example

objc
[QuecDeviceStatisticsService.sharedInstance getPropertyStatisticsPathWithProductKey:@"productKey"
                                                                              deviceKey:@"deviceKey"
                                                                       currentTimestamp:currentTimestamp
                                                                          attributeCode:@"code1,code2,code3"
                                                                              gatewayDk:@"gatewayDk"
                                                                              gatewayPk:@"gatewayPk"
                                                                              countType:countType
                                                                      timeGranularities:timeGranularities
                                                                                success:^(NSArray<QuecPropertyStatisticsModel *> * _Nonnull dataArray) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query Property Data List

API

Query a property data list.

objc
- (void)getPropertyDataListWithProductKey:(NSString *)productKey
                                  deviceKey:(NSString *)deviceKey
                             startTimestamp:(NSInteger)startTimestamp
                               endTimestamp:(NSInteger)endTimestamp
                              attributeCode:(NSString *)attributeCode
                                  gatewayDk:(NSString *)gatewayDk
                                  gatewayPk:(NSString *)gatewayPk
                                 pageNumber:(NSInteger)pageNumber
                                   pageSize:(NSInteger)pageSize
                                    success:(void(^)(NSArray<QuecPropertyDataListModel *> *list, NSInteger total))success
                                    failure:(QuecErrorBlock)failure;

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.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[QuecDeviceStatisticsService.sharedInstance getPropertyDataListWithProductKey:@"productKey"
                                                                        deviceKey:@"deviceKey
                                                                   startTimestamp:startTimestamp 
                                                                     endTimestamp:endTimestamp
                                                                    attributeCode:@"code1,code2,code3"
                                                                        gatewayDk:@"gatewayDk"
                                                                        gatewayPk:@"gatewayPk"
                                                                       pageNumber:1
                                                                         pageSize:10 success:^(NSArray<QuecPropertyDataListModel *> * _Nonnull list, NSInteger total) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];