B4i Library BLE (Bluetooth Low Energy) library

Ph1lJ

Member
Licensed User
Longtime User
Hi Flippo

I orginally had good success with you suggestion, but I recently recieved a new TinySine that works well with the Androids, but I cannot write data out to it using B4i, I'm using the iBLE v1.2 and all I get on the LOG is
"Error writing value for characteristic: FFE1"

I can connect and read at least I think it is as it's identical to what you see in post #71

Really frustrating

Any ideas
 
D

Deleted member 103

Guest
Can it be that the characteristic no longer "FFE1" means?
 

fbritop

Active Member
Licensed User
Longtime User
I have succesfully connected to an iMac, then I call readData with service "108A"

After data is available, how can we transform a B4IArray value to a readable value?

Found: Aldo’s iMac, 37BA9875-6BCB-7778-78FC-153E5BD78F0A, RSSI = -83, (read only map) {
kCBAdvDataIsConnectable = 1;
}
BLEIDD:37BA9875-6BCB-7778-78FC-153E5BD78F0A
Discovering services
Services discovery completed.
BLE HAS BEEN CONNECTED
SERVICE AVAILABLE:<B4IList: (
180A,
"D0611E78-BBB4-4591-A5F8-487910AE4366"
)>
DATA AVAIL:180A
SERVICE CHAR:NSMapTable {
[9] Model Number String -> <B4IArray: 0x146f6dd0>
[13] Manufacturer Name String -> <B4IArray: 0x15f5c2d0>
}

Thanks
FBP
 

foakgul

Member
Licensed User
Longtime User
Hello,

The ID field in:

B4X:
Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
    Log("Found: " & Name & ", " & Id & ", RSSI = " & RSSI & ", " & AdvertisingData)

yields in my case:
Found: Kontakt, 9EAD3B2A-1F8A-8AFF-0D66-0E8DD5FCF0A6, RSSI = -50, (read only map) {

1) What does the ID (shown in bold) correspond to? It doesn't look like MAC or the UUID.

Also, I know that I cannot scan for UUIDs for ibeacons in ios, they must be specified to do that.

2) In the case of known UUID, how do I scan for major and minor?

3) Can ios scan for UUIDs of other beacons, ie Eddystone (non ibeacon)?
 

foakgul

Member
Licensed User
Longtime User
Thanks Erel.

However, the actual UUID for this device is completely different as scanned by an Android device and also as specified by the company, Kontakt.io.

How's this possible? So I was thinking this reported peripheral UUID is something different?
 

foakgul

Member
Licensed User
Longtime User
Hi Erel,

Advertising data is already being shown (blue text):

Application_Start
Application_Active
Found: Kontakt, 9EAD3B2A-1F8A-8AFF-0D66-0E8DD5FCF0A6, RSSI = -54, (read only map) {
kCBAdvDataIsConnectable = 1;
kCBAdvDataLocalName = Kontakt;
kCBAdvDataServiceData = {
D00D = <6e735779 33315d>;
};

kCBAdvDataTxPowerLevel = "-12";

Here, D00D above seems to correspond to the hardware manufacturer's instance ID below. Below data is directly related to the ibeacon per the manufacturer.
  • MAJOR: 27629
  • MINOR: 60590
  • NAMESPACE: f7826da6bc5b71e0893e
  • INSTANCEID: 6e735779696f
  • PROFILE:IBEACON
  • PROXIMITY UUID:f7826da6-4fa2-4e98-8024-bc5b71e0893e
  • TX POWER:3
  • INTERVAL:350 ms
Here, I cannot obtain the proximity UUID and major and minor values thru this library. Am I missing something?

Thanks!
 

foakgul

Member
Licensed User
Longtime User
Quite useful! Thanks Erel.

It seems B4i is using CoreBluetooth as opposed to CoreLocation for these responses.

Is it possible to initiate CoreLocation with a specific UUID to find out the major and minor, ie

B4X:
manager.Scan("f7826da6-4fa2-4e98-8024-bc5b71e0893e")
 

Turbo3

Active Member
Licensed User
Longtime User
When I move far away from the BTLE device my app crashes with the following messages in the log window while in debug mode.
B4X:
Value written for characteristic: FFE1
Value written for characteristic: FFE1
Value written for characteristic: FFE1
_BSMachError: (os/kern) invalid capability (20)
_BSMachError: (os/kern) invalid name (15)
_BSMachError: (os/kern) invalid capability (20)
_BSMachError: (os/kern) invalid name (15)
SignalHandler 11

How can this be handled more gracefully?
 

Turbo3

Active Member
Licensed User
Longtime User
Could we get a library version without the debug messages like we did for the Android version?

B4X:
Value written for characteristic: xxxx
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…