Applications bluetooth low energy

Bluetooth Low Energy in Universal Windows Platform apps

This topic provides an overview of Bluetooth LE in Universal Windows Platform (UWP) apps (for more detail about Bluetooth LE, see the Bluetooth Core Specification version 4.0).

Bluetooth Low Energy (LE) is a specification that defines protocols for discovery and communication between power-efficient devices. Discovery of devices is done through the Generic Access Profile (GAP) protocol. After discovery, device-to-device communication is done through the Generic Attribute (GATT) protocol.

Bluetooth LE Roles

GATT and GAP roles were introduced in Windows 10 version 1703

GATT and GAP protocols can be implemented in your UWP app by using the following namespaces.

Central and Peripheral

The two primary roles of discovery are called Central and Peripheral. In general, Windows operates in Central mode and connects to various Peripheral devices.

Attributes

A cGeneric Attribute (GATT) Profile defines the structure of data and modes of operation by which two Bluetooth LE devices communicate. The attribute is the main building block of GATT. The main types of attributes are services, characteristics, and descriptors. These attributes perform differently between clients and servers, so it is more useful to discuss their interaction in the relevant sections.

Typical Attribute hierarchy in a common profile

The heart rate service is expressed in GATT Server API form

Client and Server

After a connection has been established, the device that contains the data (usually a small IoT sensor or wearable) is known as the Server. The device that uses that data to perform a function is known as the Client. For example, a Windows PC (Client) reads data from a heart rate monitor (Server) to track that a user is working out optimally. For more information, see the GATT Client and GATT Server topics.

Читайте также:  Блютуз на ноутбуке заикается

Watchers and Publishers (Beacons)

In addition to the Central and Peripheral roles, there are Observer and Broadcaster roles. Broadcasters are commonly referred to as Beacons, they don’t communicate over GATT because they use the limited space provided in the Advertisement packet for communication. Similarly, an Observer does not have to establish a connection to receive data, it scans for nearby advertisements. To configure Windows to observe nearby advertisements, use the BluetoothLEAdvertisementWatcher class. In order to broadcast beacon payloads, use the BluetoothLEAdvertisementPublisher class. For more information, see Bluetooth LE Advertisements.

See Also

Источник

Bluetooth Low Energy в универсальная платформа Windows приложениях

В этом разделе представлен обзор Bluetooth LE в приложениях универсальная платформа Windows (UWP) (дополнительные сведения о Bluetooth LE см. в спецификации Bluetooth Core Specification версии 4.0).

Bluetooth с низким энергопотреблением (LE) является спецификацией, определяющей протоколы для обнаружения и обмена данными между энергоэффективными устройствами. Обнаружение устройств выполняется с помощью протокола Generic Access Profile (GAP). После обнаружения обмен данными между устройствами выполняется с помощью протокола Generic Attribute (GATT).

Роли GATT и GAP bluetooth LE

появились в Windows 10 версии 1703

Протоколы GATT и GAP можно внедрить в приложение UWP с помощью указанных ниже пространств имен.

Центральное и периферийное устройство

Две основные роли обнаружения называются центральное устройство и периферийное устройство. Как правило, Windows работает в режиме центрального устройства и подключается к различным периферийным устройствам.

Атрибуты

Профиль cGeneric Attribute (GATT) определяет структуру данных и режимы работы, с помощью которых взаимодействуют два устройства Bluetooth LE. Атрибут является основным блоком построения GATT. К main типам атрибутов относятся службы, характеристики и дескрипторы. Эти атрибуты действуют по-разному между клиентами и серверами, поэтому полезнее обсудить их взаимодействие в соответствующих разделах.

Читайте также:  Bluetooth no such file or directory

Типичная иерархия атрибутов в общем профиле

Служба частоты сердечных сокращений выражается в форме API сервера GATT

Клиент и сервер

После установления подключения устройство, которое содержит данные (обычно небольшой датчик IoT или носимое устройство), называется сервером. Устройство, которое использует данные для выполнения функций, называется клиентом. Например, компьютер под управлением Windows (клиент) считывает данные с монитора частоты пульса (сервер) для отслеживания оптимальных тренировок пользователя. Дополнительные сведения см. в разделах Клиент GATT и Сервер GATT.

Наблюдатели и издатели (маяки)

Кроме ролей центрального и периферийного устройств, существуют роли наблюдателя и вещателя. Вещатели обычно называются маяками, они не взаимодействуют через GATT, поскольку используют ограниченное пространство, предоставленное в пакете объявления для передачи данных. Аналогично наблюдатель не должен устанавливать подключения для получения данных, он сканирует ближайшие рекламные объявления. Чтобы настроить Windows для отслеживания ближайших рекламных объявлений, используйте класс BluetoothLEAdvertisementWatcher. Чтобы транслировать полезные данные маяка, используйте класс BluetoothLEAdvertisementPublisher. Дополнительные сведения см. в разделе Объявления Bluetooth LE.

См. также:

Источник

Оцените статью
Adblock
detector