Using UUIDs and Bluetooth

I did some more steps towards accessing Kenwood TH-D74’s services via bluetooth. I struggled for some time understanding how discovery based on UUIDs work. I was not aware that, for each service profile, there is a standard Universally Unique Identifier (UUID) documented in Bluetooth SIG specs. Specifically for Serial Port Profile (SPP) service, the UUID is 0x1101. More information here. So my code is now:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    ...
    thuuid = @[@"0x1108"]; // SPP
    ...
}

And

- (void)startScan {
    [manager scanForPeripheralsWithServices:thuuid options:nil];
}

And

- (void)centralManagerDidUpdateState:(nonnull CBCentralManager *)central {
    switch (central.state) {
        ...
        case CBManagerStatePoweredOn:
            _textField.stringValue = @"Central state is powered on\n";
            [self startScan];
            break;
    }
}

Building and run, gives me this:

Bingo ! More to come.

Leave a Reply

Your email address will not be published. Required fields are marked *