配合bluez编程 [英] Bluez Programming

查看:192
本文介绍了配合bluez编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在节目上的BlueZ我树莓派与USB蓝牙适配器。
我需要能够以编程方式连接到一个Arduino BT,问题是,Arduino的的蓝牙模块仍然采用传统的配对所以每当我试图打开一个套接字我收到了拒绝权限的设备
我如何沿着PIN发送到完成经过了的BlueZ配对请求?

I'm programming in BlueZ on my Raspberry Pi with an USB Bluetooth dongle. I need to be able to programmatically connect to an Arduino BT, the problem is that the Bluetooth module of the Arduino is still using legacy pairing so whenever I try to open a socket to the device I get a Permission Denied. How do I send along a PIN to complete the pairing request through BlueZ?

推荐答案

您可能要检查出的main.c 文件中的最新的配合bluez源$ C ​​$ C的客户文件夹中。这是源$ C ​​$ C为bluetoothctl工具。运行它。该人士$ ​​C $ C正好说明了他们如何使用GDBus,包括股东代理人,代理,调用方法,例如在API(描述的 / doc文件夹)和所有。这是在C和使用高层次的API。

You might want to check out the main.c file in the client folder of the most recent Bluez source code. It's the source code for the bluetoothctl tool. Run it too. The source code shows exactly how they use GDBus, including proxies, agents, calling methods like described in the API (/doc folder) and all that. It's in C and uses the high level API.

我建议你通过code步骤,因为我花了2周不休试图理解配合bluez C和,有没有文件,事实,但是当我读到main.c文件我是在一天做好准备。阅读上适当乌思API文档,更重要的概念。一些文档,帮助我:

I suggest you step through the code because it took me 2 weeks endlessly trying to understand Bluez in C and the fact that there's no documentation, but when I read that main.c file I was ready in a day. Read up on proper Dbus API documentation and more importantly the concepts. Some documents that helped me:

该gdbus工具:
https://developer.gnome.org/gio/stable/gdbus.html

这包含所有调用gdbus,并在的main.c 文件对象,并解释他们很好。
https://developer.gnome.org/gio/stable/gdbus-convenience.html

These contain all the calls to gdbus and objects in the main.c file and explain them very well. https://developer.gnome.org/gio/stable/gdbus-convenience.html

D-脚​​,一个宝贵的工具来检查你的系统学习乌思。尝试检查出来的/ bluez的总线。
https://wiki.gnome.org/action/show ?/应用/ DFeet行动=显示和放大器;重定向= DFeet

D-Feet, an invaluable tool to inspecting and learning about Dbus on your system. Try checking out the /bluez bus. https://wiki.gnome.org/action/show/Apps/DFeet?action=show&redirect=DFeet

命令和apt-get安装D-脚

没有太大的教程,但值得一读,了解一些概念,作为bluetoothctl工具安装到他们想在这里说些什么。
http://dbus.freedesktop.org/doc/dbus-tutorial.html

Not much of a tutorial, but worth a read to understand some concepts, as the bluetoothctl tool fits into what they're trying to say here. http://dbus.freedesktop.org/doc/dbus-tutorial.html

该bluetoothctl创建一个交互式shell的,所以它可能不是明智的浪费时间去适应你的code,但随便挑你从它需要的东西。

The bluetoothctl creates an interactive shell though, so it might not be wise to waste time trying to fit in your code, but just pick what you need from it.

这篇关于配合bluez编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆