Log Management

Last Updated on : 2024-03-20 10:06:11download

This topic describes how to get the operation, unlocking, and alert records.

Get operation records

API description

ILockDevice # void getOperateRecords(RecordsParams params, IThingResultCallback<OperateRecordsResp> callback);

Parameter description

Parameter Description
params Parameter bean
params.deviceId The device ID.
params.groupId The site ID.
params.pageSize The number of items returned per page.
params.sortValues The pagination parameter. Pass an empty value for the first page. On subsequent requests, pass the sortValues from the result of the previous page.
callback The callback.

Example

RecordsParams recordsParams = new RecordsParams();
recordsParams.deviceId = deviceId;
recordsParams.groupId = siteId;
recordsParams.pageSize = 20;
recordsParams.sortValues = sortValues;
ThingOSLock.newLockInstance(deviceId).getOperateRecords(recordsParams, new IThingResultCallback<OperateRecordsResp>() {
    @Override
    public void onSuccess(OperateRecordsResp result) {
        //Got operation records successfully
    }

    @Override
    public void onError(String errorCode, String errorMessage) {
        //Failed to get operation records
    }
});

Get unlocking records

API description

ILockDevice # void getOpenRecords(RecordsParams params, IThingResultCallback<OpenRecordsResp> callback);

Parameter description

Parameter Description
params Parameter bean
params.deviceId The device ID.
params.groupId The site ID.
params.pageSize The number of items returned per page.
params.sortValues The pagination parameter. Pass an empty value for the first page. On subsequent requests, pass the sortValues from the result of the previous page.
callback The callback.

Example

RecordsParams recordsParams = new RecordsParams();
recordsParams.deviceId = deviceId;
recordsParams.groupId = siteId;
recordsParams.pageSize = 20;
recordsParams.sortValues = sortValues;
ThingOSLock.newLockInstance(deviceId).getOpenRecords(recordsParams, new IThingResultCallback<OpenRecordsResp>() {
    @Override
    public void onSuccess(OpenRecordsResp result) {
        //Got unlocking records successfully
    }

    @Override
    public void onError(String errorCode, String errorMessage) {
        //Failed to get unlocking records
    }
});

Get alert records

API description

ILockDevice # void getAlarmRecords(RecordsParams params, IThingResultCallback<AlarmRecordsResp> callback);

Parameter description

Parameter Description
params Parameter bean
params.deviceId The device ID.
params.groupId The site ID.
params.pageSize The number of items returned per page.
params.sortValues The pagination parameter. Pass an empty value for the first page. On subsequent requests, pass the sortValues from the result of the previous page.
callback The callback.

Example

RecordsParams recordsParams = new RecordsParams();
recordsParams.deviceId = deviceId;
recordsParams.groupId = siteId;
recordsParams.pageSize = 20;
recordsParams.sortValues = sortValues;
ThingOSLock.newLockInstance(deviceId).getAlarmRecords(recordsParams, new IThingResultCallback<AlarmRecordsResp>() {
    @Override
    public void onSuccess(AlarmRecordsResp result) {
        // Got alarm records successfully
    }

    @Override
    public void onError(String errorCode, String errorMessage) {
        // Failed to get alarm records
    }
});