android - Failing to establish a connection with a custom service -
i own lilypad simblee ble board - rfd77101, i'm trying establish connection custom service defining in arduino 1.6.5 ide simblee.customuuid
command.
i later tried service , characteristic in android studio bluetoothlegatt
sample code using uuid established previously.
the problem when connect simblee app fails recognize service , logs me following error.
custom ble service not found
the code kinda long hence not posting of directly. if has idea solution problem , need , part of code more glad post it.
thanks in advance.
this public void attempt obtain characteristic:
public void readcustomcharacteristic() { if (mbluetoothadapter == null || mbluetoothgatt == null) { log.w(tag, "bluetoothadapter not initialized"); return; } /*check if service available on device*/ bluetoothgattservice mcustomservice = mbluetoothgatt.getservice(uuid.fromstring("fe84-0000-1000-8000-00805f9b34fb")); if(mcustomservice == null) { log.w(tag, "custom ble service not found"); return; } /*get read characteristic service*/ bluetoothgattcharacteristic mreadcharacteristic = mcustomservice.getcharacteristic(uuid.fromstring("2d30c083-f39f-4ce6-923f-3484ea480596")); if(!mbluetoothgatt.readcharacteristic(mreadcharacteristic)) { log.w(tag, "failed read characteristic"); } }
bluetoothgattservice mcustomservice = mbluetoothgatt.getservice(uuid.fromstring("fe84-0000-1000-8000-00805f9b34fb"));
the uuid provided not in correct format. according documentation, part before first hyphen should consist of 4 hex octets (see 1 provided characteristics) got 2 here. should add padding 0 in front like
bluetoothgattservice mcustomservice = mbluetoothgatt.getservice(uuid.fromstring("0000fe84-0000-1000-8000-00805f9b34fb"));
edit : missing point here. have called mbluetoothgatt.discoverservices()?
Comments
Post a Comment