Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. How to convert BD_ADDR to BT_ADDR?

How to convert BD_ADDR to BT_ADDR?

Scheduled Pinned Locked Moved Mobile
comtutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eli15021979
    wrote on last edited by
    #1

    Hi, In order to create a virtual COM port(for BlueTooth Comunication), I need the address of the BlueTooth device. I know the BD_ADDR,but i must convert it to BT_ADDR if i want to use the RegisterDevice() function. anyone? Regards, Eli

    I 1 Reply Last reply
    0
    • E eli15021979

      Hi, In order to create a virtual COM port(for BlueTooth Comunication), I need the address of the BlueTooth device. I know the BD_ADDR,but i must convert it to BT_ADDR if i want to use the RegisterDevice() function. anyone? Regards, Eli

      I Offline
      I Offline
      illidan99
      wrote on last edited by
      #2

      First, you must know the bluetooth stack that your device has. RegisterDevice() is only supported by Microsoft Bluetooth stack. For example IPAQs uses Windcomm Stack and "RegisterDevice()" doesn't work. So if it's not microsoft Stack, you must buy the correct bluetooth Stack SDK for development. I made a virtual serial port without "RegisterDevice()" in my IPAQ. Simply uses the normal Open port, close port , read port and write port like it'was a normal serial port. I use the COM8 in my IPAQ hx4700 and it's works. When I open the port, appears a Window Dialog (made by the own Operative System) for choose the bluetooh device to connect. If you want to do this in your own app you must use a bluetooth Stack SDK for development in your device. Regards. Regards, Javier

      E 1 Reply Last reply
      0
      • I illidan99

        First, you must know the bluetooth stack that your device has. RegisterDevice() is only supported by Microsoft Bluetooth stack. For example IPAQs uses Windcomm Stack and "RegisterDevice()" doesn't work. So if it's not microsoft Stack, you must buy the correct bluetooth Stack SDK for development. I made a virtual serial port without "RegisterDevice()" in my IPAQ. Simply uses the normal Open port, close port , read port and write port like it'was a normal serial port. I use the COM8 in my IPAQ hx4700 and it's works. When I open the port, appears a Window Dialog (made by the own Operative System) for choose the bluetooh device to connect. If you want to do this in your own app you must use a bluetooth Stack SDK for development in your device. Regards. Regards, Javier

        E Offline
        E Offline
        eli15021979
        wrote on last edited by
        #3

        Hi Javier, First,I really appriciate your detailed answer. just today i saw that iPaq uses the widcom stack and not the MS stack(is that the reason i can't use WSALookupServiceBrgin() etc.)? anyway,are you using COM8 for both incoming and outgoing massages(i use also the ipaq h2210 and it use COM5 for input and COM8 for output) Best regards,and thanx,again Eli

        I 1 Reply Last reply
        0
        • E eli15021979

          Hi Javier, First,I really appriciate your detailed answer. just today i saw that iPaq uses the widcom stack and not the MS stack(is that the reason i can't use WSALookupServiceBrgin() etc.)? anyway,are you using COM8 for both incoming and outgoing massages(i use also the ipaq h2210 and it use COM5 for input and COM8 for output) Best regards,and thanx,again Eli

          I Offline
          I Offline
          illidan99
          wrote on last edited by
          #4

          If you have a IPAQ (uses windcom stack) then you cannot use RegisterDevice. About " WSALookupServiceBrgin()" I dont know, surely not, but you can ask in the microsoft Pocket PC 's developer: http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.pocketpc.developer[^] Yes, I use the COM8 for read and write. I saw the Bluetooth config and I saw COM5 for input too, but using COM8 both works. Simply try a sample serial com code (easy to find it, in this web there is something), using COM8 and it must work. If not, try another COM. Regards. Regards, Javier

          E 1 Reply Last reply
          0
          • I illidan99

            If you have a IPAQ (uses windcom stack) then you cannot use RegisterDevice. About " WSALookupServiceBrgin()" I dont know, surely not, but you can ask in the microsoft Pocket PC 's developer: http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.pocketpc.developer[^] Yes, I use the COM8 for read and write. I saw the Bluetooth config and I saw COM5 for input too, but using COM8 both works. Simply try a sample serial com code (easy to find it, in this web there is something), using COM8 and it must work. If not, try another COM. Regards. Regards, Javier

            E Offline
            E Offline
            eli15021979
            wrote on last edited by
            #5

            Hi Javier, I tried to open COM8,but when i open this port,and choose the remote device, it automaticly create ActiveSync SerialPort connection(instead of generic serial connection). Here is my code: //============================================================================ bool PDA_BlueTooth::OutputPortOpening() { DWORD dwError; DCB PortDCB; COMMTIMEOUTS CommTimeouts; // Open the serial port. hOUTPUT = CreateFile(TEXT("COM8:"),GENERIC_READ | GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL); // if it fails to open the port, return FALSE. if ( hOUTPUT == INVALID_HANDLE_VALUE ) { // Could not open the port. AfxMessageBox (TEXT("Unable to open BlueTooth Output Port!!!")); dwError = GetLastError (); return false; } ::SetupComm(hOUTPUT,4000, 2048); PortDCB.DCBlength = sizeof (DCB); // Get the default port setting information. GetCommState (hOUTPUT, &PortDCB); // Change the DCB structure settings. PortDCB.BaudRate = 115200; // Current CANgine Baudrate PortDCB.fBinary = TRUE; // Binary mode; no EOF check PortDCB.fParity = FALSE; // Disable parity checking PortDCB.fOutxCtsFlow = FALSE; // No CTS output flow control PortDCB.fOutxDsrFlow = FALSE; // No DSR output flow control PortDCB.fDtrControl = DTR_CONTROL_ENABLE; // DTR flow control type PortDCB.fDsrSensitivity = FALSE; // DSR sensitivity PortDCB.fTXContinueOnXoff = TRUE; // XOFF continues Tx PortDCB.fOutX = FALSE; // No XON/XOFF out flow control PortDCB.fInX = FALSE; // No XON/XOFF in flow control PortDCB.fErrorChar = FALSE; // Disable error replacement PortDCB.fNull = FALSE; // Disable null stripping PortDCB.fRtsControl = RTS_CONTROL_ENABLE; // RTS flow control PortDCB.fAbortOnError = FALSE; // Do not abort reads/writes on // error PortDCB.ByteSize = 8; // Number of bits/byte, 4-8 PortDCB.Parity = NOPARITY; // 0-4=no,odd,even,mark,space PortDCB.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2 // Configure the port according to the specifications of the DCB // structure. if (!SetCommState (hOUTPUT, &PortDCB)) { // Could not create the read thread. AfxMessageBox (TEXT("Unable to configure BlueTooth Out

            A 1 Reply Last reply
            0
            • E eli15021979

              Hi Javier, I tried to open COM8,but when i open this port,and choose the remote device, it automaticly create ActiveSync SerialPort connection(instead of generic serial connection). Here is my code: //============================================================================ bool PDA_BlueTooth::OutputPortOpening() { DWORD dwError; DCB PortDCB; COMMTIMEOUTS CommTimeouts; // Open the serial port. hOUTPUT = CreateFile(TEXT("COM8:"),GENERIC_READ | GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL); // if it fails to open the port, return FALSE. if ( hOUTPUT == INVALID_HANDLE_VALUE ) { // Could not open the port. AfxMessageBox (TEXT("Unable to open BlueTooth Output Port!!!")); dwError = GetLastError (); return false; } ::SetupComm(hOUTPUT,4000, 2048); PortDCB.DCBlength = sizeof (DCB); // Get the default port setting information. GetCommState (hOUTPUT, &PortDCB); // Change the DCB structure settings. PortDCB.BaudRate = 115200; // Current CANgine Baudrate PortDCB.fBinary = TRUE; // Binary mode; no EOF check PortDCB.fParity = FALSE; // Disable parity checking PortDCB.fOutxCtsFlow = FALSE; // No CTS output flow control PortDCB.fOutxDsrFlow = FALSE; // No DSR output flow control PortDCB.fDtrControl = DTR_CONTROL_ENABLE; // DTR flow control type PortDCB.fDsrSensitivity = FALSE; // DSR sensitivity PortDCB.fTXContinueOnXoff = TRUE; // XOFF continues Tx PortDCB.fOutX = FALSE; // No XON/XOFF out flow control PortDCB.fInX = FALSE; // No XON/XOFF in flow control PortDCB.fErrorChar = FALSE; // Disable error replacement PortDCB.fNull = FALSE; // Disable null stripping PortDCB.fRtsControl = RTS_CONTROL_ENABLE; // RTS flow control PortDCB.fAbortOnError = FALSE; // Do not abort reads/writes on // error PortDCB.ByteSize = 8; // Number of bits/byte, 4-8 PortDCB.Parity = NOPARITY; // 0-4=no,odd,even,mark,space PortDCB.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2 // Configure the port according to the specifications of the DCB // structure. if (!SetCommState (hOUTPUT, &PortDCB)) { // Could not create the read thread. AfxMessageBox (TEXT("Unable to configure BlueTooth Out

              A Offline
              A Offline
              AKSIVAKUMAR
              wrote on last edited by
              #6

              Hi, i want to develop application using eVC++ 4.0 for windows ce 5.0 device. Actually, i want to get the phoone book data(such as call hsitory list, outgoing, received calls, missed calls, address book, sms message list ) from nokia phone to my pocket pc over bluetooh conenction. i am refering http://www.palowireless.com/infotooth/tutorial.asp for BT developement. i am able to establish BT connection between two BT devices successfully. what profile do i need to use for this task ? do i need to use AT command over serial profile, or object push profile or syncML or IrMC standard ? please do let me know if you have any idea about it. please suggest me in detail. regards, aks

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups