Last Updated on : 2024-04-07 08:25:30download
Returns the logs of data points (DPs) reported by a device. The logs only in the last seven days are supported.
Query the logs of DPs reported by a specified device, helping you get to know the operation history of the device within a specific period.
- (void)queryDeviceOperateLogWithDpIds:(NSArray *)dpIds
offset:(NSInteger)offset
limit:(NSInteger)limit
startTime:(NSDate *)startTime
endTime:(NSDate *)endTime
isASC:(BOOL)isASC
success:(ThingSuccessID)success
failure:(ThingFailureError)failure;
Parameter | Type | Description | Required |
---|---|---|---|
dpIds | NSArray | The DPs to be returned. Example: @[@"1", @"2"] . |
Yes |
offset | NSInteger | The number of entries starting from which entries are returned. | Yes |
limit | NSInteger | The maximum number of entries returned per page. | Yes |
startTime | NSDate | The time when DP status reporting starts. | No |
endTime | NSDate | The time when DP status reporting ends. | No |
isASC | BOOL | The method to sort data by time. Valid values:
|
No |
success | ThingSuccessID block | The success callback. | Yes |
failure | ThingFailureError block | The failure callback. | Yes |
Objective-C:
NSArray *dpIds = @[@"1", @"2"];
NSInteger offset = 0;
NSInteger limit = 10;
NSDate *startTime = nil; // Use actual date if available
NSDate *endTime = nil; // Use actual date if available
BOOL isASC = NO;
ThingSmartDevice *device = [[ThingSmartDevice alloc] init];
[device queryDeviceOperateLogWithDpIds:dpIds offset:offset limit:limit startTime:startTime endTime:endTime isASC:isASC success:^(id result) {
NSLog(@"Success: %@", result);
} failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
Swift:
let dpIds: [String] = ["1", "2"]
let offset: Int = 0
let limit: Int = 10
let startTime: Date?= nil // Use actual date if available let endTime: Date?= nil // Use actual date if available let isASC: Bool = false
let device = ThingSmartDevice()
device.queryDeviceOperateLog(withDpIds: dpIds, offset: offset, limit: limit, startTime: startTime, endTime: endTime, isASC: isASC, success: { result in
print("Success: \(result)")
}, failure: { error in
print("Error: \(error)")
})
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback