本文介绍了颤振蓝牙基本问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行一个涉及颤振和蓝牙的新项目.为此,我阅读了一下并尝试了一个测试项目,但是仍然有一些问题,我找不到简单的答案.

I'm undertaking a new project involving flutter and bluetooth. For this I read a bit about it and tried a test project, but I still have questions I find no easy answer for.

首先,BLE与蓝牙.BLE就是蓝牙版本4,主要用于物联网应用.它可以在手机中运行,但是是否存在兼容性问题?AKA,BLE设备可以与蓝牙设备通信吗?还是它们都需要使用相同的蓝牙版本?

Firstly, BLE vs Bluetooth. BLE is nothing else than Bluetooth version 4, mostly used in IoT applications. It can run in mobile phones, but is there any compatibility issues? AKA, can a BLE device comunicate with a bluetooth device or do they both need to be using the same bluetooth version?

这个问题来自测试蓝色的示例,并且没有发现任何设备,而我的标准手机的蓝牙可以发现10多种设备(在魅族16号上进行了测试).我是否需要两个具有相同蓝牙应用程序的设备才能使它们彼此看到并交互?我了解到要发送信息,我将需要两个具有相同flutter应用程序的设备,但是现在我只想测试扫描设备的功能,返回0个设备会让我有些失望.

This question comes from testing a flutter blue example and not discovering any devices, while my standard phone's bluetooth discovers 10+ devices (tested on a Meizu 16th). Do I need two devices with the same flutter bluetooth app in order for them to see each other and interact? I understand that in order to send info around, I will need two devices with the same flutter app, but for now I just wanted to test de scan device funtionality and returning 0 devices has thrown me off a bit.

第二,我看到了一些蓝牙软件包,例如 flutter_blue flutter_bluetooth_serial (基于flutter_blue), flutter_reactive_ble 蓝牙.当您考虑我的项目时,您认为哪一个最适合?是基于制作问卷的方法->通过蓝牙发送->通过蓝牙取回已填写的问卷?

Secondly, I've seen some bluetooth packages around such as flutter_blue, flutter_bluetooth_serial (based on flutter_blue), flutter_reactive_ble and bluetooth. Which one do you think is best suited when taking into account my project is based on making a questionnaire -> sending it over bluetooth ->getting the filled questionnaires back via bluetooth?

简而言之,我对颤动的了解是相当基础的,并且对蓝牙的了解是绝对的0,所以我希望能对当前的蓝牙颤动技术有一个明智的了解,以便我有一个很强的出发点并避免常见错误.

In short, my knowledge in flutter is rather basic, and an absolute 0 in bluetooth, so I'd appreciate some wise council in the current state of art of bluetooth in flutter so that I have a strong starting point and avoid common mistakes.

@ukBaz在解释蓝牙背后的理论时补充了@ukBaz的答案,如果有人发现自己使用flutter_blue示例,则请紧记在您的设备中同时打开蓝牙和GPS,以使该示例正常工作.

to complement @ukBaz's answer where he explains the theory behind bluetooth, if anyone finds himself using the flutter_blue example, just keep in mind to turn on both bluetooth and GPS in your device, for the example to work.

有了ukBaz的解释和工作示例,我可以承担这个项目.

With ukBaz's explanations and a working example, I can undertake this project, thanks.

有关为何需要定位服务的说明此处.

EDIT 2: explanation as to why location services are needed here.

推荐答案

蓝牙是一组标准的二进制协议,用于设备之间的短距离无线通信.

Bluetooth is a standard set of binary protocols for short-range wireless communication between devices.

蓝牙经典"(BR/EDR)支持的速度最高约为24Mbps.一般来说,经典蓝牙主要用于音频,例如无线电话连接,无线耳机和无线扬声器.

Bluetooth "Classic" (BR/EDR) supports speeds up to about 24Mbps. Generally speaking, classic Bluetooth is mainly used for audio such as wireless telephone connections, wireless headphones and wireless speakers.

Bluetooth 4.0引入了一种低功耗模式,即"Bluetooth Low Energy"(BLE或LE,也称为"Bluetooth Smart"),其运行速度为1Mbps.此模式允许设备在大多数时间关闭发射机.结果是低能耗".低功耗蓝牙技术在可穿戴设备,智能物联网设备,健身监测设备和电池供电配件中更为常见.

Bluetooth 4.0 introduced a low energy mode, "Bluetooth Low Energy" (BLE or LE, also known as "Bluetooth Smart"), that operates at 1Mbps. This mode allows devices to leave their transmitters off most of the time. As a result it is "Low Energy". Bluetooth Low Energy is more often seen in wearable devices, smart IoT devices, fitness monitoring equipment, and battery-powered accessories.

BLE功能主要由创建通用属性配置文件(GATT)的键/值对组成.

BLE functionality is dominated by key/value pairs that create a Generic Attribute Profile (GATT).

BLE定义了设备可以扮演的多个角色:

BLE defines multiple roles that devices can play:

  • 广播器(信标)是仅用于发送器的应用程序.
  • 观察者(扫描仪)仅用于接收者应用程序.
  • 充当外围设备角色的设备可以接收连接.
  • 担当中央角色的设备可以连接到外围设备.

在应用程序级别,蓝牙是关于建立在蓝牙标准上的配置文件,以更清楚地定义蓝牙模块正在传输的数据类型.设备的应用程序确定其必须支持的配置文件.蓝牙SIG采用了许多允许互操作性的配置文件:

At the application level, Bluetooth is about Profiles built on the Bluetooth standard to more clearly define what kind of data a Bluetooth module is transmitting. The device’s application determines which profiles it must support.There are a number of profiles adopted by the Bluetooth SIG that allow for interoperability:

经典配置文件: https://www.bluetooth.com/specifications/profiles-overview/

BLE配置文件: https://www.bluetooth.com/specifications/gatt/

BLE允许自定义服务&要创建的特征.但是,尝试同时开发蓝牙链接的两端是一项挑战,特别是如果您不熟悉BLE.我建议您一次发展一个目标.有许多通用工具,例如 BLE外围设备模拟器(用于外围设备角色)和扫描和探索工具作为中心角色,以提供帮助.还有一些开发者委员会,例如 micro:bit puck-js ,对于学习通过电话连接到设备非常有用.

BLE allows for Custom Services & Characteristics to be created. However, trying to develop both ends of the Bluetooth link at the same time is challenging especially if you are new to BLE. I would suggest you develop one end at a time. There are number of generic tools, such as a BLE Peripheral Simulator for Peripheral role and scanning and exploration tools for the Central Role, to help. There are also some developer boards such as micro:bit and puck-js that can be useful for learning to connect to devices from a phone.

这篇关于颤振蓝牙基本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 07:32