It's quite strange that some CBCharacteristicProperties transmit to the other devices and the value changed.
- (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral{
NSLog(@"Done");
CBUUID *cUDID = [CBUUID UUIDWithString:@"DA18"];
CBUUID *cUDID1 = [CBUUID UUIDWithString:@"DA17"];
CBUUID *sUDID = [CBUUID UUIDWithString:@"0A12"];
characteristic = [[CBMutableCharacteristic alloc]initWithType:cUDID properties:CBCharacteristicPropertyNotify value:nil permissions:0];
NSLog(@"%u",characteristic.properties);
characteristic1 = [[CBMutableCharacteristic alloc]initWithType:cUDID1 properties:CBCharacteristicPropertyWriteWithoutResponse value:nil permissions:0];
NSLog(@"%u",characteristic1.properties);
servicea = [[CBMutableService alloc]initWithType:sUDID primary:YES];
servicea.characteristics = @[characteristic,characteristic1];
[peripheral addService:servicea];
}
And the central side in the delegate is :
- (void) peripheral:(CBPeripheral *)aPeripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
{
for (CBCharacteristic *aChar in service.characteristics){
NSLog(@"%@",aChar.UUID);
if ([aChar.UUID isEqual:[CBUUID UUIDWithString:@"DA17"]]) {
NSLog(@"Find DA17");
NSLog(@"%lu",aChar.properties);
NSString *mainString = [NSString stringWithFormat:@"12345"];
NSData *mainData= [mainString dataUsingEncoding:NSUTF8StringEncoding];
[aPeripheral writeValue:mainData forCharacteristic:aChar type:CBCharacteristicWriteWithoutResponse];
}
}
}