设备消息免打扰管理

更新时间:2024-12-26 06:24:16下载pdf

本文介绍设备消息免打扰相关配置。

消息免打扰开关

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?) {
    }
})