更新时间:2024-09-05 03:17:44下载pdf
本文详细介绍如何使用消息数据模型及其相关接口来进行各种消息处理操作,包括查询消息、标记为已读消息、删除消息和获取加密消息密钥等。通过本文档,您可以了解每个接口的具体用途、参数说明以及调用示例,从而快速集成这些功能到您自己的应用中。
消息数据模型包含家庭、图标和消息类型等。
消息中心拓展 SDK 的消息都使用 MessageBean
来描述,其属性类型说明如下:
属性 | 类型 | 说明 |
---|---|---|
extendParams | String | 扩展参数 |
isNeedPullEncKey | Boolean | 是否需要获取加密密钥,以便解密图片 |
isExpirePics | Boolean | 图片是否过期 |
isExpireVideos | Boolean | 视频是否过期 |
homeId | String | 家庭 ID |
homeName | String | 家庭名称 |
encryptKey | String | 加密密钥 |
hasNotRead | Boolean | 是否未读 |
alarmType | Int | 报警类型 |
dateTime | String | 日期和时间,格式:2017-09-08 17:12:45 |
icon | String | 消息图标 URL |
msgTypeContent | String | 消息类型名称 |
msgContent | String | 消息内容 |
attachPics | String | 附件图片名称 |
id | String | 消息 ID |
msgType | Int | 消息类型 |
msgSrcId | String | 设备 ID |
choose | Boolean | 是否选中 |
actionURL | String | 操作 URL |
time | Long | 时间戳 |
messageAttach | MessageAttach | 消息附件 |
attachVideos | List<String> |
附件里的视频列表 |
attachAudios | List<String> |
附件里的音频列表 |
想要更新消息时,获取指定类型的消息列表。
fun requestMessageListByType(
offset: Int,
limit: Int,
msgType: MessageType,
callback: IThingDataCallback<MessageListBean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
offset | Int | 开始获取消息位置 |
limit | Int | 每页获取的消息数量 |
msgType | MessageType | 获取的消息类型 |
callback | IThingDataCallback<MessageListBean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().requestMessageListByType(10, 20, MSG_REPORT, new IThingDataCallback<MessageListBean>() {
@Override
public void onSuccess(MessageListBean result) {
mBeanResult.t.postValue(change(msgType, result, null));
mBeanResult.networkState.postValue(NetworkState.SUCCESS);
}
@Override
public void onError(String errorCode, String errorMessage) {
mBeanResult.networkState.postValue(NetworkState.falied(errorCode,
errorMessage));
}
})
fun getMessageListByMsgSrcId(
offset: Int,
limit: Int,
msgType: Int,
msgSrcId: String?,
encryptImage: Boolean,
callback: IThingDataCallback<MessageListBean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
offset | Int | 开始获取消息位置 |
limit | Int | 每页获取的消息数量 |
msgType | Int | 获取的消息类型 |
msgSrcId | String | 消息组的唯一标识符 |
encryptImage | Boolean | 是否加密图片 |
callback | IThingDataCallback<MessageListBean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getMessageListByMsgSrcId(0, 0, 0,"id", true, new IThingDataCallback<MessageListBean>() {
@Override
public void onSuccess(MessageListBean result) {
mBeanResult.t.postValue(change(msgType, result, null));
mBeanResult.networkState.postValue(NetworkState.SUCCESS);
}
@Override
public void onError(String errorCode, String errorMessage) {
mBeanResult.networkState.postValue(NetworkState.failed(errorCode, errorMessage));
}
})
fun getMsgListBySrcIdSplitEncryptImageKey(
offset: Int,
limit: Int,
msgType: Int,
msgSrcId: String?,
encryptImage: Boolean,
splitImageKey: Boolean,
callback: IThingDataCallback<MessageListBean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
offset | Int | 开始获取消息位置 |
limit | Int | 每页获取的消息数量 |
msgType | Int | 获取的消息类型 |
msgSrcId | String | 消息组的唯一标识符 |
encryptImage | Boolean | 是否加密图片 |
splitImageKey | Boolean | 是否需要调用解密接口 |
callback | IThingDataCallback<MessageListBean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getMsgListBySrcIdSplitEncryptImageKey(0, 0, 0, "id", true, true,
mMessageCore.requestMessageListByType(offset, limit, type, new IThingDataCallback<MessageListBean>() {
@Override
public void onSuccess(MessageListBean result) {
mBeanResult.t.postValue(change(msgType, result, null));
mBeanResult.networkState.postValue(NetworkState.SUCCESS);
}
@Override
public void onError(String errorCode, String errorMessage) {
mBeanResult.networkState.postValue(NetworkState.failed(errorCode, errorMessage));
}
});
)
fun requestMessageNew(callback: IThingDataCallback<MessageHasNew?>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
callback | IThingDataCallback<MessageListBean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().requestMessageNew(object : IThingDataCallback<MessageHasNew?> {
override fun onSuccess(messageHasNew: MessageHasNew?) {
if (messageHasNew != null) {
val hasNew = (messageHasNew.isAlarm || messageHasNew.isFamily || messageHasNew.isNotification)
ThingSecurityPreferenceGlobalUtil.set(
PreferencesContants.MESSAGE_ALARM_HAS_NEW,
messageHasNew.isAlarm
)
ThingSecurityPreferenceGlobalUtil.set(
PreferencesContants.MESSAGE_FAMILY_HAS_NEW,
messageHasNew.isFamily
)
ThingSecurityPreferenceGlobalUtil.set(
PreferencesContants.MESSAGE_NOTIFICATION_HAS_NEW,
messageHasNew.isNotification
)
resultSuccess(WHAT_REFRESH, hasNew)
}
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
fun readMessageByIds(
msgType: Int,
msgSrcId: String?,
callback: IThingDataCallback<Boolean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
msgType | Int | 获取的消息类型 |
msgSrcId | String | 消息组的唯一标识符 |
callback | IThingDataCallback<MessageListBean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().readMessageByIds(0, "msgSrcId", object : IThingDataCallback<Boolean> {
override fun onSuccess(result: Boolean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
fun deleteMessageByIds(
msgType: Int,
idList: List<String>?,
msgSrcIdList: List<String>?,
callback: IBooleanCallback?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
msgType | Int | 获取的消息类型 |
idList | List<String> |
要删除的消息 ID |
msgSrcIdList | List<String> |
要删除的消息来源 ID |
callback | IThingDataCallback<MessageListBean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().deleteMessageByIds(0, "id1,id2,id3", "srcId1,srcId2,srcId3", new IBooleanCallback() {
@Override
public void onSuccess() {
mDeleteBeanLiveData.networkState.postValue(NetworkState.SUCCESS);
mDeleteBeanLiveData.t.postValue(true);
}
@Override
public void onError(String code, String error) {
mDeleteBeanLiveData.networkState.postValue(NetworkState.failed(code, error));
}
})
fun getLineUUid(
uid: String?,
nativeUrl: String?,
appId: Int,
listener: Business.ResultListener<String>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | String | 用户的唯一标识符 |
nativeUrl | String | 指向资源或页面的本地 URL |
appId | Int | 应用程序的标识符 |
listener | Business.ResultListener<String> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getLineUUid(14343, "http://example.com/resource", 123, object : Business.ResultListener<String> {
override fun onSuccess(p0: BusinessResponse?, p1: String?, p2: String?) {
resultSuccess(WHAT_GET_UUID_SUCCESS, p1)
}
override fun onFailure(p0: BusinessResponse?, p1: String?, p2: String?) {
resultError(WHAT_GET_UUID_FAILURE, p0?.getErrorCode(), p0?.getErrorMsg())
}
})
fun getFamilyByDevice(devId: String?, listener: Business.ResultListener<FamilyGroupBean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
devId | String | 设备 ID |
listener | Business.ResultListener<FamilyGroupBean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getFamilyByDevice("somedevId", object : Business.ResultListener<FamilyGroupBean> {
override fun onSuccess(result: FamilyGroupBean) {
// 处理成功结果
println("Success: ${result}")
}
override fun onFailure(error: Throwable) {
// 处理失败结果
println("Error: ${error.message}")
}
})
fun getFamilyByScene(sceneId: String?, listener: Business.ResultListener<FamilyGroupBean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
sceneId | String | 场景 ID |
listener | Business.ResultListener<FamilyGroupBean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getFamilyByScene("sceneId", new Business.ResultListener<FamilyGroupBean>() {
@Override
public void onFailure(BusinessResponse businessResponse, FamilyGroupBean groupBean, String s) {
}
@Override
public void onSuccess(BusinessResponse businessResponse, final FamilyGroupBean groupBean, String s) {
}
})
fun readMessageList(
msgType: Int,
msgSrcIds: String?,
listener: Business.ResultListener<Boolean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
msgType | Int | 消息的类型 |
msgSrcIds | String | 消息来源的标识符 |
listener | Business.ResultListener<Boolean> |
指定从哪个消息源读取消息 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().readMessageList(1, "source1,source2,source3", new Business.ResultListener<Boolean>() {
@Override
public void onFailure(BusinessResponse businessResponse, Boolean aBoolean, String s) {
result.networkState.postValue(NetworkState.failed(businessResponse.getErrorCode(), businessResponse.getErrorMsg()));
}
@Override
public void onSuccess(BusinessResponse businessResponse, Boolean aBoolean, String s) {
result.networkState.postValue(NetworkState.SUCCESS);
result.t.postValue(aBoolean);
}
})
fun readAllMessage(msgType: Int, listener: Business.ResultListener<Boolean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
msgType | Int | 消息的类型 |
listener | Business.ResultListener<Boolean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().readAllMessage(msgType, new Business.ResultListener<Boolean>() {
@Override
public void onFailure(BusinessResponse businessResponse, Boolean aBoolean, String s) {
result.networkState.postValue(NetworkState.failed(businessResponse.getErrorCode(), businessResponse.getErrorMsg()));
}
@Override
public void onSuccess(BusinessResponse businessResponse, Boolean aBoolean, String s) {
result.networkState.postValue(NetworkState.SUCCESS);
result.t.postValue(aBoolean);
}
})
fun getSupportPushDeviceList(
homeId: Long,
listener: Business.ResultListener<List<LinePushDeviceBean>>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
homeId | Long | 家庭 ID |
listener | Business.ResultListener<List<LinePushDeviceBean>> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getSupportPushDeviceList(
12345,
object : Business.ResultListener<List<LinePushDeviceBean>> {
override fun onSuccess(
p0: BusinessResponse?,
p1: List<LinePushDeviceBean>?,
p2: String?
) {
resultSuccess(WHAT_HOME_DEVICE_LIST_SUCCESS, p1)
}
override fun onFailure(
p0: BusinessResponse?,
p1: List<LinePushDeviceBean>?,
p2: String?
) {
resultError(WHAT_HOME_DEVICE_LIST_FAILURE, p0?.errorCode, p0?.errorMsg)
}
})
fun savePushDeviceList(devIds: List<String>, listener: Business.ResultListener<Boolean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
devIds | List<String> |
设备 ID 列表 |
listener | Business.ResultListener<Boolean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().savePushDeviceList({"device1", "device2", "device3"}, object : Business.ResultListener<Boolean> {
override fun onSuccess(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultSuccess(WHAT_MESSAGE_SAVE_DEVICE_IDS_SUCCESS, null)
}
override fun onFailure(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultError(WHAT_MESSAGE_SAVE_DEVICE_IDS_FAILED, p0?.errorCode, p0?.errorMsg)
}
})
fun getCheckedPushDeviceList(listener: Business.ResultListener<List<LinePushDeviceBean>>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
listener | Business.ResultListener<List<LinePushDeviceBean>> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getCheckedPushDeviceList(object :
Business.ResultListener<ArrayList<LinePushDeviceBean>> {
override fun onFailure(
bizResponse: BusinessResponse?,
bizResult: ArrayList<LinePushDeviceBean>?,
apiName: String?
) {
listener?.onFailure(bizResponse, bizResult, apiName)
}
override fun onSuccess(
bizResponse: BusinessResponse?,
bizResult: ArrayList<LinePushDeviceBean>?,
apiName: String?
) {
listener?.onSuccess(bizResponse, bizResult, apiName)
}
})
fun saveFinalPushDeviceList(devIds: List<String>, listener: Business.ResultListener<Boolean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
devIds | List<String> |
设备 ID 列表 |
listener | Business.ResultListener<Boolean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().saveFinalPushDeviceList(["device1", "device2", "device3"], object : Business.ResultListener<Boolean> {
override fun onSuccess(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultSuccess(WHAT_MESSAGE_SAVE_CHECKED_DEVICE_SUCCESS, null)
}
override fun onFailure(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultError(
WHAT_MESSAGE_SAVE_CHECKED_DEVICE_FAILED,
p0?.getErrorCode(),
p0?.getErrorMsg()
)
}
})
fun getPushSwitchStatusByType(type: Int, listener: Business.ResultListener<Boolean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
msgType | Int | 推送通知种类 |
listener | Business.ResultListener<Boolean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getPushSwitchStatusByType(
MessageContants.LINE_PUSH_TYPE,
object : Business.ResultListener<Boolean> {
override fun onSuccess(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultSuccess(WHAT_GET_SWITCH_STATUS_SUCCESS, p1)
}
override fun onFailure(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultError(
WHAT_GET_SWITCH_STATUS_FAILURE,
p0?.getErrorCode(),
p0?.getErrorMsg()
)
}
})
fun setPushSwitchStatusByType(
type: Int,
isClose: Boolean,
listener: Business.ResultListener<Boolean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
type | Int | 消息的类型 |
isClose | Boolean | 开启状态 |
listener | Business.ResultListener<Boolean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().setPushSwitchStatusByType(
MessageContants.LINE_PUSH_TYPE,
true,
object : Business.ResultListener<Boolean> {
override fun onSuccess(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultSuccess(WHAT_SET_SWITCH_STATUS_SUCCESS, p1)
}
override fun onFailure(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
resultError(
WHAT_SET_SWITCH_STATUS_FAILURE,
p0?.getErrorCode(),
p0?.getErrorMsg()
)
}
})
fun getMessageEncryptImageKeyList(
requestList: List<MessageEncryptImageKeyRequest>,
callback: IThingDataCallback<List<MessageEncryptImageKeyBean>>
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
requestList | List<MessageEncryptImageKeyRequest> |
消息加密图像密钥的请求列表 |
callback | IThingDataCallback<List<MessageEncryptImageKeyBean>> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageCore().getMessageEncryptImageKeyList(requestList,
new IThingDataCallback<List<MessageEncryptImageKeyBean>>() {
@Override
public void onSuccess(List<MessageEncryptImageKeyBean> keyBeans) {
mBeanResult.t.postValue(change(0, result, keyBeans));
mBeanResult.networkState.postValue(NetworkState.SUCCESS);
}
@Override
public void onError(String errorCode, String errorMessage) {
mBeanResult.t.postValue(change(0, result, null));
mBeanResult.networkState.postValue(NetworkState.SUCCESS);
}
})
fun nodisturbSetting(open: Boolean, callback: IThingDataCallback<Boolean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
open | Boolean | 开关状态 |
callback | IThingDataCallback<Boolean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().nodisturbSetting(true, new IThingDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbSetting onSuccess:" + result);
}
if (result) {
resultSuccess(WHAT_SET_NODISTURB_STATUS_OK, open);
}
}
@Override
public void onError(String errorCode, String errorMessage) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbSetting onFailure");
}
}
})
fun getNoDisturbStatus(callback: IThingDataCallback<Boolean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
callback | IThingDataCallback<Boolean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().getNoDisturbStatus(new IThingDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbSetting onSuccess:" + result);
}
resultSuccess(WHAT_GET_NODISTURB_STATUS_OK, result);
}
@Override
public void onError(String errorCode, String errorMessage) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbStatus onFailure");
}
}
})
fun getNodisturbList(callback: IThingDataCallback<ArrayList<DeviceAlarmNotDisturbVO>?>)
参数说明
参数 | 类型 | 说明 |
---|---|---|
callback | IThingDataCallback<ArrayList<DeviceAlarmNotDisturbVO>> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().getNodisturbList(new IThingDataCallback<ArrayList<com.thingclips.smart.sdk.bean.message.DeviceAlarmNotDisturbVO>>() {
@Override
public void onSuccess(ArrayList<com.thingclips.smart.sdk.bean.message.DeviceAlarmNotDisturbVO> result) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "refreshList onSuccess:");
}
resultSuccess(WHAT_GET_NODISTURB_LIST_OK, result);
}
@Override
public void onError(String errorCode, String errorMessage) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "refreshList onFailure");
}
}
})
fun getHomeDeviceListByIds(
homeId: Long,
listener: Business.ResultListener<List<LinePushDeviceBean>>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
homeId | long | 家庭 ID |
listener | Business.ResultListener<List<LinePushDeviceBean>> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().getHomeDeviceListByIds(
123456L,
object : Business.ResultListener<ArrayList<LinePushDeviceBean>> {
override fun onFailure(
bizResponse: BusinessResponse?,
bizResult: ArrayList<LinePushDeviceBean>?,
apiName: String?
) {
listener?.onFailure(bizResponse, bizResult, apiName)
}
override fun onSuccess(
bizResponse: BusinessResponse?,
bizResult: ArrayList<LinePushDeviceBean>?,
apiName: String?
) {
listener?.onSuccess(bizResponse, bizResult, apiName)
}
})
fun noDisturbAddAlarm(
startTime: String?,
endTime: String?,
devIds: String?,
loops: String?,
callback: IThingDataCallback<Long>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
startTime | String | 免打扰开始时间 |
endTime | String | 免打扰结束时间 |
devIds | String | 设备 ID |
loops | String | 重复周期 |
callback | IThingDataCallback<Long> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().noDisturbAddAlarm("23:00", "07:00", "device1,device2", "daily", new IThingDataCallback<Long>() {
@Override
public void onSuccess(Long result) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbAddAlarm onSuccess");
}
resultSuccess(WHAT_ADD_NODISTURB_ALARM_OK, result);
}
@Override
public void onError(String errorCode, String errorMessage) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbAddAlarm onFailure");
}
resultError(WHAT_ADD_NODISTURB_ALARM_FAIL, errorCode, errorMessage);
}
})
fun editNodisturbAlarm(
nodisturbAlarmId: Long,
mStartTime: String?,
mEndTime: String?,
devIds: String?,
loops: String?,
callback: IThingDataCallback<Boolean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
nodisturbAlarmId | Long | 免打扰 ID |
mStartTime | String | 免打扰开始时间 |
mEndTime | String | 免打扰结束时间 |
devIds | String | 设备 ID |
loops | String | 重复周期 |
callback | IThingDataCallback<Boolean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().editNodisturbAlarm(123456L, "23:00", "07:00", "device1,device2", "daily", new IThingDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "editNodisturbAlarm onSuccess:");
}
resultSuccess(WHAT_UPDATE_NODISTURB_OK, result);
}
@Override
public void onError(String errorCode, String errorMessage) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "editNodisturbAlarm onFailure:");
}
resultError(WHAT_UPDATE_NODISTURB_FAIL, errorCode, errorMessage);
}
})
fun removeNodisturb(id: Long, callback: IThingDataCallback<Boolean>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
id | long | ID |
callback | IThingDataCallback<Boolean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().removeNodisturb(123456L, new IThingDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "removeNodisturbList onSuccess:");
}
resultSuccess(WHAT_REMOVE_NODISTURB_OK, result);
}
@Override
public void onError(String errorCode, String errorMessage) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "removeNodisturbList onFailure:");
}
}
})
fun getPrivacyAuthorizationSwitch(
type: AuthorizationType,
listener: Business.ResultListener<ArrayList<UserExtraPropertyBean>>
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
type | AuthorizationType | 授权类型 |
listener | Business.ResultListener<ArrayList<UserExtraPropertyBean>> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().getPrivacyAuthorizationSwitch(
MARKETING_PUSH,
object : Business.ResultListener<ArrayList<UserExtraPropertyBean>> {
override fun onFailure(
bizResponse: BusinessResponse?,
bizResult: ArrayList<UserExtraPropertyBean>?,
apiName: String?
) {
}
override fun onSuccess(
bizResponse: BusinessResponse?,
bizResult: ArrayList<UserExtraPropertyBean>?,
apiName: String?
) {
}
})
fun setPrivacyAuthorizationSwitch(
params: String?, listener: Business.ResultListener<Boolean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
params | String | 授权开关信息 |
listener | Business.ResultListener<Boolean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().setPrivacyAuthorizationSwitch("授权信息", object : Business.ResultListener<Boolean> {
override fun onSuccess(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
}
override fun onFailure(p0: BusinessResponse?, p1: Boolean?, p2: String?) {
}
})
fun getNoDisturbDeviceList(callback: IThingDataCallback<ArrayList<NodisturbDevicesBean>>?)
参数说明
参数 | 类型 | 说明 |
---|---|---|
callback | IThingDataCallback<ArrayList<NodisturbDevicesBean>> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessageSettingCore().getNoDisturbDeviceList(new IThingDataCallback<ArrayList<com.thingclips.smart.sdk.bean.message.NodisturbDevicesBean>>() {
@Override
public void onSuccess(ArrayList<com.thingclips.smart.sdk.bean.message.NodisturbDevicesBean> result) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbDeviceList onSuccess");
}
resultSuccess(WHAT_GET_NODISTURB_DEVICES_OK, result);
}
@Override
public void onError(String errorCode, String errorMessage) {
if (TOAST_DEBUG) {
ToastUtil.shortToast(context, "noDisturbDeviceList onFailure");
}
}
})
fun getNonRepeatRemindMinute(
pushType: PushType,
callback: IThingDataCallback<AlarmRemindBean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
pushType | PushType | 告警类型 |
callback | IThingDataCallback<AlarmRemindBean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessagePushCore().getNonRepeatRemindMinute(PUSH_ALARM, object : IThingDataCallback<AlarmRemindBean> {
override fun onSuccess(result: AlarmRemindBean?) {
continuation.resume(result)
}
override fun onError(errorCode: String?, errorMessage: String?) {
continuation.resumeWithException(
ErrorException(
errorCode,
errorMessage
)
)
}
})
fun setSwitchStateByServer(
pushType: PushType,
check: Boolean,
callback: IThingDataCallback<Boolean>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
pushType | PushType | 告警类型 |
check | Boolean | 开关设置 |
callback | IThingDataCallback<Boolean> |
查询结果的回调 |
调用示例
PersonalMessageCore.newThingSmartMessagePushCore().setSwitchStateByServer(pushType, check, object : IThingDataCallback<Boolean?> {
override fun onSuccess(result: Boolean?) {
continuation.resume(result)
}
override fun onError(errorCode: String?, errorMessage: String?) {
continuation.resumeWithException(
ErrorException(
errorCode,
errorMessage
)
)
}
})
fun getWarnDeviceConfig(
gid: String,
serverType: String,
deviceId: String,
listener: Business.ResultListener<ArrayList<WarnDeviceConfig>>?
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
gid | String | 设备配置组标识 |
serverType | String | 服务类型 |
deviceId | String | 设备 ID |
listener | Business.ResultListener<ArrayList<WarnDeviceConfig>> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessagePushCore().getWarnDeviceConfig("group123", "production_server", "device001",
object : Business.ResultListener<ArrayList<WarnDeviceConfig>> {
override fun onFailure(
bizResponse: BusinessResponse?,
bizResult: ArrayList<WarnDeviceConfig>?,
apiName: String?
) {
continuation.resumeWithException(
ErrorException(
bizResponse?.errorCode,
bizResponse?.errorMsg
)
)
}
override fun onSuccess(
bizResponse: BusinessResponse?,
bizResult: ArrayList<WarnDeviceConfig>?,
apiName: String?
) {
continuation.resume(bizResult)
}
})
fun updateWarnDeviceConfig(
noticeRuleList: WarnNoticeExpr,
listener: Business.ResultListener<Boolean>
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
noticeRuleList | WarnNoticeExpr | 警告通知规则的列表 |
listener | Business.ResultListener<Boolean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessagePushCore().updateWarnDeviceConfig(warnNoticeExpr,
object : Business.ResultListener<Boolean> {
override fun onFailure(
bizResponse: BusinessResponse?,
bizResult: Boolean?,
apiName: String?
) {
continuation.resumeWithException(
ErrorException(
bizResponse?.errorCode,
bizResponse?.errorMsg
)
)
}
override fun onSuccess(
bizResponse: BusinessResponse?,
bizResult: Boolean?,
apiName: String?
) {
continuation.resume(bizResult)
}
})
fun getAlarmPhoneTimesCount(
listener: Business.ResultListener<AlarmTimesCount>
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
listener | Business.ResultListener<AlarmTimesCount> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessagePushCore().getAlarmPhoneTimesCount(new Business.ResultListener<AlarmTimesCount>() {
@Override
public void onSuccess(BusinessResponse bizResponse, AlarmTimesCount bizResult, String apiName) {
ServerStatus packageStatus = ServerStatus.Companion.getValue(bizResult.getPackageStatus());
// 如果当前未购买、已过期、未知时,需要设置已关闭,直接忽略云端返回的开关结果
if (packageStatus == ServerStatus.NOT_PURCHASED || packageStatus == ServerStatus.EXPIRED || packageStatus == ServerStatus.USED_UP) {
setChecked(pushType, false);
} else {
setChecked(pushType, result);
}
resultSuccess(WHAT_REFRESH, null);
}
@Override
public void onFailure(BusinessResponse bizResponse, AlarmTimesCount bizResult, String apiName) {
}
})
fun getAlarmSMSTimesCount(
notificationType: String,
listener: Business.ResultListener<AlarmTimesCount>
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
notificationType | String | 通知类型 |
listener | Business.ResultListener<AlarmTimesCount> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessagePushCore().getAlarmSMSTimesCount(ServerType.SMS.getValue(), new Business.ResultListener<AlarmTimesCount>() {
@Override
public void onSuccess(BusinessResponse bizResponse, AlarmTimesCount bizResult, String apiName) {
ServerStatus packageStatus = ServerStatus.Companion.getValue(bizResult.getPackageStatus());
if (packageStatus == ServerStatus.NOT_PURCHASED || packageStatus == ServerStatus.EXPIRED || packageStatus == ServerStatus.USED_UP) {
setChecked(pushType, false);
} else {
setChecked(pushType, result);
}
resultSuccess(WHAT_REFRESH, null);
}
@Override
public void onFailure(BusinessResponse bizResponse, AlarmTimesCount bizResult, String apiName) {
}
})
fun getWarnDeviceList(
gid: String,
serverType: String,
pageNo: Int,
pageSize: Int,
listener: Business.ResultListener<WarnDeviceBean>
)
参数说明
参数 | 类型 | 说明 |
---|---|---|
gid | String | 设备所属的组别 |
serverType | String | 服务类型 |
pageNo | Int | 页码 |
pageSize | Int | 每页的记录数 |
listener | Business.ResultListener<WarnDeviceBean> |
处理函数的返回结果 |
调用示例
PersonalMessageCore.newThingSmartMessagePushCore().getWarnDeviceList("group123", "phone_notify_server", 1, 10,
object : Business.ResultListener<WarnDeviceBean> {
override fun onFailure(
bizResponse: BusinessResponse?,
bizResult: WarnDeviceBean?,
apiName: String?
) {
continuation.resumeWithException(
ErrorException(
bizResponse?.errorCode,
bizResponse?.errorMsg
)
)
}
override fun onSuccess(
bizResponse: BusinessResponse?,
bizResult: WarnDeviceBean?,
apiName: String?
) {
continuation.resume(bizResult)
}
})
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈