|
T-Box Basic dev
|
T-Box D-Bus 客户端接口 More...
#include <dbus/dbus.h>#include <pthread.h>#include <stdbool.h>#include <stdint.h>#include <tbox/error.h>#include <tbox/log.h>Go to the source code of this file.
Data Structures | |
| struct | tbox_dbus_param_t |
| D-Bus 消息参数 More... | |
| struct | tbox_dbus_handle_map_t |
| 消息处理映射表项 More... | |
| struct | tbox_dbus_send_info_t |
| 发送消息描述 More... | |
| struct | tbox_dbus_recv_info_t |
| 接收消息描述 More... | |
Macros | |
| #define | TBOX_DBUS_METHOD_RETURN_TIMEOUT_SEC 2U |
| 方法返回超时时间,单位:秒 | |
| #define | DBUS_CHECK_OR_RESULT_WITH_ERROR(tag, expr, result, message, error) |
| 条件为假时记录错误日志并设置结果后返回。 | |
| #define | DBUS_CHECK_RET_OR_RESULT_WITH_MESSAGE(tag, ret, result, message) |
| 检查返回值是否为 TBOX_OK 并设置结果后返回。 | |
| #define | DBUS_CHECK_TYPE_OR_RESULT_WITH_MESSAGE(tag, etype, param, result, message) |
| 检查类型是否匹配并设置结果后返回。 | |
| #define | DBUS_CHECK_TYPE_OR_RETURN_WITH_ERROR(tag, etype, param, message, error) |
| 检查类型是否匹配并返回错误码。 | |
Typedefs | |
| typedef void(* | tbox_dbus_handler_t) (tbox_dbus_param_t *msg_param, tbox_dbus_param_t *return_param) |
| 接收消息处理回调 | |
Enumerations | |
| enum | tbox_dbus_type_t { TBOX_DBUS_TYPE_STRING = DBUS_TYPE_STRING , TBOX_DBUS_TYPE_UINT32 = DBUS_TYPE_UINT32 , TBOX_DBUS_TYPE_INT32 = DBUS_TYPE_INT32 , TBOX_DBUS_TYPE_UINT16 = DBUS_TYPE_UINT16 , TBOX_DBUS_TYPE_INT16 = DBUS_TYPE_INT16 , TBOX_DBUS_TYPE_UINT8 = DBUS_TYPE_BYTE , TBOX_DBUS_TYPE_BOOL = DBUS_TYPE_BOOLEAN , TBOX_DBUS_TYPE_ARRAY = DBUS_TYPE_ARRAY , TBOX_DBUS_TYPE_INVALID = DBUS_TYPE_INVALID } |
| D-Bus 参数类型 More... | |
Functions | |
| int | tbox_dbus_connect (const char *app_name) |
| 连接 D-Bus 服务 | |
| void | tbox_dbus_disconnect (void) |
| 断开 D-Bus 服务连接 | |
| const char * | tbox_dbus_get_connection_name (void) |
| 获取当前连接的唯一名称 | |
| int | tbox_dbus_set_message (DBusMessageIter *iter, const tbox_dbus_param_t *param) |
| 向消息迭代器写入一个参数 | |
| int | tbox_dbus_send_message_begin (const tbox_dbus_send_info_t *send_info, DBusMessage **msg, DBusMessageIter *iter) |
| 开始构造并发送 D-Bus 消息(首参数) | |
| int | tbox_dbus_send_message_end (bool is_signal, DBusMessage *msg, tbox_dbus_param_t *return_param, int32_t timeout) |
| 完成 D-Bus 消息发送并等待回复 | |
| int | tbox_dbus_get_message_begin (DBusMessageIter *iter, DBusMessage **msg, tbox_dbus_recv_info_t *recv_info, int32_t timeout) |
| 开始接收 D-Bus 消息(首参数) | |
| bool | tbox_dbus_check_next_message (DBusMessageIter *iter) |
| 检查消息迭代器是否还有下一个参数 | |
| int | tbox_dbus_get_message (DBusMessageIter *iter, tbox_dbus_param_t *param) |
| 从消息迭代器读取一个参数 | |
| int | tbox_dbus_get_message_end (DBusMessage *msg, tbox_dbus_param_t *return_param) |
| 完成 D-Bus 消息接收并发送方法返回 | |
| int | tbox_dbus_send_message (const tbox_dbus_send_info_t *send_info, tbox_dbus_param_t *return_param, int32_t timeout) |
| 发送 D-Bus 消息并等待回复 | |
| int | tbox_dbus_set_receive_match (const char *filter) |
| 添加接收消息匹配规则 | |
| int | tbox_dbus_delete_receive_match (const char *filter) |
| 删除接收消息匹配规则 | |
| void | tbox_dbus_free_param (tbox_dbus_param_t *param) |
| 释放参数中动态分配的内存 | |
| void | tbox_dbus_free_message (DBusMessage *msg) |
| 释放 D-Bus 消息对象 | |
| bool | tbox_dbus_check_message_match (DBusMessage *msg, bool is_signal, const char *module, const char *action) |
| 检查消息是否匹配指定模块和动作 | |
| int | tbox_dbus_send_signal (const char *module, const char *action, tbox_dbus_param_t *param) |
| 发送 D-Bus 信号 | |
| int | tbox_dbus_call_set (const char *dest, const char *module, const char *action, tbox_dbus_param_t *param, uint32_t timeout) |
| 通过 D-Bus 方法调用执行 set 操作 | |
| int | tbox_dbus_call_get (const char *dest, const char *module, const char *action, tbox_dbus_param_t *return_param, uint32_t timeout) |
| 通过 D-Bus 方法调用执行 get 操作 | |
| void | tbox_dbus_send_no_reply (const char *dest, const char *module, const char *action, tbox_dbus_param_t *param) |
| 发送无需回复的 D-Bus 方法调用 | |
| int | tbox_dbus_recv_no_reply (const char *need_module, int32_t timeout, bool need_signal, tbox_dbus_param_t *msg_param, char *recv_action, uint32_t recv_action_len) |
| 接收无需回复的 D-Bus 消息 | |
| void | tbox_dbus_handle_message (const tbox_dbus_handle_map_t *handle_map, const char *need_module, int32_t timeout) |
| 根据映射表分发并处理接收到的 D-Bus 消息 | |
T-Box D-Bus 客户端接口