Bluetooth Programming

Discussion in 'Wireless Networking' started by Deepika, Apr 14, 2009.

  1. Deepika

    Deepika Guest

    Hi
    I am trying to do bluetooth programming on Microsoft Visual C++ 6.0.
    I am using basic functions like WSALookupServiceBegin().
    i wrote the code like this
    WSAQUERYSET wsaq;
    wsaq.dwNameSpace = NS_BTH;

    The problem is, the compiler is not recognising NS_BTH and giving compile
    time error.
    I included the following sets of headers and lib

    #include <winsock>
    #include <winsock2>
    #include <bthdef>
    #include <BluetoothAPIs.h>
    #include <Ws2bth.h>
    #pragma comment(lib, "ws2_32.lib")

    The same goes with socket creation.
    Even if i am trying to create socket using the below code

    SOCKET client_socket = socket (AF_BT, SOCK_STREAM, BTHPROTO_RFCOMM);

    following error are coming up

    error C2065: 'NS_BTH' : undeclared identifier
    error C2065: 'AF_BT' : undeclared identifier
    error C2065: 'BTHPROTO_RFCOMM' : undeclared identifier

    I ahve included Platform SDK also and i have windows xp sp2
    i am not able to understand what else needs to be included.
    Is it because of Microsoft stack or some SDK is required?
     
    Deepika, Apr 14, 2009
    #1
    1. Advertising

  2. Deepika

    smlunatick Guest

    On Apr 14, 1:43 pm, Deepika <> wrote:
    >  Hi
    >  I am trying to do bluetooth programming on Microsoft Visual C++ 6.0.
    >  I am using basic functions like WSALookupServiceBegin().
    >  i wrote the code like this
    >  WSAQUERYSET wsaq;
    >  wsaq.dwNameSpace = NS_BTH;
    >
    >  The problem is, the compiler is not recognising NS_BTH and giving compile
    >  time error.
    > I included the following sets of headers and lib
    >
    >  #include <winsock>
    >  #include <winsock2>
    >  #include <bthdef>
    >  #include <BluetoothAPIs.h>
    >  #include <Ws2bth.h>
    >  #pragma comment(lib, "ws2_32.lib")
    >
    > The same goes with socket creation.
    >  Even if i am trying to create socket using the below code
    >
    >  SOCKET client_socket = socket (AF_BT, SOCK_STREAM, BTHPROTO_RFCOMM);
    >
    >  following error are coming up
    >
    >  error C2065: 'NS_BTH' : undeclared identifier
    >  error C2065: 'AF_BT' : undeclared identifier
    >  error C2065: 'BTHPROTO_RFCOMM' : undeclared identifier
    >
    > I ahve included Platform SDK also and i have windows xp sp2
    > i am not able to understand what else needs to be included.
    > Is it because of Microsoft stack or some SDK is required?


    There are several versions of a Bluetooth protocol stack. Several of
    these stacks are:

    Microsoft Windows Bluetooth (starting with SP2)
    Bluesoleil
    Widcomm / Broadcom
    Toshiba

    I am sure the are other version. Each have different features and
    Microsoft might still have not WHQL certified any Bluetooth.
     
    smlunatick, Apr 16, 2009
    #2
    1. Advertising

  3. Deepika

    Deepika Guest

    Actually i got installed latest platform SDk with which my program got
    compiled but i require some information.
    There are some blutooth API like BluetoothFindFirstDevice Function() and
    BluetoothFindFirstRadio() and many others which are deifned in Platform SDK
    for windows SP2. But there are some API's like BluetoothSdpGetElementData()
    and BluetoothSdpEnumAttributes() and related functions whose definition is
    although present in the header file but the required library "Bthprops.lib"
    is not available. it is available in windows vista SDK.
    I still do not have access to it.
    My doubt is that if we install windows vista SDK, will it cover everything
    defined in windows xpSP2 SDK.

    Also another thing. As you said there are various Bluetooth protocol stack.
    Basically i have to interact with the bluetooth device and send/ receive
    files. Can you please suggest which one can be the best for doing the related
    bluetooth programming?


    "smlunatick" wrote:

    > On Apr 14, 1:43 pm, Deepika <> wrote:
    > > Hi
    > > I am trying to do bluetooth programming on Microsoft Visual C++ 6.0.
    > > I am using basic functions like WSALookupServiceBegin().
    > > i wrote the code like this
    > > WSAQUERYSET wsaq;
    > > wsaq.dwNameSpace = NS_BTH;
    > >
    > > The problem is, the compiler is not recognising NS_BTH and giving compile
    > > time error.
    > > I included the following sets of headers and lib
    > >
    > > #include <winsock>
    > > #include <winsock2>
    > > #include <bthdef>
    > > #include <BluetoothAPIs.h>
    > > #include <Ws2bth.h>
    > > #pragma comment(lib, "ws2_32.lib")
    > >
    > > The same goes with socket creation.
    > > Even if i am trying to create socket using the below code
    > >
    > > SOCKET client_socket = socket (AF_BT, SOCK_STREAM, BTHPROTO_RFCOMM);
    > >
    > > following error are coming up
    > >
    > > error C2065: 'NS_BTH' : undeclared identifier
    > > error C2065: 'AF_BT' : undeclared identifier
    > > error C2065: 'BTHPROTO_RFCOMM' : undeclared identifier
    > >
    > > I ahve included Platform SDK also and i have windows xp sp2
    > > i am not able to understand what else needs to be included.
    > > Is it because of Microsoft stack or some SDK is required?

    >
    > There are several versions of a Bluetooth protocol stack. Several of
    > these stacks are:
    >
    > Microsoft Windows Bluetooth (starting with SP2)
    > Bluesoleil
    > Widcomm / Broadcom
    > Toshiba
    >
    > I am sure the are other version. Each have different features and
    > Microsoft might still have not WHQL certified any Bluetooth.
    >
     
    Deepika, Apr 17, 2009
    #3
  4. Deepika

    Pavel A. Guest

    If you need to transfer files, maybe the best way is to use
    high level app protocols such as object exchange (obex),
    rather than dive into socket level programing.

    About MSDN and 3rd party stacks... how about doing a little
    research, or asking your teachers in the school.

    Regards,
    -- pa


    Deepika wrote:
    > Actually i got installed latest platform SDk with which my program got
    > compiled but i require some information.
    > There are some blutooth API like BluetoothFindFirstDevice Function() and
    > BluetoothFindFirstRadio() and many others which are deifned in Platform SDK
    > for windows SP2. But there are some API's like BluetoothSdpGetElementData()
    > and BluetoothSdpEnumAttributes() and related functions whose definition is
    > although present in the header file but the required library "Bthprops.lib"
    > is not available. it is available in windows vista SDK.
    > I still do not have access to it.
    > My doubt is that if we install windows vista SDK, will it cover everything
    > defined in windows xpSP2 SDK.
    >
    > Also another thing. As you said there are various Bluetooth protocol stack.
    > Basically i have to interact with the bluetooth device and send/ receive
    > files. Can you please suggest which one can be the best for doing the related
    > bluetooth programming?
    >
    >
    > "smlunatick" wrote:
    >
    >> On Apr 14, 1:43 pm, Deepika <> wrote:
    >>> Hi
    >>> I am trying to do bluetooth programming on Microsoft Visual C++ 6.0.
    >>> I am using basic functions like WSALookupServiceBegin().
    >>> i wrote the code like this
    >>> WSAQUERYSET wsaq;
    >>> wsaq.dwNameSpace = NS_BTH;
    >>>
    >>> The problem is, the compiler is not recognising NS_BTH and giving compile
    >>> time error.
    >>> I included the following sets of headers and lib
    >>>
    >>> #include <winsock>
    >>> #include <winsock2>
    >>> #include <bthdef>
    >>> #include <BluetoothAPIs.h>
    >>> #include <Ws2bth.h>
    >>> #pragma comment(lib, "ws2_32.lib")
    >>>
    >>> The same goes with socket creation.
    >>> Even if i am trying to create socket using the below code
    >>>
    >>> SOCKET client_socket = socket (AF_BT, SOCK_STREAM, BTHPROTO_RFCOMM);
    >>>
    >>> following error are coming up
    >>>
    >>> error C2065: 'NS_BTH' : undeclared identifier
    >>> error C2065: 'AF_BT' : undeclared identifier
    >>> error C2065: 'BTHPROTO_RFCOMM' : undeclared identifier
    >>>
    >>> I ahve included Platform SDK also and i have windows xp sp2
    >>> i am not able to understand what else needs to be included.
    >>> Is it because of Microsoft stack or some SDK is required?

    >> There are several versions of a Bluetooth protocol stack. Several of
    >> these stacks are:
    >>
    >> Microsoft Windows Bluetooth (starting with SP2)
    >> Bluesoleil
    >> Widcomm / Broadcom
    >> Toshiba
    >>
    >> I am sure the are other version. Each have different features and
    >> Microsoft might still have not WHQL certified any Bluetooth.
     
    Pavel A., Apr 20, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Silverstrand
    Replies:
    0
    Views:
    1,141
    Silverstrand
    Sep 28, 2005
  2. =?Utf-8?B?U3Byb3h0b24=?=

    Logitech Bluetooth headset says I have wrong Bluetooth Stack

    =?Utf-8?B?U3Byb3h0b24=?=, Sep 4, 2005, in forum: Wireless Networking
    Replies:
    0
    Views:
    901
    =?Utf-8?B?U3Byb3h0b24=?=
    Sep 4, 2005
  3. =?Utf-8?B?ZmlmbzYxMQ==?=

    how to add a bluetooth device on a bluetooth laptop

    =?Utf-8?B?ZmlmbzYxMQ==?=, Jul 4, 2006, in forum: Wireless Networking
    Replies:
    2
    Views:
    3,520
    Dave B.
    Jul 5, 2006
  4. John
    Replies:
    5
    Views:
    954
    Walter Mautner
    Jul 6, 2006
  5. Chris Mayhew

    MS Bluetooth dongle + Bluetooth Network

    Chris Mayhew, Dec 28, 2004, in forum: NZ Computing
    Replies:
    6
    Views:
    534
    Mauricio Freitas
    Dec 28, 2004
Loading...

Share This Page