ESP32 + MicoPython bluetoothライブラリでKORG microKEY2 Airに接続してMIDIデータを取得する試みを行った。
最終的に現在のBLEライブラリでは機能が足りないと判断し、中断
- できたこと
- KORG microKEY2との接続
- Service, Characteristicsの取得
- できなかったこと
ESP32+MicroPython BLEで得られたServiceとCharacteristics
(0, 1, 9, UUID16(0x1800)) Generic Access (0, 2, 3, 2, UUID16(0x2a00)) Device Name b'microKEY2-25 Air\x00\x00\x00\x00\x00\x00') (0, 4, 5, 2, UUID16(0x2a01)) Appearance b'\x80\x00') (0, 6, 7, 10, UUID16(0x2a02)) Peripheral Privacy Flag 00 (0, 8, 9, 2, UUID16(0x2a04)) Peripheral Preferred Connection Parameters b'\x06\x00\t\x00\x00\x00\xc8\x00') (0, 12, 15, UUID16(0x1801)) Generic Attribute (0, 13, 14, 34, UUID16(0x2a05)) Service Changed b'\x01\x00\xff\xff') (0, 16, 20, UUID16(0x180a)) Device Information (0, 17, 18, 2, UUID16(0x2a29)) Manufacturer Name String b'Korg Inc.') (0, 19, 20, 2, UUID16(0x2a24)) Model Number String b'microKEY Air') (0, 21, 24, UUID128('d0611e78-bbb4-4591-a5f8-487910ae4366')) (0, 22, 23, 24, UUID128('8667556c-9a37-4c91-84ed-54ee27d90049')) ↑↑このCharacteristicの値がReadできず(追記:間違っていないか?) (0, 25, 28, UUID128('03b80e5a-ede8-4b33-a751-6ce34ec4c700'))<< MIDI Service (0, 26, 27, 22, UUID128('7772e5db-3868-4112-a1a9-f2669d106bf3'))<< MIDI Date I/O Characteristic
GATT Services
https://www.bluetooth.com/ja-jp/specifications/gatt/services/
GATT characteristics
https://www.bluetooth.com/ja-jp/specifications/gatt/characteristics/
■追記(Client側からペリフェラルにNotify送信のための指示)
CCCD (Client Characteristic Configuration Descriptor)
CCCDに1を書き込むとNotifyを許可、2を書き込むとIndicateを許可
0を書き込むと、NotifyおよびIndicateの両方を無効にする。
詳細に説明していただいている記事
【BLEを使う】GATT(Generic Attribute Profile)概要 - 叶鋼は午前1時に計算をする