Skip to content

设备数据统计

功能概述

设备数据统计管理, 主要获取设备相关的统计信息

objc
#import <QuecDeviceKit/QuecDeviceKit.h>
/// 初始化
[QuecDeviceStatisticsService sharedInstance]

数据统计

设备历史轨迹

接口说明

获取设备历史轨迹

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;

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
startTimestamp开始时间(毫秒时间戳)
endTimestamp结束时间(毫秒时间戳)
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
locateTypes定位类型(默认查询所有类型的定位),查询多种定位时使用英文逗号分隔 GNSS-全球导航卫星系统 GPS-美国导航定位系统 GL-俄罗斯格洛纳导航定位系统 GA-欧盟伽利略卫星导航系统 BD/PQ-中国导航定位系统 LBS-基于通信运营商的基站定位系统
success接口请求成功回调
failure接口请求失败回调

QuecLocationHistoryModel属性定义

字段类型描述
bdLatNSNumber设备纬度。BD09
bdLngNSNumber设备经度。BD09
deviceKeyNSString设备dk
gcjLatNSNumber设备纬度。GCJ02
gcjLngNSNumber设备经度。GCJ02
hdopNSNumber水平精度因子。0.5-99.99
locateIdNSString轨迹ID
locateTypeNSInteger定位方式(0:GNSS 1:LBS 2:手动标点)
locationTimeNSString定位时间
productKeyNSString设备pk
satellitesNSInteger当前卫星数
tsLocateTimeNSInteger最新定位时间(时间戳)
wgsLatNSNumber设备纬度。WGS84
wgsLngNSNumber设备经度。WGS84

示例代码

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);
}];

设备属性图表列表

接口说明

获取设备属性图表列表

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;

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
startTimestamp开始时间(毫秒时间戳)
endTimestamp结束时间(毫秒时间戳)
attributeCode物模型属性标识符,查询多个属性时使用英文逗号分隔
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
countType聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值
timeGranularity统计时间粒度(默认2):1-月 2-日 3-小时 4-分钟 5-秒
success接口请求成功回调
failure接口请求失败回调

QuecPropertyChartListModel属性定义

字段类型描述
propertyCodeNSString物模型code
xaxisDataNSArray<NSString *>记录时间
xaxisDataTsNSArray<NSNumber *>时间戳
yaxisDataNSArray属性内容

示例代码

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);
}];

设备属性环比统计数据

接口说明

获取设备属性环比统计数据

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;

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
currentTimestamp当前时间(毫秒时间戳)
attributeCode物模型属性标识符,查询多个属性时使用英文逗号分隔
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
countType聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值
timeGranularities统计时间粒度,查询多个粒度时使用英文逗号分隔(默认1):1-日 2-周 3-月 4-年
success接口请求成功回调
failure接口请求失败回调

QuecPropertyStatisticsModel属性定义

字段类型描述
statValueNSArray当期环比值
timeGranularityNSInteger时间单位 【1-日,2-周,3-月,4-年】

示例代码

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);
}];

设备属性数据列表

接口说明

获取设备属性数据列表

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;

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
startTimestamp开始时间(毫秒时间戳)
endTimestamp结束时间(毫秒时间戳)
attributeCode物模型属性标识符,查询多个属性时使用英文逗号分隔
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
pageNumber当前页,默认为第 1 页
pageSize页大小,默认为 10 条
success接口请求成功回调
failure接口请求失败回调

示例代码

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);
    }];