Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Is Bluetooth API available for development?

You need to add these libs to the .pro file as well:

-lbtapi -lpps -lbluetooth

 

So the full line should be:

LIBS += -lbbplatform -lbtapi -lpps -lbluetooth

 

In the 10.0.8 release you should be able to drop the last 2 and just have:

LIBS += -lbbplatform -lbtapi

 

Let me know how that works for you.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
actjak
Posts: 33
Registered: ‎05-02-2012
My Device: playbook

Re: Is Bluetooth API available for development?

[ Edited ]

thank you for the answer. I added the libs to the. pro and the  function are accepted.

The problem tath I have now : 

When I Initializes the btspp library

int iN;
iN = bt_spp_init();

 this function return iN =13;

but i dont know if the initialization is successful

13 he corresponds with EOK or errno

my full  code is:

#include "app.hpp"

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <btapi/btspp.h>

using namespace bb::cascades;


App::App()
{

    int iN;
	iN = bt_spp_init();

	qWarning() << "initialisation spp :";
	qWarning() << iN;



	char UUID[] = { (char) 0x00, (char) 0x85, (char) 0x5A, (char) 0xFE, (char) 0x28, (char) 0xED, (char) 0x11, (char) 0xda, (char) 0x94, (char) 0xd9, (char) 0x00, (char) 0xe0, (char) 0x81, (char) 0x61, (char) 0x16, (char) 0x5f };
	char addr[] = { (char) 0x41, (char) 0x07, (char) 0xCF, (char) 0x36, (char) 0x98, (char) 0xBA};
int openSpp;
openSpp = bt_spp_open(addr,UUID,true);
qWarning()<< "la reponse de la fonction bt_spp_open";
qWarning()<< openSpp;
	int deini;
	deini = bt_spp_deinit();
	qWarning() << "denitialisation spp :";
	qWarning() <<  deini;
 
    QmlDocument *qml = QmlDocument::create("main.qml");
    //-- setContextProperty expose C++ object in QML as an variable
    //-- uncomment next line to introduce 'this' object to QML name space as an 'app' variable
    //qml->setContextProperty("app", this);
    
    AbstractPane *root = qml->createRootNode<AbstractPane>();
    Application::setScene(root);
}

 

 

 

when i run thise code :

 


initialisation spp :
13
la reponse de la fonction bt_spp_open
-1
denitialisation spp :
16

 

Please use plain text.
Contributor
actjak
Posts: 33
Registered: ‎05-02-2012
My Device: playbook

Re: Is Bluetooth API available for development?

I found the service from EOK
for more information:
http://www.qnx.com/developers/docs/6.4.1/neutrino/lib_ref/e/errno.html

so I know bt_spp_init () not work, because it not Returne EOK

Would somebody have an idea for a successful initialization ?

Please use plain text.
Contributor
actjak
Posts: 33
Registered: ‎05-02-2012
My Device: playbook

Re: Is Bluetooth API available for development?

the return of          int bt_spp_init();    is 13

i find  that  means Permission denied     ( its define in errno.h)

in the bar-descriptor I selact all and it is the same probleme

I want to know how obtain the permission?

Please use plain text.
New Developer
kevhaz
Posts: 7
Registered: ‎07-24-2012
My Device: Dev Alpha C, Z10LE, Playbook

Re: Is Bluetooth API available for development?

I get the same, but in a standard C console app...

 

    /* Initialise spp */

    int ret = bt_spp_init();

    if (EOK==ret) {

    fprintf(stderr,"Awesome: bt_spp_init=%d\n", ret);

    } else {

    fprintf(stderr,"Not so awesome: bt_spp_init=%d, errno=%d", ret, errno);

    }

 

just logs:

 

Not so awesome: bt_spp_init=13, errno=13

 

So are we missing some call to gain permission to use this API?

 

 

Please use plain text.
New Developer
kevhaz
Posts: 7
Registered: ‎07-24-2012
My Device: Dev Alpha C, Z10LE, Playbook

Re: Is Bluetooth API available for development?

Also, I tried using bt_device_init t osee what that would do:

 

void bt_device_callback( const int event, const char *bt_addr, const char *event_data )

{

fprintf( stderr, "**** BT EVENT ****");

fprintf( stderr, "Event=%d", event);

return;

}

 

...

    int btinit = bt_device_init(bt_device_callback);

    if (0==btinit) {

    fprintf(stderr,"Awesome: bt_device_init=%d\n", btinit);

    } else {

    fprintf(stderr,"Not so awesome: bt_device_init=%d, errno=%d", btinit, errno);

    }

...

 

and that returned:

 

Process 16982225 (HelloWorld) terminated SIGSEGV code=2 fltno=11 ip=78024ea4(/base/usr/lib/libbtapi.so.1@bt_device_init+0x74) mapaddr=00004ea4. ref=001012c8

 

Hohum!

 

Please use plain text.
Contributor
actjak
Posts: 33
Registered: ‎05-02-2012
My Device: playbook

Re: Is Bluetooth API available for development?

Please use plain text.
New Developer
kevhaz
Posts: 7
Registered: ‎07-24-2012
My Device: Dev Alpha C, Z10LE, Playbook

Re: Is Bluetooth API available for development?

Thanks, I guess that explains that one :smileyhappy:

Please use plain text.
Developer
canurabus
Posts: 23
Registered: ‎05-29-2012
My Device: PlayBook

Re: Is Bluetooth API available for development?

Is there any way to develop an app that uses a bluetooth serial profile without having an alpha? Any chance the bb10 simulator supports it? It's pretty frustrating sitting here with a Playbook and a bunch of ideas and code with no way to put any of it together.

Please use plain text.
Contributor
actjak
Posts: 33
Registered: ‎05-02-2012
My Device: playbook

Re: Is Bluetooth API available for development?

I think the bluetooth is not available for the simulator
Because itry with the simulator and i have :

 bt_spp_init=2, errno=2

and you cane find in errno.h

 

#define ENOENT           2  /* No such file or directory                */

 

and I do not understand why btspp.h is not available for the playbook because btspp.h is not librerie CASCAD but qnx

Please use plain text.