→ benjenq: 再次scan前不先stop scan嗎? 08/24 21:14
→ m339606: 要先停止才能進行下次掃描 08/24 23:52
推 azules: option:CBCentralManagerScanOptionAllowDuplicatesKey 08/25 00:28
→ azules: 預設NO 所以不是新的peripherals就不會再出現 08/25 00:29
→ azules: 這樣你就不用再觸發一次scanForPeripherals 08/25 00:30
改成先停止再開始就可以掃到設備了
感恩感恩~~!!
想再問一下就是像我們接收到藍牙給的資料時是16位元的資料
然後再把這個資料轉換成我們要的數據
這個過程會用到一些api
UnsafePointer<UInt8>((data as? NSData)?.bytes.assumingMemoryBound
(to: UInt8.self))
然後取得pointee
Pointer?.withMemoryRebound(to: UInt16.self, capacity: 1,
<#T##body: (UnsafePointer<T>) throws ->
Result##(UnsafePointer<T>) throws -> Result#>)
好奇這些過程再做什麼事情 看一下文件裡面的解釋還是看不太懂QQ
※ 編輯: iphone7pro (220.134.182.243), 08/25/2017 10:23:17
※ 編輯: iphone7pro (220.134.182.243), 08/25/2017 10:34:47
推 fishead1116: 抓資料我是這樣寫 08/25 11:04
→ fishead1116: var rawData = [CUnsignedChar](repeating: 0,count: 08/25 11:04
→ fishead1116: data.count) 08/25 11:04
→ fishead1116: data.copyBytes(to: &rawData, count: data.count) 08/25 11:05