蓝牙LE通过应用程序在Android设备之间发送字符串数据 [英] Bluetooth LE send string data between Android devices via application

查看:79
本文介绍了蓝牙LE通过应用程序在Android设备之间发送字符串数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对如何使用BLE一无所知.我需要为Android设备创建一个应用程序,该应用程序将一个小的字符串从一个Android设备发送到另一设备.我没有使用任何传感器类型的设备.我只需要使用BLE连接将字符串从一部电话发送到另一部电话.据我了解,我需要创建一个自定义服务并在中央设备上实现GATT服务器,并让外围设备作为客户端对其进行访问,但是我什至不确定我是否正是这种情况.我搜寻了互联网,但没有发现任何与该主题有关的东西.我不知道如何为此目的创建GATT服务器以及创建服务需要包括的内容.有人可以向我解释我该怎么做,或者向我指出一些对完整小说"有用的资源吗?谢谢.

I'm completely clueless on how to use BLE. I need to create an application for Android devices that sends a small string from one Android device to the other. I am NOT using any sensor type devices. I only need to send a string from one phone to another phone using a BLE connection. From what I understand, I need to create a custom service and implement a GATT server on a central device and have a peripheral device access it as a client but I'm not even sure if that's what I need for my situation. I have scoured the internet and nothing I have found deals with this topic specifically. I have no idea how to create a GATT server for this purpose and what I need to include in order to create a service. Can someone please explain to me what I need to do or point me towards some resources that are useful for A COMPLETE NOVICE? Thanks.

推荐答案

到目前为止,您是对的.您需要在两个不同的Android设备上创建两个应用程序,如下所示:-

You are right so far. You need to create two applications on two different Android devices as follows:-

  • 设备#1上的Android应用A:充当 GATT服务器的应用,用于托管您要发送的数据.为此,您将需要 GATT服务器API .
  • 设备#2上的Android App B:充当 GATT客户端的应用程序,用于连接到设备#1并使用
  • Android App A on Device #1: An app to act as a GATT Server to host your data that you want to send. For that, you will need GATT Server API.
  • Android App B on Device #2: An app to act as a GATT Client to connect to Device #1 and read the string data from the GATT Server using GATT Client API.

BLE是一种相对复杂的技术,但幸运的是,有太多资源可以帮助您入门.我建议您首先了解BLE技术的工作原理,为此,以下链接非常有用:-

BLE is a relatively complex technology but luckily there are so many resources to help you get started. I recommend that you first understand how BLE technology works and for that I the following links are useful:-

一旦您对该协议有了更好的了解,以下链接对于理解Android BLE开发很有用(除了注释中发布的视频之外):-

Once you have a better understanding of the protocol, the following links are useful for understanding Android BLE development (in addition to the video posted in the comment):-

但是,在进行任何上述操作之前,最好先对技术的运行方式有一个感觉和实际的了解.为此,我建议使用 nRF Connect Android 应用程序以连接和读取设备上的数据.这样,您将能够与新信息相关联,并希望更轻松地理解新概念.

However, before going through any of these, it's always a good idea to get a feel and practical understanding of how the technology works. For that I recommend using the nRF Connect Android app to connect and read data off devices. This way, you'll be able to relate to the new information and hopefully understand the new concepts easier.

这篇关于蓝牙LE通过应用程序在Android设备之间发送字符串数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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