This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF UART Android App [Feature Request & a Question]

Hi Nordic,

I am a hardware/firmware guy without App development skills and I also lack the time to acquire these skills. I enjoyed your UART App during my development, thanks a lot for providing many useful example apps. However, I require currently an extra feature regarding the nRF UART App. Can you please add the possibility to send and receive raw hex data? Using ASCII encoding brings limitations and overhead for some applications, as you may guess. Question: If I define a simple communication protocol over BLE UART with a very simple packet structure, should I implement a kind of simple CRC/CheckSum mechanism or can I securely assume that the BLE protocol (Nordic UART Service) will provide me only the valid uncorrupted data?

Kind regards...

  • Doesn't it already send and receive raw data (bits, bytes, hex)? The raw data is then encoded using ASCII and displayed on the screen.

    Unfortunately, we can't develop the app for you. If you want to remove the ASCII encoding you will have to do some app development yourself, or get someone else to do it.

    If you want to have a go at it, you should go to line 239 in MainActivity.java and replace:

    String text = new String(txValue, "UTF-8");
    String currentDateTimeString = DateFormat.getTimeInstance().format(new Date());
    listAdapter.add("["+currentDateTimeString+"] RX: "+text);
    

    with

    int i = 0;                     	 
    StringBuilder sb = new StringBuilder();                  	 
    while(txValue[i] != '\n')
    {
        sb.append(String.format("%02X ", txValue[i]));
        i++;
    }                         	
    String currentDateTimeString = DateFormat.getTimeInstance().format(new Date());
    listAdapter.add("["+currentDateTimeString+"] RX: "+sb.toString());
    

    This will display the data as hex, so HELLO will be 48 45 4C 4C 4F

    The BLE protocol is very secure and you can assume the data is uncorrupted.

Related