Alert List

Last Updated on : 2024-06-17 08:02:16download

Create a message manager

Creates an entity object of the message manager IThingCameraMessage.

API description

IThingCameraMessage createCameraMessage();

Example

private IThingCameraMessage mTyCameraMessage;

IThingIPCMsg message = ThingIPCSdk.getMessage();
if (message != null) {
    cameraMessage = message.createCameraMessage();
}

Query alert calendar

Returns the date on which alerts are generated and displays the alert calendar.

API description

void queryMotionDaysByMonth(String devId, int year, int month, String timeZoneId, IThingResultCallback<List<String>> callback);

Parameters

Parameter Description
devId The device ID.
year The year in which alerts were generated.
month The month in which alerts were generated.
timeZoneId timeZone ID, Generally take the device time zone
callback The callback.

Example

mTyCameraMessage.queryMotionDaysByMonth(mDeviceBean.getDevId(), year, month, TimeZone.getDefault().getID(), new IThingResultCallback<List<String>>() {
    @Override
    public void onSuccess(List<String> result) {

    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

Query alert types

Detection alerts are classified into multiple types based on trigger methods. Certain types belong to a specific category. The IPC SDK returns a list of alerts by default category to support queries of alerts based on categories.

API description

void queryAlarmDetectionClassify(String devId, IThingResultCallback<List<CameraMessageClassifyBean>> callback);

Parameters

Parameter Description
devId The device ID.
callback The callback.

Example

mTyCameraMessage.queryAlarmDetectionClassify(devId, new IThingResultCallback<List<CameraMessageClassifyBean>>() {
    @Override
    public void onSuccess(List<CameraMessageClassifyBean> result) {

    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

Data model of CameraMessageClassifyBean

Parameter Description
describe The description of an alert.
msgCode An array of alert types. An alert type represents a trigger method of alerts. It is indicated by the msgCode attribute of the alert data model.

Description of msgCode

Type Description
ipc_motion Motion detection
ipc_doorbell Doorbell call
ipc_dev_link Device linkage
ipc_passby Someone passes by
ipc_linger Someone lingers
ipc_leave_msg Leave messages on doorbell
ipc_connected Doorbell answered
ipc_unconnected Doorbell missed
ipc_refuse Doorbell rejected
ipc_human Human shape detection
ipc_cat Pet detection
ipc_car Vehicle detection
ipc_baby_cry Baby cry
ipc_bang Abnormal sound
ipc_antibreak Tamper alarm
ipc_low_battery Low battery alert

The types of alerts that can be triggered vary depending on device capabilities. Alert categories and alert types are distinguished in the following ways:

  • An alert type represents a trigger method of an alert.
  • An alert category is a collection of one or more alert types. For example, ipc_passby, ipc_linger, and ipc_motion can belong to the motion detection category.

Query detection alerts

API description

void getAlarmDetectionMessageList(String devId, int startTime, int endTime, String[] msgCodes, int offset, int limit, IThingResultCallback<List<CameraMessageBean>> callback);

Parameters

Parameter Description
devId The device ID.
startTime The start timestamp. Unit: seconds.
endTime The end timestamp. Unit: seconds.
msgCodes The array of alert types.
  • If this parameter is not set, all types of alerts are returned by default.
  • If this parameter is set, the specified type of alert is returned. For more information about the array of alert types, see Query alert types.
offset The offset of returned data to display data on pages.
limit The maximum number of returned entries in each call.

To get all alerts on a specific date, you can set the interval between the start timestamp and the end timestamp to one day.

Example

mTyCameraMessage.getAlarmDetectionMessageList(devId, startTime, endTime, selectClassify.getMsgCode(), 0, 30, new IThingResultCallback<List<CameraMessageBean>>() {
    @Override
    public void onSuccess(List<CameraMessageBean> result) {

    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

Data model of CameraMessageBean

Parameter Description
dateTime The date on which an alert occurs.
time The timestamp of an event.
attachPics The images of events in the array format. The first element of the array is used.
attachVideos The videos of events in the array format. The first element of the array is used.
id The event ID.
msgSrcId The alert ID.

Delete alerts in bulk

API description

void deleteMotionMessageList(List<String> ids, IThingResultCallback<Boolean> callback);

Parameters

Parameter Description
ids The list of IDs for the alerts to be deleted.

Example

cameraMessage.deleteMotionMessageList(ids, new IThingResultCallback<Boolean>() {
    @Override
    public void onSuccess(Boolean result) {

    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

Destroy or exit the message manager

API description

void destroy();

Example

if (null != mTyCameraMessage) {
        mTyCameraMessage.destroy();
        }