[英]Set mac mini as a peripheral device using core bluetooth framework
I am working with the core bluetooth framework . 我正在使用核心蓝牙框架。 I want set my mac mini which is BLE enable device as a bluetooth peripheral which advertise the data .
我要将设置为BLE启用设备的mac mini设置为发布数据的蓝牙外围设备。 I have tried to create mac application for the same : My application implements CBPeripheralDelegate protocol and in view didDidLoad method i have implemented following code :
我试图为同一用户创建mac应用程序:我的应用程序实现了CBPeripheralDelegate协议,并且鉴于didDidLoad方法,我已经实现了以下代码:
peripheralManager=[[CBPeripheral alloc]init];
peripheralManager.delegate=self;
But its not working . 但是它不起作用。 Is this sufficient ?
这样够吗? Or really OSx application supports the peripheral mode ?
还是OSx应用程序真正支持外设模式?
You are initializing CBPeripheral in your code not CBPeripheralManager. 您正在代码中初始化CBPeripheral,而不是CBPeripheralManager。
Here's an example from a project I'm working on: 这是我正在从事的项目的示例:
//Initializes peripheral manager
-(CBPeripheralManager *)peripheralManager
{
if (_peripheralManager == nil)
{
_peripheralManager = [[CBPeripheralManager alloc]initWithDelegate:self queue:nil];
}
return _peripheralManager;
}
OS X currently doesn't support peripheral mode -- only central. OS X当前不支持外围设备模式,仅支持中央模式。 iOS, however, can act as either a peripheral or a central.
但是,iOS可以充当外围设备或中央设备。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.