I'm working on an idea which requires my Mac to send some data to my iOS device. I know CoreBluetooth framework is not there for Mac OS and only for iOS, so is there any way that I can get my Mac to pose a peripheral ?

I've done some Googling around - haven't got a straight answer :(

有帮助吗?

解决方案

The CoreBluetooth.Framework is there for OSX. It's embedded inside of the IOBluetooth.framework. Download the sample mac apps from the Apple Dev Site. The one difference is that the OSX version of the CoreBluetooth.Framework does not contain the CBPeripheralManager class. You should just have your iOS device act as the peripheral and the Mac as the central. The iOS device can act as both at the same time and data can be sent both ways.

其他提示

If you are comfortable with writing JavaScript, you can use bleno. It is a node.js module for implementing BLE (Bluetooth Low Energy) peripherals, and it support Mac OS X 10.9 or later, Linux and Windows.

You can find an example for implementing a Battery Service in peripheral mode in their github repository:

https://github.com/sandeepmistry/bleno/tree/master/examples/battery-service

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top