ok,i am an open source guy but the following code is written by me and i would like credits.I have spend hours(and days) to figure it out how to accomplise it.Be warned:It not optimized and should not be used if you are developing serious applications.It works for me though.
Its in C#,dont have VB.NET at the moment but i will maybe convert in the future.(and its easier to convert it).Here it goes:
string hexa = String.Format("{0:x2}", Device.ClassOfDevice(Radio));
string MajDevCod = hexa.Substring(3, 1);
string MinDevCod =RightString(hexa, 3);
//5a0204 Actuall hex value
switch (MajDevCod)
{
case "1"://Computer (desktop,notebook, PDA, organizers etc )
MajDescription = "Computer";
deviceType = 3;
switch (MinDevCod)
{
case "100":
MinDescription = "Uncategorized";
break;
case "104":
MinDescription = "Desktop workstation";
break;
case "108":
MinDescription = "Server-class computer";
break;
case "10C":
MinDescription = "Laptop";
break;
case "110":
MinDescription = "Handheld PC/PDA";
break;
case "114":
MinDescription = "Palm sized PC/PDA";
break;
case "118":
MinDescription = "Wearable computer(Watch sized)";
break;
}
break;
case "2"://Phone (cellular, cordless, payphone, modem)
MajDescription = "Phone";
deviceType = 1;
switch (MinDevCod)
{
case "200":
MinDescription = "Uncategorized";
break;
case "204":
MinDescription = "Cellular";
break;
case "208":
MinDescription = "Cordless";
break;
case "20C":
MinDescription = "Smart phone";
break;
case "210":
MinDescription = "Wired modem or voice gateway";
break;
case "214":
MinDescription = "Common ISDN Access";
break;
}
break;
case "3"://LAN/Network Access point
deviceType = 0;
MajDescription = "LAN/Network Access point";
MinDescription = "LAN/Network Access point";
break;
case "4"://Audio/Video (headset, speaker, stereo, video display etc
MajDescription = "Audio/Video";
deviceType = 0;
switch (MinDevCod)
{
case "400":
MinDescription = "Uncategorized";
break;
case "404":
MinDescription = "Wearable Headset Device";
break;
case "408":
MinDescription = "Hands-free Device";
break;
case "410":
MinDescription = "Microphone";
break;
case "414":
MinDescription = "Loudspeaker";
break;
case "418":
MinDescription = "Headphones";
break;
case "41C":
MinDescription = "Portable Audio";
break;
case "420":
MinDescription = "Car audio";
break;
case "424":
MinDescription = "Set-top box";
break;
case "428":
MinDescription = "HiFi Audio Device";
break;
case "42C":
MinDescription = "VCR";
break;
case "430":
MinDescription = "Video Camera";
break;
case "434":
MinDescription = "Camcorder";
break;
case "438":
MinDescription = "Video Monitor";
break;
case "43C":
MinDescription = "Video Display and Loudspeaker";
break;
case "440":
MinDescription = "Video Conferencing";
break;
case "448":
MinDescription = "Gaming/Toy";
break;
}
break;
case "5"://Peripheral (mouse, joystick, keyboards etc )
deviceType = 0;
MajDescription = "Peripheral";
break;
case "6"://Imaging (printing, scanner, camera, display etc)
MajDescription = "Imaging";
deviceType = 0;
switch (MinDevCod)
{
case "610":
MinDescription = "Display";
break;
case "620":
MinDescription = "Camera";
break;
case "640":
MinDescription = "Scanner";
break;
case "680":
MinDescription = "Printer";
break;
}
break;
case "7"://Wearable
MajDescription = "Wearable";
deviceType = 0;
switch (MinDevCod)
{
case "704":
MinDescription = "Wrist Watch";
break;
case "708":
MinDescription = "Pager";
break;
case "70C":
MinDescription = "Jacket";
break;
case "710":
MinDescription = "Helmet";
break;
case "714":
MinDescription = "Glasses";
break;
}
break;
case "8"://Toy
MajDescription = "Toy";
deviceType = 0;
switch (MinDevCod)
{
case "804":
MinDescription = "Robot";
break;
case "808":
MinDescription = "Vehicle";
break;
case "80C":
MinDescription = "Doll/Action Figure";
break;
case "810":
MinDescription = "Controller";
break;
case "814":
MinDescription = "Game";
break;
}
break;
}
So MajDescription and MinDescription will return the class of device
Put it an function and make it return a string like this
sting CoD=MajDescription + ">" + MinDescription
Hope it helps.It helped me!
Mike,if you recall i had asked here about CoD but my C# skills werent so big to make it work as you descripted it.So i came up with my way of doing it.