08-09-2012 02:57 PM
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.
08-10-2012 11:51 AM - edited 08-10-2012 11:54 AM
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
08-14-2012 09:03 AM
I found the service from EOK
for more information:
http://www.qnx.com/developers/docs/6.4.1/neutrino/
so I know bt_spp_init () not work, because it not Returne EOK
Would somebody have an idea for a successful initialization ?
08-17-2012 10:55 AM
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?
08-20-2012 08:13 AM
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?
08-20-2012 08:39 AM
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_
Hohum!
08-21-2012 12:20 PM
08-23-2012 06:34 AM
Thanks, I guess that explains that one ![]()
08-24-2012 01:34 PM
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.
08-25-2012 05:53 PM
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