xamarin.forms - Xamarin跨平台蓝牙连接的示例代码

标签 xamarin.forms xamarin.ios bluetooth-lowenergy core-bluetooth ios-bluetooth

我尝试了许多在 Xamarin 跨平台上使用 Iphone 连接 Zebra IMZ320 蓝牙的示例

我关注了CoreBluetooth Namespace

enter link description here

并且还使用 Plugin.BLE

但我无法连接我的设备,没有人有使用 Xamarin 跨平台 ios 连接蓝牙打印机的成功经验

最佳答案

CoreBluetooth.framework适用于低功耗蓝牙:

Communicate with Bluetooth 4.0 low-energy devices.
The Core Bluetooth framework provides the classes needed for your apps to communicate with devices that are equipped with Bluetooth low energy wireless technology.

根据Zebra IMZ320的规范,通讯方式为:

Secure Bluetooth 2.0, 802.11a/b/g/n (optional) or USB (client) connectivity; Wi-Fi®-certified connectivity

这不是低功耗蓝牙(已在蓝牙 4.0 中引入)。您将无法通过蓝牙低功耗扫描找到打印机,因为行为、逻辑和实现(协议(protocol)、规范、GATT、外设/服务/特性)完全不同。

此外,description page of the Zebra IMZ320提供了一个链接(FAQ - Creating & Registering An IOS App)来指导如何为其开发应用程序。 您需要使用ExternalAccessory.framework为了它。

If your app communicates with a Zebra product via Bluetooth using the External Accessory Framework, and you plan to distribute the app via the App Store or Volume Purchase Program Store, then you must register the app with Zebra.

此页面是通用页面(并非特定于该打印机)。但根据规范,它不符合蓝牙低功耗标准(而其他产品可能符合,这就是为什么其中有一段谈论 CoreBluetooth)。

这是正常行为(使用 ExternalAccessoryCoreBluetooth 框架),因为它们中的每一个都有特定的含义和用途。

结论:

使用ExternalAccessory.framework,也是available on Xamarin .

关于xamarin.forms - Xamarin跨平台蓝牙连接的示例代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50284991/

相关文章:

c# - Xamarin.Forms 上的音乐文件节奏和强度检测

c# - 在 Xamarin.Forms 中使用带有嵌入图像的图标属性

c# - Monotouch - 取消本地通知

ios - iOS 中的 Core Bluetooth LE 和 Classical

c# - Visual Studio 2017无法连接macOS虚拟机安装visual studio for mac和xcode

c# - Xamarin.Forms Scrollview 不会滚动

android - 使用 Kotlin 协程替换 BLE 回调

android - 无法在 Android 5 和 BLE 设备之间建立 BLE 连接

xamarin - 如何以编程方式隐藏 UWP 应用程序的键盘?

c# - 将 InputStream 和 OutputStream 转换为 System.IO.Stream - Xamarin.iOS (MonoTouch)