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.

 
 

Lasă un răspuns

Adresa ta de email nu va fi publicată. Câmpurile obligatorii sunt marcate cu *