Bluetooth LE Service & Characteristic Design

Thread Starter

quique123

Joined May 15, 2015
405
Im building an Android app to interface Arduino with a BLE module from HMSoft10.

I found a tutorial online for an android app and it takes care of the connectivity and it uses 3 seekbars to send information from the android app to the BLE module. So far because the app sends 3 values, 1 for each seek bar, the class has an array declared as int[]:

Code:
private int[] RGBFrame = {0,0,0};
// Then it creates variables to hold the values
private SeekBar mRed,mGreen,mBlue;
//Then it accesses those components from the view
mRed = (SeekBar) findViewById(R.id.seekRed);
mGreen = (SeekBar) findViewById(R.id.seekGreen);
mBlue = (SeekBar) findViewById(R.id.seekBlue);
//Finally it sends the component's value to a method that parses the data
readSeek(mRed,0);
readSeek(mGreen,1);
readSeek(mBlue,2);
Because I need to increase the seek bars to a total of 6 (one for each pwm pin), I redeclared the array as:

Code:
private int[] RGBFrame = {0,0,0,0,0,0};
But now I need to also account for 12 buttons for the 12 pins without PWM. Although I could add 12 more items to that array, it might get confusing. So I was thinking of a creating a second array for the buttons. But this would mean I need a new BLE characteristic to be able to accomodate the other data array, right?

Im considering declaring a new characteristic in order to write the second array for the buttons, to my device. So here is what I know, the SampleGattAttributes.java defines my Device, Services and Characteristics like so:

Code:
public class SampleGattAttributes {
    private static HashMap<String, String> attributes = new HashMap();
    //Our device config UUID string???
    public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
    //Our device UUID string???
    public static String HM_10_CONF = "0000ffe0-0000-1000-8000-00805f9b34fb";

    //Our characteristic UUID string
    public static String HM_RX_TX = "0000ffe1-0000-1000-8000-00805f9b34fb";

    static {
        // Sample Services.
        attributes.put("0000ffe0-0000-1000-8000-00805f9b34fb", "HM 10 Serial");
        attributes.put("00001800-0000-1000-8000-00805f9b34fb", "Device Information Service");

        // Sample Characteristics.
        attributes.put(HM_RX_TX,"RX/TX data");
        attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String");
    }

    public static String lookup(String uuid, String defaultName) {
        String name = attributes.get(uuid);
        return name == null ? defaultName : name;
    }
}
Im unclear as to what all the UUIDs are for. I know I should have one for the BLE module, one for a Service and one for a characteristic. I see that the Charactersitic UUID is static coded. But Im not sure what the other 2 statically declared UUIDs are. Then the code creates 2 service UUIDs and 2 characteristic UUIDs.

Q1. What are the CLIENT_CHARACTERISTIC_CONFIG & HM_10_CONF UUIDs?
Q2. Are the 2 UUIDs for services completely unrelated, or are they in pairs for a reason?
Q3. What would I need to do to create another characteristic to communicate the buttons array since the seeks bar array is moving data via HM_RX_TX.
 
Top