Problems with Bluetooth Connection

Hello! I have a smartphone Qtek 8300 and Bluetooth pulse oximeter Nonin 4100 (http://nonin.com/products/oem/4100.asp). I'm a novice in Communication programming. My task is to write application that connects to this pulse oximeter and recieves some data. I have specifications of Nonin 4100 (http://www.nonin.com/documents/4100%20Specifications.pdf). As I read in this document I must use SerialPort for working with this pulse oximeter. But some people advice me to use WinSock but I don't know C++. I have some code on C++ and I don't know what can I do... :(

BYTE buf[125];

if( (buf[0]!=1)||(buf[5]!=1)||(buf[10]!=1)||(buf[110]!=1)||(buf[115]!=1)||(buf[120]!=1) )
{
// error
return;
}
TUint16 HR = buf[3];
TUint8 x = buf[ 8];
if( x&1 ) HR = TUint16(HR|128);
if( x&2 ) HR = TUint16(HR|256);

As I don't know C++ I think I can't write this app with WinSock. But I don't know how to write this application with SerialPort support. I'm sorry for my question but I must write this application. Thank you...



Answer this question

Problems with Bluetooth Connection

  • Anaray

    I see no questions in your post, just list of something you don’t know. Please ask specific question. Also see this, items 7 and 15.

    http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html



  • cashrolls2

    Sorry.. I see.. Thank you for the article but I want to know how to recieve byte information and separate one data from another. Also I want to know how I can understand and translate into C#:

    BYTE buf[125];

            if( (buf[0]!=1)||(buf[5]!=1)||(buf[10]!=1)||(buf[110]!=1)||(buf[115]!=1)||(buf[120]!=1) )
            {
                    // error 
                    return;
            }
            TUint16 HR = buf[3];
            TUint8 x = bufMusic;
            if( x&1 ) HR = TUint16(HR|128);
            if( x&2 ) HR = TUint16(HR|256);


  • LynnOoi

    I can't understand what it is:

    if( x&1 ) HR = TUint16(HR|128);
    if( x&2 ) HR = TUint16(HR|256);

    Please, help me.


  • Pete Orologas

    I guess it'd be

    if( (x & 1) != 0 )
    HR = Convert.ToUInt16(HR | 128);

    if( (x & 2) != 0)
    HR = Convert.ToUInt16(HR | 256);



  • treckamerica

    Sorry. I forgot to explain the question... I want to ask for help because I don't know how to write this application. Maybe because I am 16 years old and have no experience in serial programming.... And there are no books in Russia that I can read about it. And books in English cost a lot of money... I need some examples of programming, some pieces of advice... And I don't know how to write this application.

    Question: please, tell me how to write this application Step-by-step. Applying specifications of my device (Nonin). I am so sorry for asking you but I have no choice. Thank you very much!


  • worldhello

    No one will guide you step-by-step. This is essentially doing the work for you. You need to learn and this is a perfect chance to do that.

    Serial port programming can be gleaned from the Christian Forsberg's article on MSDN. It addresses Compact Framework 1.0. In 2.0 there is in-built Serial port support. The interface and the approach is not too much different.

    For the bluetooth sockets, if your phone has Microsoft BT stack (if it does not have a "Bluetooth Explorer") you can get managed BT socket library from here
    There are some samples included. Good luck



  • Problems with Bluetooth Connection