I need use NUS services (UART over BLE) What file and functions should I use?
I need use NUS services (UART over BLE) What file and functions should I use?
That depends on what "side" of GATT link are you looking for;) BLE is asymmetric on pretty much every layer and NUS need GATT Client and GATT Server. ble_nus
is GAP Peripheral + GATT Server (usual "embedded" option, that's why it is kind of "default"), ble_nus_c
is GAP Central + GATT Client option (usually handled by device with higher power budget = bigger battery).
Ok, clear.
I need use in central role. And How to add RX TX characteristics to service In ble_nus_c? in ble_nus_c_init
function?
Well if you are GAP Central then you use GATT Client, no characteristics to add, all the functionality should be in the example already.
How can I know that I use GATT Client?
That's a little bit philosophical question, isn't it?;) Nordic UART Service is defined on GATT as far as I understand (that's what BT SIG calls "Service definition") but that's not enough to make it work in real life. For that you need to say which GAP role (Central or Peripheral) hosts which GATT role (Client or Server). Theoretically you can do both combinations but in order to make it 100% work then both sides must do (= whatever GAP role you are you need to implement GATT Client and Server). As I understand Nordic guys in their examples don't go this route - which would probably be wasting of time and effort - but simply say GAP Central always hosts GATT Client which connects to GAP Peripheral and that hosts Nordic UART Service on GATT Server. This is what BT SIG normally calls "GAP Profile" definition (defines both GAP + GATT properties).