Can I make my Mac as a Bluetooth Peripheral?
Asked Answered
C

2

10

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 :(

Chambless answered 10/5, 2013 at 22:41 Comment(0)
P
12

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.

Poison answered 11/5, 2013 at 1:16 Comment(2)
Note that CBPeripheralManager is available in OS X 10.9 and later (link).Embroider
Its recommended that you use your mac as a peripheral if you require 2 way communication. Because you should close connections as soon as tasks are completed.Variate
P
5

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

Passive answered 8/8, 2016 at 21:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.