Re: Using CoreBluetooth from a command line application
Re: Using CoreBluetooth from a command line application
- Subject: Re: Using CoreBluetooth from a command line application
- From: Christian Plazas <email@hidden>
- Date: Sun, 24 Jun 2012 20:57:53 -0400
Hi Craig,
I'm positive I'm not running the dispatch queue because until I saw
this message I didn't even know what it was. I realize it may be out
of scope for this list, but could you point me in the right direction
in how to properly run the dispatch queue from a command line
application. I looked at some of the docs, but got more confused. Here
is what my stripped-down main function looks like, if it helps:
#import <Foundation/Foundation.h>
#include "BluetoothManager.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
BluetoothManager *mgr = [[BluetoothManager alloc] init];
CBCentralManager *manager = [[CBCentralManager alloc]
initWithDelegate:mgr queue:nil];
while(1) {
// insert code here...
printf("Waiting...\n");
sleep(1);
printf("Manager State: %ld\n", manager.state);
}
}
return 0;
}
Thanks for your help,
Christian
On Sun, Jun 24, 2012 at 2:28 PM, Craig Dooley <email@hidden> wrote:
> Hi Christian,
> Everything in CoreBluetooth is tied to a dispatch queue. Is your app running the dispatch queue, or just quitting at the end of main?
>
> - Craig
>
> On Jun 22, 2012, at 7:13 PM, Christian Plazas <email@hidden> wrote:
>
>> Hi,
>>
>> I am trying to use CoreBluetooth from a command line application so
>> that I can quickly try out different things without getting too hung
>> up on making GUIs while I become familiar with CoreBluetooth and get
>> my bluetooth back-end working.
>>
>> Initially, I'm trying to get CBCentralManager functionality going. No
>> matter what I do I cannot get my centralManagerDidUpdateState delegate
>> to get called when I try to do this in a command line application.
>> However, this always works whenever I do it from a GUI application. I
>> admit, I'm pretty new at MacOS X development, so I may be missing
>> something totally obvious. Does anyone have any tips on getting this
>> to work from a command line application?
>>
>> I have created two bare-bones apps to try and figure it out, one a
>> command line app, the other a trivial GUI app. I stripped each app to
>> its bare essentials so I could try to isolate the problem. I can post
>> the code for both if it would help to see what I'm trying to do and to
>> see what works and what doesn't.
>>
>> Thanks,
>> Christian
>> _______________________________________________
>> 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