简体   繁体   English

使用核心蓝牙框架将Mac mini设置为外围设备

[英]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.

相关问题 核心蓝牙:无法让iPhone(中央)和Mac(外围设备)配对 - Core Bluetooth: Cannot get iPhone (the central) and Mac (the peripheral) to pair 使用Core Bluetooth在后台获取蓝牙LE外围设备广告 - Using Core Bluetooth to get Bluetooth LE peripheral advertisements in background 如何使用Core Bluetooth Framework以最小化模式扫描“低能耗蓝牙设备”? - How to scan 'Lower Energy Bluetooth Device' in minimize mode by using Core Bluetooth Framework? iOS Core蓝牙外围设备连接请求 - IOS Core bluetooth peripheral connection request 如何在iOS中不使用Gamekit,EAaccessory和核心蓝牙框架的情况下发现另一个设备? - How to discover another device without using Gamekit, EAaccessory and core Bluetooth framework in iOS? 使用Apples“External Accessory framework”获取蓝牙设备的MAC地址 - Get the MAC address of a Bluetooth device with Apples “External Accessory framework” 无法从iOS设备发现蓝牙外围设备或服务 - Unable to discover bluetooth peripheral or service from iOS device 使用BluetoothManager私有框架获取蓝牙的MAC地址 - Getting MAC address of a bluetooth using BluetoothManager private framework 使用QuickTime Player在Mac mini上录制iOS设备屏幕(注意:我的台式机没有摄像头) - Record iOS device screen on mac mini using QuickTime Player (Note: My desktop doesn't have a camera) 是否可以使用核心蓝牙与设备常数配对密钥配对 - Is it possible to pair with device constant pair key using core bluetooth
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM