Author Topic: Only Moile Device found.  (Read 18230 times)

Raj

  • Guest
Only Moile Device found.
« on: January 05, 2009, 08:56:09 AM »
Hi Mike,

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



Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Only Moile Device found.
« Reply #1 on: January 05, 2009, 11:38:31 AM »
Good day!

Filter founded devices by its COD (Class Of Device)

Raj

  • Guest
Re: Only Moile Device found.
« Reply #2 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

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Only Moile Device found.
« Reply #3 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))

Raj

  • Guest
Re: Only Moile Device found.
« Reply #4 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.



Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Only Moile Device found.
« Reply #5 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
}

Raj

  • Guest
Re: Only Moile Device found.
« Reply #6 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

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Only Moile Device found.
« Reply #7 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
}
}

 

Sitemap 1 2 3 4 5 6 7