CoreBluetooth FrameWork 官方文檔中文版(未完成)

Framework---Core Bluetooth(Core Bluetooth 框架)

Communicate with Bluetooth 4.0 low-energy devices.(用于與藍(lán)牙4.0低能耗設(shè)備之間的溝通)

Overview---概述

The Core Bluetooth framework provides the classes needed for your apps to communicate with devices that are equipped with Bluetooth low energy wireless technology.(核心藍(lán)牙框架提供了您的應(yīng)用程序需要與藍(lán)牙低能量無線技術(shù)裝備的通信類)

Do not subclass any of the classes of the Core Bluetooth framework. Overriding these classes is unsupported and results in undefined behavior.(不要將核心藍(lán)牙框架的任何類歸為子類,不支持這些類并導(dǎo)致未定義的行為)

Important ---重要提示

An iOS app linked on or after iOS 10.0 must include in its Info.plist file the usage description keys for the types of data it needs to access or it will crash. To access Bluetooth peripheral data specifically, it must include NSBluetoothPeripheralUsageDescription.(iOS 10.0之后如果要使用藍(lán)牙就必需要在 info.plist 加入NSBluetoothPeripheralUsageDescription 這個(gè)描述,不然就會崩潰)

Classes---類別

CBATTRequest

The CBATTRequest class represents Attribute Protocol (ATT) read and write requests from remote central devices (represented by CBCentral objects). Remote centrals use these ATT requests to read and write characteristic values on local peripherals (represented by CBPeripheralManager objects). Local peripherals, on the other hand, use the properties of CBATTRequest objects to respond to the read and write requests appropriately, using the respond(to:withResult:) method of the CBPeripheralManager class.(CBATTRequest 類代表屬性協(xié)議(ATT)讀寫遠(yuǎn)程中央設(shè)備的請求(通過CBCentral對象表示)遠(yuǎn)程中心使用這些ATT請求讀寫附近外設(shè)的特征值(由CBPeripheralManager對象表示)衷敌。附近的外設(shè)勿侯,另一方面,使用CBATTRequest對象的特征來適當(dāng)?shù)捻憫?yīng)讀寫請求缴罗,使用cbperipheralmanager類的響應(yīng)方法助琐。)

CBAttribute

CBAttribute is an abstract base class that defines behavior common to the collection of objects that represent aspects of services offered by a peripheral.(CBAttribute是一個(gè)抽象的基本類,定義對象集合的公共行為面氓,該對象集合表示外設(shè)提供的服務(wù)方面弓柱。)

CBCentral

The CBCentral class represents remote central devices that have connected to an app implementing the peripheral role on a local device. That is, when you are implementing the peripheral role using the CBPeripheralManager class, centrals that connect to your local peripheral are represented as CBCentral objects. Remote centrals are identified by universally unique identifiers (UUIDs), represented by NSUUID objects.(CBCentral類表示遠(yuǎn)程中心設(shè)備在app上使用CBPeripheralManager 這個(gè)類去連接一個(gè)外圍設(shè)備(好難翻譯啊)侧但。遠(yuǎn)程中心是由通用唯一標(biāo)識符(UUID),由NSUUID確定對象)

CBCentralManager

CBCentralManager objects are used to manage discovered or connected remote peripheral devices (represented by CBPeripheral objects), including scanning for, discovering, and connecting to advertising peripherals.(CBCentralManager對象用于管理發(fā)現(xiàn)或連接的遠(yuǎn)程外圍設(shè)備(由CBPeripheral對象表示)航罗,包括掃描禀横,發(fā)現(xiàn)和連接廣告外設(shè)。)

CBCharacteristic

CBCharacteristic and its subclass CBMutableCharacteristic represent further information about a peripheral’s service. CBCharacteristic objects in particular represent the characteristics of a remote peripheral’s service (remote peripheral devices are represented by CBPeripheral objects). A characteristic contains a single value and any number of descriptors describing that value. The properties of a characteristic determine how the value of the characteristic can be used and how the descriptors can be accessed.(CBCharacteristic及其亞類CBMutableCharacteristic代表外圍的服務(wù)的更多信息粥血。特別是CBCharacteristic對象代表一個(gè)遠(yuǎn)程外圍的服務(wù)特點(diǎn)(遠(yuǎn)程外圍設(shè)備都由CBPeripheral對象表示)柏锄。一個(gè)特性包含一個(gè)值和描述該值的任意數(shù)量的描述符酿箭。特性的屬性決定了如何使用該特性的值以及描述符如何被訪問。)

CBDescriptor

CBDescriptor and it subclass CBMutableDescriptor represent a descriptor of a peripheral’s characteristic. CBDescriptor objects in particular represent the descriptors of a remote peripheral’s characteristic (remote peripheral devices are represented by CBPeripheral objects). Descriptors provide further information about a characteristic’s value. For example, they may describe the value in human-readable form and describe how the value should be formatted for presentation purposes. Characteristic descriptors also indicate whether a characteristic’s value is configured on a server (a peripheral) to indicate or notify a client (a central) when the value of the characteristic changes.(CBDescriptor和它的子類CBMutableDescriptor代表一種的特征描述符趾娃。特別是CBDescriptor對象代表一個(gè)遠(yuǎn)程外圍的特征描述符(遠(yuǎn)程外圍設(shè)備都由CBPeripheral對象表示)缭嫡。描述符提供有關(guān)特征值的進(jìn)一步信息。例如抬闷,它們可以描述人類可讀的形式的值妇蛀,并描述如何為呈現(xiàn)目的格式化值。特征描述符還指示特征值是否配置在服務(wù)器(外圍設(shè)備)上笤成,以便在特征變化值指示或通知客戶端(中央)時(shí)评架。)

CBManager

The abstract base class for Core Bluetooth manager objects (central and peripheral).(核心藍(lán)牙管理器對象(中央和外圍)的抽象基類)

CBMutableCharacteristic

CBMutableCharacteristic objects represent the characteristics of a local peripheral’s service (local peripheral devices are represented by CBPeripheralManager objects). This class adds write access to many of the properties in the CBCharacteristic class it inherits from.(CBMutableCharacteristic對象代表一個(gè)地方周圍的服務(wù)特點(diǎn)(本地外圍設(shè)備都由CBPeripheralManager對象表示)。這類增加寫訪問的許多屬性繼承自CBCharacteristic類炕泳。)

CBMutableDescriptor

CBMutableDescriptor objects represent the descriptors of a local peripheral’s characteristic (local peripheral devices are represented by CBPeripheralManager objects).(CBMutableDescriptor對象代表一個(gè)地方周圍的特征描述符(本地外圍設(shè)備都由CBPeripheralManager對象表示))

CBMutableService

The CBMutableService class adds write access to all of the properties in the CBService class it inherits from. You use this class to create a service or an included service on a local peripheral device (represented by a CBPeripheralManager object). After you create a service, you can add it to the peripheral’s local database using the add(_:) method of the CBPeripheralManager class. After you add a service to the peripheral’s local database, the service is cached and you can no longer make changes to it.

CBPeer

The CBPeer class is an abstract base class that defines common behavior for objects representing remote devices. You typically do not create instances of either CBPeer or its concrete subclasses. Instead, the system creates them for you during the process of peer discovery.

CBPeripheral

The CBPeripheral class represents remote peripheral devices that your app—by means of a central manager (an instance of CBCentralManager)—has discovered advertising or is currently connected to. Peripherals are identified by universally unique identifiers (UUIDs), represented by NSUUID objects. Peripherals may contain one or more services or provide useful information about their connected signal strength.

CBPeripheralManager

CBPeripheralManager objects are used to manage published services within the local peripheral device’s Generic Attribute Profile (GATT) database and to advertise these services to central devices (represented by CBCentral objects). While a service is in the database, it is visible to, and can be accessed by, any connected central. That said, if your app has not specified the bluetooth-peripheral background mode, the contents of its services become disabled when it is in the background or in a suspended state; any remote central trying to access the service’s characteristic value or characteristic descriptors receives an error.

CBService

CBService and its subclass CBMutableService represent a peripheral’s service—a collection of data and associated behaviors for accomplishing a function or feature of a device (or portions of that device). CBService objects in particular represent services of a remote peripheral device (represented by a CBPeripheral object). Services are either primary or secondary and may contain a number of characteristics or included services (references to other services).

CBUUID

Instances of the CBUUID class represent the 128-bit universally unique identifiers (UUIDs) of attributes used in Bluetooth low energy communication, such as a peripheral’s services, characteristics, and characteristic descriptors. This class provides a number of factory methods for dealing with long UUIDs when developing your app. For example, instead of passing around the string representation of a 128-bit Bluetooth low energy attribute in your code, you can create a CBUUID object that represents it, and pass that around instead.

Protocols

CBCentralManagerDelegate

The CBCentralManagerDelegate protocol defines the methods that a delegate of a CBCentralManager object must adopt. The optional methods of the protocol allow the delegate to monitor the discovery, connectivity, and retrieval of peripheral devices. The only required method of the protocol indicates the availability of the central manager, and is called when the central manager’s state is updated.

CBPeripheralDelegate

The delegate of a CBPeripheral object must adopt the CBPeripheralDelegate protocol. The delegate uses this protocol’s methods to monitor the discovery, exploration, and interaction of a remote peripheral’s services and properties. There are no required methods in this protocol.

CBPeripheralManagerDelegate

The delegate of a CBPeripheralManager object must adopt the CBPeripheralManagerDelegate protocol, a protocol consisting of numerous optional methods and one required method. The protocol’s optional methods are used by the delegate to verify publishing and advertising, and to monitor read, write, and subscription requests from remote central devices. The protocol’s required method, which indicates whether the peripheral manager is available, is called when the peripheral manager’s state is updated.

Reference

Core Bluetooth Constants

This document describes the constants found in the Core Bluetooth framework.

Core Bluetooth Enumerations

Structures

CBATTError

CBAttributePermissions

Values representing the read, write, and encryption permissions for a characteristic’s value.

CBCharacteristicProperties

Values representing the possible properties of a characteristic. Since characteristic properties can be combined, a characteristic may have multiple property values set.

CBError

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末纵诞,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子培遵,更是在濱河造成了極大的恐慌浙芙,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,681評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件籽腕,死亡現(xiàn)場離奇詭異嗡呼,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)节仿,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,205評論 3 399
  • 文/潘曉璐 我一進(jìn)店門晤锥,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人廊宪,你說我怎么就攤上這事矾瘾。” “怎么了箭启?”我有些...
    開封第一講書人閱讀 169,421評論 0 362
  • 文/不壞的土叔 我叫張陵壕翩,是天一觀的道長。 經(jīng)常有香客問我傅寡,道長放妈,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,114評論 1 300
  • 正文 為了忘掉前任荐操,我火速辦了婚禮芜抒,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘托启。我一直安慰自己宅倒,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,116評論 6 398
  • 文/花漫 我一把揭開白布屯耸。 她就那樣靜靜地躺著拐迁,像睡著了一般蹭劈。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上线召,一...
    開封第一講書人閱讀 52,713評論 1 312
  • 那天铺韧,我揣著相機(jī)與錄音,去河邊找鬼缓淹。 笑死哈打,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的割卖。 我是一名探鬼主播前酿,決...
    沈念sama閱讀 41,170評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼鹏溯!你這毒婦竟也來了罢维?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 40,116評論 0 277
  • 序言:老撾萬榮一對情侶失蹤丙挽,失蹤者是張志新(化名)和其女友劉穎肺孵,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體颜阐,經(jīng)...
    沈念sama閱讀 46,651評論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡平窘,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,714評論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了凳怨。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片瑰艘。...
    茶點(diǎn)故事閱讀 40,865評論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖肤舞,靈堂內(nèi)的尸體忽然破棺而出紫新,到底是詐尸還是另有隱情,我是刑警寧澤李剖,帶...
    沈念sama閱讀 36,527評論 5 351
  • 正文 年R本政府宣布芒率,位于F島的核電站,受9級特大地震影響篙顺,放射性物質(zhì)發(fā)生泄漏偶芍。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,211評論 3 336
  • 文/蒙蒙 一德玫、第九天 我趴在偏房一處隱蔽的房頂上張望匪蟀。 院中可真熱鬧,春花似錦宰僧、人聲如沸萄窜。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,699評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽查刻。三九已至,卻和暖如春凤类,著一層夾襖步出監(jiān)牢的瞬間穗泵,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,814評論 1 274
  • 我被黑心中介騙來泰國打工谜疤, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留佃延,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 49,299評論 3 379
  • 正文 我出身青樓夷磕,卻偏偏與公主長得像履肃,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子坐桩,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,870評論 2 361

推薦閱讀更多精彩內(nèi)容