Я пытаюсь подключить 2-клавишную клавиатуру AB Shutter 3 bluetooth к устройству iOS, на котором запущено мое приложение swift. Проблема в том, что я не знаю, как определить идентификаторы базовой службы Bluetooth для вызова функции сканирования.
Используя следующий код игровой площадки на Mac, я смог получить следующую информацию:
import Cocoa
import IOBluetooth
import PlaygroundSupport
class BlueDelegate : IOBluetoothDeviceInquiryDelegate {
func deviceInquiryStarted(_ sender: IOBluetoothDeviceInquiry) {
print("Inquiry Started...")
//optional, but can notify you when the inquiry has started.
}
func deviceInquiryDeviceFound(_ sender: IOBluetoothDeviceInquiry, device: IOBluetoothDevice) {
print("\(device.addressString!)")
print("\(device.name!)")
print("\(device.services!)")
}
func deviceInquiryComplete(_ sender: IOBluetoothDeviceInquiry!, error: IOReturn, aborted: Bool) {
//optional, but can notify you once the inquiry is completed.
}
}
var delegate = BlueDelegate()
var ibdi = IOBluetoothDeviceInquiry(delegate: delegate)
ibdi?.updateNewDeviceNames = true
ibdi?.start()
PlaygroundPage.current.needsIndefiniteExecution = true
20-12-dc-fb-cf-ab
AB Shutter 3
[Address: 0x7fdd5745de60
ServiceName: Bluetooth Wireless Keyboard
L2CAP PSM: 17
Attributes: {
0 = "uint32(65536)";
522 = "bool8(TRUE)";
519 = "{ { uint16(1033), uint16(256) } }";
5 = "{ uuid16(10 02) }";
527 = "uint16(792)";
516 = "bool8(TRUE)";
13 = "{ { { uuid16(01 00), uint16(19) }, { uuid16(00 11) } } }";
524 = "uint16(3200)";
513 = "uint16(273)";
256 = "string( Bluetooth Wireless Keyboard )";
521 = "bool8(TRUE)";
518 = "{ { uint8(34), string(\t\U00a1\U0085u\U0095\b\a\U00e0)\U00e7%\U0081\U0095u\b\U0081\U0095u\b)\U0091\U0095u\U0091\U0095u\b&\U00ff\a)\U00ff\U0081\U00c0\f\t\U00a1\U0085%u\U0095\n#\n!\n\U008a\n\U0096\n\U009e\n\n\n\n\n\a\n\b\n\n\n\v\n\U00ae\n\U00b1\t@\t0\t\U00b7\t\U00b6\t\U00cd\t\U00b5\t\U00e2\t\U00ea\t\U00e9\U0081\U00c0\f\t\U00a1\U0085\t\U00a1\t &\U00ffu\b\U0095\U0081\U00c0\U00c0\t\U0080\U00a1\U0085%u\U0095\t\U0082\U0081\U0095u\a\U0081\U00c0\f\t\U00a1\U0085%u\U0095\U0081u\U0095\f\t\U00b8\U0081\U00ff\t\U0081u\U0095\U0081\U00c0\f\t\U00a1\U0085\U00ff\U0095u$)&\U0081u\U0081\U00c0) } }";
4 = "{ { uuid16(01 00), uint16(17) }, { uuid16(00 11) } }";
526 = "bool8(TRUE)";
515 = "uint8(33)";
258 = "string( )";
1 = "{ uuid16(11 24) }";
523 = "uint16(256)";
512 = "uint16(256)";
9 = "{ { uuid16(11 24), uint16(256) } }";
6 = "{ uint16(25966), uint16(106), uint16(256) }";
528 = "uint16(0)";
517 = "bool8(TRUE)";
525 = "bool8(FALSE)";
514 = "uint8(64)";
257 = "string(Keyboard)";
}
, Address: 0x7fdd5742bfa0
ServiceName: (null)
L2CAP PSM: 1
Attributes: {
0 = "uint32(65537)";
9 = "{ { uuid16(12 00), uint16(256) } }";
512 = "uint16(259)";
1 = "{ uuid16(12 00) }";
516 = "bool8(TRUE)";
513 = "uint16(4933)";
517 = "uint16(2)";
514 = "uint16(28705)";
515 = "uint16(4098)";
4 = "{ { uuid16(01 00), uint16(1) }, { uuid16(00 01) } }";
}
]
Может ли кто-нибудь помочь мне?
Спасибо!