kickingvegas / YmsCoreBluetooth

A block-based framework for building Bluetooth 4.0 Low Energy (aka Smart or LE) iOS and OS X applications using the CoreBluetooth API. Includes Deanna and DeannaMac, applications to communicate with a TI SensorTag for iOS and OS X respectively.
Other
525 stars 128 forks source link

Usage of Base Address #109

Open tbrennanw0rk opened 9 years ago

tbrennanw0rk commented 9 years ago

Hi,

Is this really needed, outside of TI boards. It looks confusing if there's a non-TI board that is running but has no base address.

Can you clarify this please?

Regards,

kickingvegas commented 9 years ago

Will need more clarity, but the base addressing scheme is based on the Bluetooth LE spec which displaces the offsets in the upper bits of the address. It was a surprise for me when I first learned it, but there it is.

tbrennanw0rk commented 9 years ago

Let me re-phrase this, a BLE would have UUID. From the code that you have there, is specifically Texas Instruments based, which uses base address.

- (instancetype)initWithPeripheral:(CBPeripheral *)peripheral
                           central:(YMSCBCentralManager *)owner
                            baseHi:(int64_t)hi
                            baseLo:(int64_t)lo;

Notice for example, the parameters hi and lo, what is specified here? When CoreBluetooth returns a CBPeripheral, we have the UUID, but...How do you obtain a baseHi and baseLo from that UUID?

For non based TI BLE devices, there's a lot of methods that specifies base address, so how would this be handled? Base Address == UUID?

kickingvegas commented 9 years ago

Understood. The API intends to treat the 128-bit UUID as a number, so separates it into two 64-bit numbers, since there is no 128-bit type. baseHi refers to the upper 64 bits, whereas baseLo refers to the lower 64 bits.

tbrennanw0rk commented 9 years ago

Maybe this needs to be clarified in the documentation, that the UUID needs to be split up to two 64bits as someone would be under the impression that this will work out of the box.

kickingvegas commented 9 years ago

I'll consider it but I've already had some mention of it in the documentation:

http://kickingvegas.github.io/YmsCoreBluetooth/appledoc/Classes/YMSCBPeripheral.html#//api/name/initWithPeripheral:central:baseHi:baseLo:

tudorached commented 8 years ago

Hi,

Can you please show me how to split an 128bit UUID into two 64bits in order to use them as baseHi and baseLo?

kickingvegas commented 8 years ago

@tudorached: you would split the UUID in half, with the right half used as baseHi and the left half used as baseLo.

For example, given the UUID 38C5AB2F-065A-4A02-BA36-4F29EE21228E, it would set so

baseHi = 0x38C5AB2F065A4A02
baseLo = 0xBA364F29EE21228E