Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: Raj on January 05, 2009, 08:56:09 AM

Title: Only Moile Device found.
Post by: Raj on January 05, 2009, 08:56:09 AM
Hi Mike,

Is there any way during discovery that only mobile devices should be listed ?


Title: Re: Only Moile Device found.
Post by: Mike Petrichenko on January 05, 2009, 11:38:31 AM
Good day!

Filter founded devices by its COD (Class Of Device)
Title: Re: Only Moile Device found.
Post by: Raj on January 13, 2009, 08:00:14 AM
I am doing that, but I don't know whether every mobile have same COD.

Please let me know the COD for the mobiles, may be I am using wrong COD
Title: Re: Only Moile Device found.
Post by: Mike Petrichenko on January 13, 2009, 10:00:33 AM
((COD & COD_MAJOR_MASK) >> COD_MAJOR_BIT_OFFSET == COD_MAJOR_PHONE) && (((COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_SMART) || ((COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_CELLULAR))
Title: Re: Only Moile Device found.
Post by: Raj on January 13, 2009, 12:23:50 PM
in Discoverycompleted Event I am getting this

e.Devices.ClassOfDevice(Radio) -- that us uint.

Sorry, but I did not get your answer.


Title: Re: Only Moile Device found.
Post by: Mike Petrichenko on January 13, 2009, 04:49:35 PM
UInt32 COD = e.Devices.ClassOfDevice(Radio);
if (((COD & COD_MAJOR_MASK) >> COD_MAJOR_BIT_OFFSET == COD_MAJOR_PHONE) && (((COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_SMART) || ((COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_CELLULAR)))
{
   // It is mobile phone
}
else
{
  // It is not mobile phone
}
Title: Re: Only Moile Device found.
Post by: Raj on January 14, 2009, 06:28:36 AM
Hi Mike,

I have set the Some of Variables as you have given some COD in your Source Code.

UInt32 COD_MAJOR_BIT_OFFSET = 8 * 1;
UInt32 COD_MAJOR_MASK = 0x001F00;
UInt32 COD_MAJOR_PHONE = 0x02;
UInt32 COD_MINOR_MASK = 0x0000FC;
UInt32 COD_MINOR_BIT_OFFSET = 2;
UInt32 COD_PHONE_MINOR_SMART = 0x03;
UInt32 COD_PHONE_MINOR_CELLULAR = 0x01;


But when I am compiling my Application, I am getting the compilation error like,

(COD & COD_MAJOR_MASK) >> COD_MAJOR_BIT_OFFSET ----- Operator '>>' cannot be applied to operands of type 'uint' and 'uint'
(COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET -----  Operator '>>' cannot be applied to operands of type 'uint' and 'uint'
(COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET -----  Operator '>>' cannot be applied to operands of type 'uint' and 'uint'




Below is my whole Code.

for (int i = 0; i < e.Devices.Count; i++)
                        {
                            UInt32 COD_MAJOR_BIT_OFFSET = 8 * 1;
                            UInt32 COD_MAJOR_MASK = 0x001F00;
                            UInt32 COD_MAJOR_PHONE = 0x02;
                            UInt32 COD_MINOR_MASK = 0x0000FC;
                            UInt32 COD_MINOR_BIT_OFFSET = 2;
                            UInt32 COD_PHONE_MINOR_SMART = 0x03;
                            UInt32 COD_PHONE_MINOR_CELLULAR = 0x01;
                           
                           
                            UInt32 COD = e.Devices.ClassOfDevice(Radio);

                            if (((COD & COD_MAJOR_MASK) >> COD_MAJOR_BIT_OFFSET == COD_MAJOR_PHONE) && (((COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_SMART) || ((COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_CELLULAR)))
                            {
                                // It is mobile phone
                            }
                            else
                            {
                                // It is not mobile phone
                            }
                           
                        }



Please help me out from this problem

thanks
Raj
Title: Re: Only Moile Device found.
Post by: Mike Petrichenko on January 14, 2009, 12:16:46 PM
Good day!

Well. Have you ever heard about type cast?

for (int i = 0; i < e.Devices.Count; i++)
                        {
                            UInt32 COD_MAJOR_BIT_OFFSET = 8 * 1;
                            UInt32 COD_MAJOR_MASK = 0x001F00;
                            UInt32 COD_MAJOR_PHONE = 0x02;
                            UInt32 COD_MINOR_MASK = 0x0000FC;
                            UInt32 COD_MINOR_BIT_OFFSET = 2;
                            UInt32 COD_PHONE_MINOR_SMART = 0x03;
                            UInt32 COD_PHONE_MINOR_CELLULAR = 0x01;
                           
                           
                            UInt32 COD = e.Devices.ClassOfDevice(Radio);

                            if (((COD & COD_MAJOR_MASK) >> (Byte)COD_MAJOR_BIT_OFFSET == COD_MAJOR_PHONE) && (((COD & COD_MINOR_MASK) >> (Byte)COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_SMART) || ((COD & COD_MINOR_MASK) >> (Byte)COD_MINOR_BIT_OFFSET == COD_PHONE_MINOR_CELLULAR)))
{
  // It is mobile phone
}
else
{
  // It is not mobile phone
}
}