Re: Can't discover CBPeripheralManager services
Re: Can't discover CBPeripheralManager services
- Subject: Re: Can't discover CBPeripheralManager services
- From: Etan Kissling <email@hidden>
- Date: Sat, 16 Feb 2013 21:57:41 +0000
- Thread-topic: Can't discover CBPeripheralManager services
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 <email@hidden>
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 <email@hidden> 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 (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Bluetooth-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden