I'm not sure if what I am trying to do is the proper way to send ble data, and I since I can't get it to work, I'm assuming I'm doing it wrong. What I'm trying to do is send data to a BLE central device (my phone) using a peripheral. after initializing everything I can send and receive data from a serial port monitor just fine. The code below is what grabs the serial port data and sends it to the central device.
I thought that I could take the same concept to send data from the main method. after initializing, I put the following code, which (I thought) sent "Hello\n" every 2.5 seconds. instead, "m_conn_handle" = 0xFFFF and it never transmits data. NOTE: I am connected to the device via my phone which I thought should change that value to 0x0000. I know the code is rough but I just wanted to make sure I could send data correctly before I went any further. And I can't.
If anyone knows what I need to do to get it to send data, that would be greatly appreciated.
On a similar note, I am able to process that data from the central that I am receiving on the peripheral using the static void nus_data_handler(ble_nus_evt_t *pevt) function as follows.
Is this the proper way to read the value being received? It works fine, but that doesn't mean I'm doing it right.