# dbus-bluez-T **Repository Path**: tangzhangss/dbus-bluez-t ## Basic Information - **Project Name**: dbus-bluez-T - **Description**: 蓝牙bluez研究。基于Java实现 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-29 - **Last Updated**: 2025-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### v1直接使用linux命令实现 用于服务器进程间通信 ### v2使用dbus-java实现原理和v1差不多 普通蓝牙设备通信 ### v3使用dbus-java+GATT规范实现主要用于移动设备 #### 前置条件 BlueZ 5.50+ (bluetoothctl --version) 如果不满足参考下面“bluez安装”部分进行安装 #### 配置 需要将/config/com.cy.dbus.conf 放在目录下 > /etc/dbus-1/system.d/ chmod 644 /etc/dbus-1/system.d/com.cy.dbus.conf chmod 777 -R /var/lib/dbus //一版不需要重启如果配置不生效尝试重启 systemctl daemon-reload systemctl restart dbus.socket #### 调试 1.注册失败用命令模拟注册测试 / 也可使用bluetoothctl命令交互注册测试 sudo -u root dbus-send --system --print-reply \ --dest=org.freedesktop.DBus /org/freedesktop/DBus \ org.freedesktop.DBus.RequestName \ string:"com.cy.dbus" uint32:12 2.bluez安装 # 如果本身存在先卸载之前的 sudo apt purge bluez bluez-tools sudo apt autoremove # 安装新的 sudo apt install libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev autoconf automake libtool 如果报错依赖不匹配先执行下面这个 sudo apt install libudev1=245.4-4ubuntu3.24 libudev-dev=245.4-4ubuntu3.24 wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.64.tar.xz tar xf bluez-5.64.tar.xz cd bluez-5.64/ # 配置编译选项 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-library --libexecdir=/usr/lib # 编译并安装 make -j$(nproc) sudo make install systemctl daemon-reload systemctl restart bluetooth bluetoothd -v #(根据实际情况而定-是否创建软连接) sudo ln -s /usr/lib/bluetooth/bluetoothd /usr/sbin/bluetoothd