15,918,808 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by xiaboyang (Top 3 by date)
xiaboyang
17-Apr-11 10:15am
View
I used "Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Bthchat" Sample Code,bluetooth spp service still does not start.
//SDP record generated by bthnscreate.exe
BYTE rgbSdpRecord[] = {
0x35, 0x4d, 0x09, 0x00, 0x01, 0x35, 0x11, 0x1c,
0x29, 0xf9, 0xc0, 0xfd, 0xbb, 0x6e, 0x47, 0x97,
0x9f, 0xa9, 0x3e, 0xc9, 0xa8, 0x54, 0x29, 0x0c,
0x09, 0x00, 0x04, 0x35, 0x0c, 0x35, 0x03, 0x19,
0x01, 0x00, 0x35, 0x05, 0x19, 0x00, 0x03, 0x08,
0x1a, 0x09, 0x00, 0x06, 0x35, 0x09, 0x09, 0x65,
0x6e, 0x09, 0x00, 0x6a, 0x09, 0x01, 0x00, 0x09,
0x00, 0x09, 0x35, 0x08, 0x35, 0x06, 0x19, 0x11,
0x05, 0x09, 0x01, 0x00, 0x09, 0x01, 0x00, 0x25,
0x06, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c
};
//SDP record size constant returned by bthnscreate.exe
#define SDP_RECORD_SIZE 0x0000004f
#define SDP_CHANNEL_OFFSET 40
int BthUtils::RegisterService(BYTE *rgbSdpRecord, int cSdpRecord, int iChannelOffset, UCHAR channel)
{
ULONG recordHandle = 0;
struct bigBlob
{
BTHNS_SETBLOB b;
}*pBigBlob;
pBigBlob = (bigBlob *)malloc(sizeof(struct bigBlob)+cSdpRecord);
ULONG ulSdpVersion = BTH_SDP_VERSION;
pBigBlob->b.pRecordHandle = &recordHandle;
pBigBlob->b.pSdpVersion = &ulSdpVersion;
pBigBlob->b.fSecurity = 0;
pBigBlob->b.fOptions = 0;
pBigBlob->b.ulRecordLength = cSdpRecord;
memcpy (pBigBlob->b.pRecord, rgbSdpRecord, cSdpRecord);
pBigBlob->b.pRecord[iChannelOffset] = (unsigned char)channel;
BLOB blob;
blob.cbSize = sizeof(BTHNS_SETBLOB) + cSdpRecord - 1;
blob.pBlobData = (PBYTE) pBigBlob;
WSAQUERYSET Service;
memset (&Service, 0, sizeof(Service));
Service.dwSize = sizeof(Service);
Service.lpBlob = &blob;
Service.dwNameSpace = NS_BTH;
if (WSASetService(&Service,RNRSERVICE_REGISTER,0) == SOCKET_ERROR)
{
free(pBigBlob);
return WSAGetLastError();
}
else
{
free(pBigBlob);
return 0;
}
}
xiaboyang
17-Apr-11 10:09am
View
Thank you for your reply.
xiaboyang
17-Apr-11 5:52am
View
Forgive me, my English is very bad, so did not clear. It is in Chinese:这段代码不起作用,SPP服务没有能够正常开启.