I tried to create 128Bit with iOS CoreBluetooth framework.
The code I wrote is here:
//16Bit Value-String static NSString * const ADVERTISING_SERVICE_16=@ "FFC0"; //Var for 128Bit String static NSString * ADVERTISING_SERVICE; //A Base UUID static NSString * const BASE_UUID=@ "0405060708090A0B0C0D0E0F"; + (NSString*) get128BitUUID:(NSString*)uuid{ return [[NSString alloc] initWithFormat:@"0000%@%@",uuid,BASE_UUID]; } ADVERTISING_SERVICE = [UUIDFuncs get128BitUUID:ADVERTISING_SERVICE_16];
And now when I try to get the UUID with this:
if([service.UUID isEqual:[CBUUID UUIDWithString:ADVERTISING_SERVICE] ]){ [peripheral discoverCharacteristics:nil forService:service]; }
I get this error message:
2012-09-04 14:18:06.127 blukiiFirmwareTest[3154:707] *** Terminating app due to uncaught exception 'Invalid UUID string', reason: 'String 0000FFC00405060708090A0B0C0D0E0F does not represent a valid UUID'
I do not understand why; the string is a 16-byte long UUID, it is 128 bits, so why am I getting this error?
nivek
source share