简体   繁体   English

收听iOS Swift蓝牙外设按钮事件

[英]Listen for Bluetooth peripheral button events iOS Swift

Maybe I'm not phrasing it correctly in the search engines to find what I'm looking for. 也许我没有在搜索引擎中正确地描述它以找到我正在寻找的东西。 But what I need is the Core Bluetooth (Swift 3) code that will allow my app the listen for a button press on a connected peripheral. 但我需要的是Core Bluetooth(Swift 3)代码,它允许我的应用程序在连接的外围设备上按下按钮。 And then the code that handles that event. 然后是处理该事件的代码。

You may want to take a look to this question: 您可能想看看这个问题:

SWIFT - BLE communications SWIFT - BLE通讯

There the answer shows most of the Swift 3 code that you may need to make BLE to work. 答案显示了您可能需要使用BLE工作的大部分Swift 3代码。 But keep in mind that you need to provide the UUIDs, etc., and you will need knowledge of what kind of data your peripheral is giving to you. 但请记住,您需要提供UUID等,并且您需要了解外围设备向您提供的数据类型。 Also, you need to know the characteristic's UUID that you want listen for. 此外,您需要知道要监听的特征的UUID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM