Wireless Communication Library Support Forum
Frameworks => Bluetooth Framework => Topic started 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 ?
-
Good day!
Filter founded devices by its COD (Class Of Device)
-
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
-
((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))
-
in Discoverycompleted Event I am getting this
e.Devices.ClassOfDevice(Radio) -- that us uint.
Sorry, but I did not get your answer.
-
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
}
-
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
-
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
}
}