When I wrote my first article on the Widcomm Bluetooth stack, I promised to publish a .NET CF 2.0 library that would abstract the enumeration features of the Widcomm and Microsoft stacks under a unique API. My life became very busy since then, especially when I got a contract for integrating the new version of a mobile GPS application on the Windows Mobile environment. This has been a very interesting challenge that has put all my knowledge through its paces and made me learn a lot: powering off the device, integrating DirectDraw with screen rotations, popping up the phone when a call comes through and the screen is in DirectDraw mode, handling bizzare GPS behaviors, exotic device keys (think HTC 3300)... The works!
Requests for the Bluetooth code and article have not stopped, though so I decided to post links to the unedited versions of the C++ and C# sources. Before I get to fully comment the code and write a proper article, what you see is what you get. The sources are divided into 3 ZIP files:
Bluetooth.zip - Contains a sample C# WM5 application that enumerates devices and services. Also contains the Primeworks.Bluetooth class library.
msbts.zip - The low-level Microsoft Bluetooth stack wrapper.
wcbts.zip - The low-level Widcomm Bluetooth stack wrapper.
Now, I can take my time and write the full length article. All your comments and suggestions are welcome.
VC++ Directories in Visual Studio 2010
1 day ago


30 comments:
You are the man! The community loves you...
THANK YOU!!! :D
Joao,
You have done a lot of work on this - good work.
I'm an experienced software engineer but I have never worked with C/C++. As a result I'm stumbling around a bit with setting this up.
As a start I opened the Widcomm Stack wrapper project, wcbs, in Visual Studio 2005. To make life easier in terms of paths etc I copied the header, library and DLL files from the WIDCOMM BTW-CE SDK directory.
On compiling I receive an "unresolved external symbol" error as follows. Can you advise what I am doing wrong? The files that I added are all in the base project directory.
Thanks,
Eric
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum CSppServer::SPP_SERVER_RETURN_CODE __cdecl CSppServer::CreateConnection(wchar_t *)" (__imp_?CreateConnection@CSppServer@@QAA?AW4SPP_SERVER_RETURN_CODE@1@PA_W@Z) referenced in function SppServerStart wcbts.obj
You must install the Widcomm SDK for your particular platform. Also, these projects were compiled with eVC4 (free download from Microsoft), not VS 2005.
Hello Joao, and thank you very much for your work.
I am trying to test your code samples but I haven´t been able to run the Enumerate sample because I obtain an exception because It can´t find the wcbts.dll library in execution time.
I have installed WIDCOMM SDK and I have converted and compiled your projects to Visual Studio 2005, however, I dont know why I obtain that error because I have included in the debug(bin) folder that dll. I´ve tried putting in the system32 folder but it doesn´t run either.
The exception is launchd in the WidcommAPI.WidcommStackPresent()method. I have revised that method and modified using a .lib instead of a .dll (because I only have a lib version of the library) but I have the same result.
Do you know what I am doing wrong?
Thanyou in advance :D
Jesus
Hello,
Thanks for this amazing code, its really usefull. I have two small questions:
1- I try to compile both wrappers in VS2005 but i cant. Is it possible? or you do it in eVC4 because VS2005 can create this type of library?
2- When think you can have the final release of the article? :)
thanks a lot.
You should be able to compile the eVC4 project under VS 2005. My advice is to create a new project with the same properties.
Hello Joao,
i try to create a new project and i have the same problem like eric post. I not have enought knowledge in compilation options and i dont know what to do. I read an article with a problem similar but the compilation options are distinc.
Article ->http://www.codeguru.com/Cpp/Cpp/cpp_managed/interop/article.php/c6867/
Solution to compile in VS->http://www.codeguru.com/cpp/cpp/cpp_managed/interop/comments.php/c6867/?thread=10025
Maybe any can help with this problem
Sorry link not post correctly
Article:
http://www.codeguru.com/Cpp/
Cpp/cpp_managed/interop/
article.php/c6867/
Solution to compile in VS:
http://www.codeguru.com/cpp/
cpp/cpp_managed/interop/
comments.php/c6867/?thread=10025
Hello
I got a look to widcomm wrapper... it seems a good work.
I need to reset the bluetooth radio.
Is it possible or does it will be possible to switch off-on the bluetoot radio?
Thank you
Roberto
Eric said...
Joao,
On compiling I receive an "unresolved external symbol" error as follows. Can you advise what I am doing wrong? The files that I added are all in the base project directory.
----------
Hello, did you checked the wchar_t consistency?
see
http://nativespeech.blogspot.com/2007/06/inconsistent-wchart-representation.html
regards
- z
A lot of bluetooth sources are there. Infact a great blog on revolutionising wireless technology- Bluetooth. Those were of a great help.
Thanks!!
Hello Joao,
First, I apologize for revising this topic.
I'd like to ask if anyone has played with CL2CapConn::OnCongestionStatus() on WidComm SDK 5.1.0, which vanishes in version 6.1.0? If so, what is your experience with that API? I am currently receiving only one congestion=TRUE notification, but nothing else after that.
Also, CBtIf::SwitchRole() is also gone in 6.1.0? Any work-around?
I'm using VC2005, Widcomm 5.1.0 on XP.
Thank you for any comment.
João,
This is an incredible piece of work. I was easily able to port and compile your wrappers from eVC4 projects to VS2005, and to compile for both Pocket PC 2003 and WM5.
I was also able to easily compile your C# library and run your sample.
I just want to say - you've saved me a ton of work. This is absolutely incredible - thank you!
I did have a question - there's some interest in having this work incorporated into the 32Feet.Net Compact Framework Bluetooth library. Would you be interested in allowing your work to be so incorporated?
I would be delighted to add this code to 32feet, but it is still mising lots of stuff. Time keeps slipping through my fingers like sand and this code is shamefully (for me) abandoned... So please take it and do whatever you need to do with it!
João,
That's great to hear - It's something I'd love to work on in my spare time (not that there's much of it, but.. I need interesting projects to keep me sane).
I'll keep you updated!
Thanks for all ;)
I want see rssi value. How i see it ?
Hi,
I will programm a bluetooth communication with the microcontroller (with bleutoth module)and a PDA.
is this DLL for free use. how can I use it. what is primworks DLL? is it free for use too?
its my first application with bluetooth and Framework. (VS 2005) windows Mobile 6
Thanks
Olá João,
Pelo que entendi esse código localiza todas as conexões ativas de bluetooth não ?
Pos bem, eu compilei o código com o VS 2005 e instalei no pocket-pc da Hp IPAQ hw6945 e ao selecionar a opção "Enumerate Devices", liguei o bluetooth do meu celular ("telemovel" ) para verificar se o programa o localizaria mas isso não aconteceu.
Tú tens alguma idéia do ocorrido ?
Abraços.
I hav the some Problem As jesus but with other line MicrosoftAPI.CreateStack:
namespace Primeworks.Bluetooth.Microsoft
{......
m_pStack = MicrosoftAPI.CreateStack();
.......
this is rhe error:
Der Einstiegspunkt 'CreateStack' in der PInvoke-DLL 'msbts.dll' wurde nicht gefunden.
'CreateStack' in PInvoke-DLL msbts.dll not found!!!!!!
I would be delighted to add this code to 32feet, but it is still mising lots of stuff. Time keeps slipping through my fingers like sand and this code is shamefully (for me) abandoned... So please take it and do whatever you need to do with it!
Make sure the msbts.dll is on the DLL search path.
Thanks for the Answer. Itry to build the msbts with VS2005 I receive linker extern errors:
Fehler 8 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "WSALookupServiceEnd" in Funktion ""protected: unsigned long __cdecl CMicrosoftStack::DiscoverServices(unsigned __int64,struct _GUID *)" (?DiscoverServices@CMicrosoftStack@@IAAK_KPAU_GUID@@@Z)". MicrosoftStack.obj
Fehler 9 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "WSALookupServiceNextW" in Funktion ""protected: unsigned long __cdecl CMicrosoftStack::DiscoverServices(unsigned __int64,struct _GUID *)" (?DiscoverServices@CMicrosoftStack@@IAAK_KPAU_GUID@@@Z)". MicrosoftStack.obj
Fehler 10 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "WSAGetLastError" in Funktion ""protected: unsigned long __cdecl CMicrosoftStack::DiscoverServices(unsigned __int64,struct _GUID *)" (?DiscoverServices@CMicrosoftStack@@IAAK_KPAU_GUID@@@Z)". MicrosoftStack.obj
Fehler 11 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "WSALookupServiceBeginW" in Funktion ""protected: unsigned long __cdecl CMicrosoftStack::DiscoverServices(unsigned __int64,struct _GUID *)" (?DiscoverServices@CMicrosoftStack@@IAAK_KPAU_GUID@@@Z)". MicrosoftStack.obj
Fehler 12 error LNK2001: Nicht aufgelöstes externes Symbol "RFCOMM_PROTOCOL_UUID". NodeData.obj
any Idee. Itested some things from Internet but no result?
Eric how are you solved your Problem.
I am getting the following error
Can't find PInvoke DLL 'wcbts.dll' but I have already copied the file the directory where the .exe is stored.
Is there a way to get local device address with this wrapper?? If not, how can I do that?
When Wow Gold wolf finally found the wow gold cheap hole in the chimney he crawled cheap wow gold down and KERSPLASH right into that kettle of water and that was cheapest wow gold the end of his troubles with the big bad wolf.
game4power.
The next day the Buy Wow Goldlittle pig invited hisbuy gold wow mother over . She said "You see it is just as mygamegoldI told you. The way to get along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he buy cheap wow gold learned that lesson. And he just k4gold lived happily ever after!.
buy wow goldAsesor ProfessionalUruguayProfessionalbuy wow goldOfficeLinksNotice
A slim, wide-eyed mygamegoldwoman almost human in virbanksfeatures eyed agamegold the pair. Her nose was sharp, but very elegant. She had tbcgold a pale, trade4gamebeautiful face the color of ivory, and veryge for hair she wore a wondrous mane of downy feathers. Her gown fluttered as she walked—on two delicate worldofgolds but still sharply-taloned feet. “Awake, awake you are,” she said with a pvp365 slight frown. “You should rest, rest.” Krasus bowed to her. “I am ezmmorpg grateful for your ighey hospitality, mistress, but I am well enough to continue on9a9z now.” She cocked her head as a bird might, giving the mageltk365 a reproving look. “No, no…too soon, toogold4guild soon. Please, sit.” The duo looked around u4game and discovered that two chairs, made in the same ready4game fashion as the nest, waited behind happygolds them. Malfurion waited for Krasus, who finally nodded and sat.
When the Wow Gold wolf finally found the Buy Wow Goldhole in the chimney he crawled wow gold cheap down and KERSPLASH right into that kettle of water and that was cheapest wow gold the end of his troubles with the big bad wolf.
game4power,buy cheap wow goldThe next day the cheap wow gold buy gold wow little pig invited his mother over . She said "You see it is just as I told you. The way to wow goldget along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he cheapest wow gold learned that lesson. And he just lived happily ever after!
A slim, wide-eyed mygamegoldwoman almost human in virbanksfeatures eyed agamegold the pair. Her nose was sharp, but very elegant. She had tbcgold a pale, trade4gamebeautiful face the color of ivory, and veryge for hair she wore a wondrous mane of downy feathers. Her gown fluttered as she walked—on two delicate worldofgolds but still sharply-taloned feet. “Awake, awake you are,” she said with a pvp365 slight frown. “You should rest, rest.” Krasus bowed to her. “I am ezmmorpg grateful for your ighey hospitality, mistress, but I am well enough to continue on9a9z now.” She cocked her head as a bird might, giving the mageltk365 a reproving look. “No, no…too soon, toogold4guild soon. Please, sit.” The duo looked around u4game and discovered that two chairs, made in the same ready4game fashion as the nest, waited behind happygolds them. Malfurion waited for Krasus, who finally nodded and sat.
brogameswagvaultgoldsoonoforuigxethsale
Post a Comment