def result(operation_id, code, text):
"""Encode a result
This method encodes operation id, result code and result text into
a dictionary of dbus types.
@param operation_id Id of the operation for which the result is reported
@param code Result code of the operation (one of SWMResult)
@param text Text message
@return Result dictionary using dbus types.
"""
if not SWMResult.isValid(code):
code = SWMResult.SWM_GENERAL_ERROR
return {
'id': dbus.String(operation_id, variant_level=1),
'result_code': dbus.Int32(code, variant_level=1),
'result_text': dbus.String(text, variant_level=1)
}
评论列表
文章目录