Andras "peripheral" is the default argument name for the [- didUpdateState] delegate method. There is an additional delegate method [- didAddService:error:] where the source for the issue may be found. Etan On 16.02.2013, at 22:25, Andras Kovi <allprog@gmail.com> wrote:
Hi Arvydas,
if you copied your live code here, then I suspect the services are not added to the peripheral manager. Can you change the addService line to send to the peripheralManager instead of the peripheral (which is probably nil thus not causing an error). This is just a suspicion.
Regards, Andras
On 2013.02.16., at 19:43, Arvydas Sidorenko <asido4@gmail.com> wrote:
I am trying CBPeripheralManager on iPad and CBCentralManager on iPhone 4S and I can't make service discovery work.
This is what I do:
In peripheralManagerDidUpdateState when state changes to CBPeripheralManagerStatePoweredOn I add services and start advertising: CBUUID *cUDID = [CBUUID UUIDWithString:@"DA18"]; CBUUID *cUDID1 = [CBUUID UUIDWithString:@"DA17"]; CBUUID *cUDID2 = [CBUUID UUIDWithString:@"DA16"];
CBUUID *sUDID = [CBUUID UUIDWithString:@"DA00"]; characteristic = [[CBMutableCharacteristic alloc]initWithType:cUDID properties:CBCharacteristicPropertyNotify value:nil permissions:CBAttributePermissionsReadable]; characteristic1 = [[CBMutableCharacteristic alloc]initWithType:cUDID1 properties:CBCharacteristicPropertyWrite value:nil permissions:CBAttributePermissionsWriteable]; characteristic2 = [[CBMutableCharacteristic alloc]initWithType:cUDID2 properties:CBCharacteristicPropertyRead value:nil permissions:CBAttributePermissionsReadable]; servicea = [[CBMutableService alloc] initWithType:sUDID primary:YES]; servicea.characteristics = @[characteristic,characteristic1,characteristic2]; [peripheral addService:servicea];
NSDictionary *advertisingData = @{CBAdvertisementDataLocalNameKey : @"peri"}; [self.peripheralManager startAdvertising:advertisingData];
On central device when the device is discovered it establishes connection and when that is done discovers services and service characteristics, but all I can find is Generic Access (0x1800) service with device name characteristics. I tried to run demo applications from other people github where it makes a device advertise with custom services, but I still find the same 0x1800 service only. iPad is running iOS v6.1. Anyone has a clue what is going on? _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/allprog%40gmail.com
This email sent to allprog@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/kissling%40oberon.ch
This email sent to kissling@oberon.ch
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com