Android Open Source - OpenBCI-AndroidApp Format Data For File






From Project

Back to project page OpenBCI-AndroidApp.

License

The source code is released under:

Copyright (c) 2014 OpenBCI(TM) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softwa...

If you think the Android project OpenBCI-AndroidApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/* Copyright (c) 2014 OpenBCI
 * See the file license.txt for copying permission.
 * *//* ww w.java2s.c o  m*/

package com.openbci.BLE;

public class FormatDataForFile {
  
  //Helper function to convert byte array to a string of hex values
  public static String convertBytesToHex(byte[] input){
    StringBuilder sb = new StringBuilder();
    int len = input.length;
    
    for(int i=0;i<len-1;i++){
      sb.append(String.format("%02X", input[i]));
      sb.append(",");
    }
    sb.append(String.format("%02X", input[len-1]));
    
    return sb.toString();
  }
  
  //Helper function to convert float array to comma separated string
  public static String convertFloatArrayToString(float[] input){
    StringBuilder sb = new StringBuilder();
    int len = input.length;
    
    for(int i=0;i<len;i++){
      sb.append(Float.toString(input[i]));
      sb.append(", ");
    }
    
    return sb.toString();
  }
}




Java Source Code List

com.openbci.BLE.BluetoothHelper.java
com.openbci.BLE.FormatDataForFile.java
com.openbci.BLE.HexAsciiHelper.java
com.openbci.BLE.MainActivity.java
com.openbci.BLE.OpenBCIDataConversion.java
com.openbci.BLE.RFduinoService.java
com.openbci.BLE.SaveBytesToFile.java