133fe7b32SOliver Ruiz Dorantes/*
233fe7b32SOliver Ruiz Dorantes * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
333fe7b32SOliver Ruiz Dorantes * All rights reserved. Distributed under the terms of the MIT License.
433fe7b32SOliver Ruiz Dorantes */
533fe7b32SOliver Ruiz Dorantes
633fe7b32SOliver Ruiz Dorantes#include <bluetooth/DeviceClass.h>
7fef016caSFredrik Modéen#include <bluetooth/debug.h>
833fe7b32SOliver Ruiz Dorantes
96a3bada8SAdrien Destugues#include <Catalog.h>
106a3bada8SAdrien Destugues#include <Locale.h>
116a3bada8SAdrien Destugues
126a3bada8SAdrien Destugues
13546208a5SOliver Tappe#undef B_TRANSLATION_CONTEXT
14546208a5SOliver Tappe#define B_TRANSLATION_CONTEXT "DeviceClass"
156a3bada8SAdrien Destugues
166a3bada8SAdrien Destugues
1733fe7b32SOliver Ruiz Dorantesnamespace Bluetooth {
1833fe7b32SOliver Ruiz Dorantes
1933fe7b32SOliver Ruiz Dorantesvoid
2033fe7b32SOliver Ruiz DorantesDeviceClass::GetServiceClass(BString& serviceClass)
2133fe7b32SOliver Ruiz Dorantes{
22fef016caSFredrik Modéen	CALLED();
236a3bada8SAdrien Destugues	static const char *services[] = { B_TRANSLATE_MARK("Positioning"),
246a3bada8SAdrien Destugues		B_TRANSLATE_MARK("Networking"), B_TRANSLATE_MARK("Rendering"),
256a3bada8SAdrien Destugues		B_TRANSLATE_MARK("Capturing"), B_TRANSLATE_MARK("Object transfer"),
266a3bada8SAdrien Destugues		B_TRANSLATE_MARK("Audio"), B_TRANSLATE_MARK("Telephony"),
276a3bada8SAdrien Destugues		B_TRANSLATE_MARK("Information") };
286a3bada8SAdrien Destugues
29981f1b11SOliver Ruiz Dorantes	if (ServiceClass() != 0) {
30981f1b11SOliver Ruiz Dorantes		bool first = true;
31b9068dbfSOliver Ruiz Dorantes
3233fe7b32SOliver Ruiz Dorantes		for (uint s = 0; s < (sizeof(services) / sizeof(*services)); s++) {
33981f1b11SOliver Ruiz Dorantes			if (ServiceClass() & (1 << s)) {
34981f1b11SOliver Ruiz Dorantes				if (first) {
35981f1b11SOliver Ruiz Dorantes					first = false;
36981f1b11SOliver Ruiz Dorantes					serviceClass << services[s];
37981f1b11SOliver Ruiz Dorantes				} else {
38981f1b11SOliver Ruiz Dorantes					serviceClass << ", " << services[s];
39981f1b11SOliver Ruiz Dorantes				}
40981f1b11SOliver Ruiz Dorantes
4133fe7b32SOliver Ruiz Dorantes			}
4233fe7b32SOliver Ruiz Dorantes		}
43b9068dbfSOliver Ruiz Dorantes
4433fe7b32SOliver Ruiz Dorantes	} else
456a3bada8SAdrien Destugues		serviceClass << B_TRANSLATE("Unspecified");
4633fe7b32SOliver Ruiz Dorantes}
4733fe7b32SOliver Ruiz Dorantes
4833fe7b32SOliver Ruiz Dorantes
4933fe7b32SOliver Ruiz Dorantesvoid
5033fe7b32SOliver Ruiz DorantesDeviceClass::GetMajorDeviceClass(BString& majorClass)
5133fe7b32SOliver Ruiz Dorantes{
52fef016caSFredrik Modéen	CALLED();
536a3bada8SAdrien Destugues	static const char *major_devices[] = { B_TRANSLATE_MARK("Miscellaneous"),
546a3bada8SAdrien Destugues		B_TRANSLATE_MARK("Computer"), B_TRANSLATE_MARK("Phone"),
556a3bada8SAdrien Destugues		B_TRANSLATE_MARK("LAN access"), B_TRANSLATE_MARK("Audio/Video"),
566a3bada8SAdrien Destugues		B_TRANSLATE_MARK("Peripheral"), B_TRANSLATE_MARK("Imaging"),
576a3bada8SAdrien Destugues		B_TRANSLATE_MARK("Uncategorized") };
5833fe7b32SOliver Ruiz Dorantes
59981f1b11SOliver Ruiz Dorantes	if (MajorDeviceClass() >= sizeof(major_devices) / sizeof(*major_devices))
606a3bada8SAdrien Destugues		majorClass << B_TRANSLATE("Invalid device class!\n");
6133fe7b32SOliver Ruiz Dorantes	else
62981f1b11SOliver Ruiz Dorantes		majorClass << major_devices[MajorDeviceClass()];
6333fe7b32SOliver Ruiz Dorantes
6433fe7b32SOliver Ruiz Dorantes}
6533fe7b32SOliver Ruiz Dorantes
6633fe7b32SOliver Ruiz Dorantes
6733fe7b32SOliver Ruiz Dorantesvoid
6833fe7b32SOliver Ruiz DorantesDeviceClass::GetMinorDeviceClass(BString& minorClass)
6933fe7b32SOliver Ruiz Dorantes{
70fef016caSFredrik Modéen	CALLED();
71981f1b11SOliver Ruiz Dorantes	uint major = MajorDeviceClass();
72981f1b11SOliver Ruiz Dorantes	uint minor = MinorDeviceClass();
7333fe7b32SOliver Ruiz Dorantes
7433fe7b32SOliver Ruiz Dorantes	switch (major) {
7533fe7b32SOliver Ruiz Dorantes		case 0:	/* misc */
7633fe7b32SOliver Ruiz Dorantes			minorClass << " -";
77b9068dbfSOliver Ruiz Dorantes			break;
7833fe7b32SOliver Ruiz Dorantes		case 1:	/* computer */
7933fe7b32SOliver Ruiz Dorantes			switch(minor) {
8033fe7b32SOliver Ruiz Dorantes				case 0:
816a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Uncategorized");
82b9068dbfSOliver Ruiz Dorantes					break;
8333fe7b32SOliver Ruiz Dorantes				case 1:
846a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Desktop workstation");
85b9068dbfSOliver Ruiz Dorantes					break;
8633fe7b32SOliver Ruiz Dorantes				case 2:
876a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Server");
88b9068dbfSOliver Ruiz Dorantes					break;
8933fe7b32SOliver Ruiz Dorantes				case 3:
906a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Laptop");
91b9068dbfSOliver Ruiz Dorantes					break;
9233fe7b32SOliver Ruiz Dorantes				case 4:
936a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Handheld");
94b9068dbfSOliver Ruiz Dorantes					break;
9533fe7b32SOliver Ruiz Dorantes				case 5:
966a3bada8SAdrien Destugues					minorClass << B_TRANSLATE_COMMENT("Palm",
976a3bada8SAdrien Destugues						"A palm-held device");
98b9068dbfSOliver Ruiz Dorantes					break;
9933fe7b32SOliver Ruiz Dorantes				case 6:
1006a3bada8SAdrien Destugues					minorClass << B_TRANSLATE_COMMENT("Wearable",
1016a3bada8SAdrien Destugues						"A wearable computer");
102b9068dbfSOliver Ruiz Dorantes					break;
10333fe7b32SOliver Ruiz Dorantes				}
104b9068dbfSOliver Ruiz Dorantes			break;
10533fe7b32SOliver Ruiz Dorantes		case 2:	/* phone */
10633fe7b32SOliver Ruiz Dorantes			switch(minor) {
10733fe7b32SOliver Ruiz Dorantes				case 0:
1086a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Uncategorized");
109b9068dbfSOliver Ruiz Dorantes					break;
11033fe7b32SOliver Ruiz Dorantes				case 1:
1116a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Cellular");
112b9068dbfSOliver Ruiz Dorantes					break;
11333fe7b32SOliver Ruiz Dorantes				case 2:
1146a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Cordless");
115b9068dbfSOliver Ruiz Dorantes					break;
11633fe7b32SOliver Ruiz Dorantes				case 3:
1176a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Smart phone");
118b9068dbfSOliver Ruiz Dorantes					break;
11933fe7b32SOliver Ruiz Dorantes				case 4:
1206a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Wired modem or voice gateway");
121b9068dbfSOliver Ruiz Dorantes					break;
12233fe7b32SOliver Ruiz Dorantes				case 5:
1236a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Common ISDN access");
124b9068dbfSOliver Ruiz Dorantes					break;
12533fe7b32SOliver Ruiz Dorantes				case 6:
1266a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("SIM card reader");
127b9068dbfSOliver Ruiz Dorantes					break;
12833fe7b32SOliver Ruiz Dorantes			}
12933fe7b32SOliver Ruiz Dorantes			break;
13033fe7b32SOliver Ruiz Dorantes		case 3:	/* lan access */
13133fe7b32SOliver Ruiz Dorantes			if (minor == 0) {
1326a3bada8SAdrien Destugues				minorClass << B_TRANSLATE("Uncategorized");
13333fe7b32SOliver Ruiz Dorantes				break;
13433fe7b32SOliver Ruiz Dorantes			}
13533fe7b32SOliver Ruiz Dorantes			switch(minor / 8) {
13633fe7b32SOliver Ruiz Dorantes				case 0:
1376a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Fully available");
138b9068dbfSOliver Ruiz Dorantes					break;
13933fe7b32SOliver Ruiz Dorantes				case 1:
1406a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("1-17% utilized");
141b9068dbfSOliver Ruiz Dorantes					break;
14233fe7b32SOliver Ruiz Dorantes				case 2:
1436a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("17-33% utilized");
144b9068dbfSOliver Ruiz Dorantes					break;
14533fe7b32SOliver Ruiz Dorantes				case 3:
1466a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("33-50% utilized");
147b9068dbfSOliver Ruiz Dorantes					break;
14833fe7b32SOliver Ruiz Dorantes				case 4:
1496a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("50-67% utilized");
150b9068dbfSOliver Ruiz Dorantes					break;
15133fe7b32SOliver Ruiz Dorantes				case 5:
1526a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("67-83% utilized");
153b9068dbfSOliver Ruiz Dorantes					break;
15433fe7b32SOliver Ruiz Dorantes				case 6:
1556a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("83-99% utilized");
156b9068dbfSOliver Ruiz Dorantes					break;
15733fe7b32SOliver Ruiz Dorantes				case 7:
1586a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("No service available");
159b9068dbfSOliver Ruiz Dorantes					break;
16033fe7b32SOliver Ruiz Dorantes			}
161b9068dbfSOliver Ruiz Dorantes			break;
16233fe7b32SOliver Ruiz Dorantes		case 4:	/* audio/video */
16333fe7b32SOliver Ruiz Dorantes			switch(minor) {
16433fe7b32SOliver Ruiz Dorantes				case 0:
1656a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Uncategorized");
166b9068dbfSOliver Ruiz Dorantes					break;
16733fe7b32SOliver Ruiz Dorantes				case 1:
1686a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Device conforms to the headset profile");
169b9068dbfSOliver Ruiz Dorantes					break;
17033fe7b32SOliver Ruiz Dorantes				case 2:
1716a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Hands-free");
172b9068dbfSOliver Ruiz Dorantes					break;
17333fe7b32SOliver Ruiz Dorantes					/* 3 is reserved */
17433fe7b32SOliver Ruiz Dorantes				case 4:
1756a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Microphone");
176b9068dbfSOliver Ruiz Dorantes					break;
17733fe7b32SOliver Ruiz Dorantes				case 5:
1786a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Loudspeaker");
179b9068dbfSOliver Ruiz Dorantes					break;
18033fe7b32SOliver Ruiz Dorantes				case 6:
1816a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Headphones");
182b9068dbfSOliver Ruiz Dorantes					break;
18333fe7b32SOliver Ruiz Dorantes				case 7:
1846a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Portable audio");
185b9068dbfSOliver Ruiz Dorantes					break;
18633fe7b32SOliver Ruiz Dorantes				case 8:
1876a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Car audio");
188b9068dbfSOliver Ruiz Dorantes					break;
18933fe7b32SOliver Ruiz Dorantes				case 9:
1906a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Set-top box");
191b9068dbfSOliver Ruiz Dorantes					break;
19233fe7b32SOliver Ruiz Dorantes				case 10:
1936a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("HiFi audio device");
194b9068dbfSOliver Ruiz Dorantes					break;
19533fe7b32SOliver Ruiz Dorantes				case 11:
1966a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("VCR");
197b9068dbfSOliver Ruiz Dorantes					break;
19833fe7b32SOliver Ruiz Dorantes				case 12:
1996a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Video camera");
200b9068dbfSOliver Ruiz Dorantes					break;
20133fe7b32SOliver Ruiz Dorantes				case 13:
2026a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Camcorder");
203b9068dbfSOliver Ruiz Dorantes					break;
20433fe7b32SOliver Ruiz Dorantes				case 14:
2056a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Video monitor");
206b9068dbfSOliver Ruiz Dorantes					break;
20733fe7b32SOliver Ruiz Dorantes				case 15:
2086a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Video display and loudspeaker");
209b9068dbfSOliver Ruiz Dorantes					break;
21033fe7b32SOliver Ruiz Dorantes				case 16:
2116a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Video conferencing");
212b9068dbfSOliver Ruiz Dorantes					break;
21333fe7b32SOliver Ruiz Dorantes					/* 17 is reserved */
21433fe7b32SOliver Ruiz Dorantes				case 18:
2156a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Gaming/Toy");
216b9068dbfSOliver Ruiz Dorantes					break;
21733fe7b32SOliver Ruiz Dorantes			}
218b9068dbfSOliver Ruiz Dorantes			break;
219b9068dbfSOliver Ruiz Dorantes		case 5:	/* peripheral */
220b9068dbfSOliver Ruiz Dorantes		{
22133fe7b32SOliver Ruiz Dorantes			switch(minor & 48) {
22233fe7b32SOliver Ruiz Dorantes				case 16:
2236a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Keyboard");
22433fe7b32SOliver Ruiz Dorantes					if (minor & 15)
22533fe7b32SOliver Ruiz Dorantes						minorClass << "/";
226b9068dbfSOliver Ruiz Dorantes					break;
22733fe7b32SOliver Ruiz Dorantes				case 32:
2286a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Pointing device");
22933fe7b32SOliver Ruiz Dorantes					if (minor & 15)
23033fe7b32SOliver Ruiz Dorantes						minorClass << "/";
231b9068dbfSOliver Ruiz Dorantes					break;
23233fe7b32SOliver Ruiz Dorantes				case 48:
2336a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Combo keyboard/pointing device");
23433fe7b32SOliver Ruiz Dorantes					if (minor & 15)
23533fe7b32SOliver Ruiz Dorantes						minorClass << "/";
236b9068dbfSOliver Ruiz Dorantes					break;
23733fe7b32SOliver Ruiz Dorantes			}
23833fe7b32SOliver Ruiz Dorantes
23933fe7b32SOliver Ruiz Dorantes			switch(minor & 15) {
24033fe7b32SOliver Ruiz Dorantes				case 0:
241b9068dbfSOliver Ruiz Dorantes					break;
24233fe7b32SOliver Ruiz Dorantes				case 1:
2436a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Joystick");
244b9068dbfSOliver Ruiz Dorantes					break;
24533fe7b32SOliver Ruiz Dorantes				case 2:
2466a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Gamepad");
247b9068dbfSOliver Ruiz Dorantes					break;
24833fe7b32SOliver Ruiz Dorantes				case 3:
2496a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Remote control");
250b9068dbfSOliver Ruiz Dorantes					break;
25133fe7b32SOliver Ruiz Dorantes				case 4:
2526a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Sensing device");
253b9068dbfSOliver Ruiz Dorantes					break;
25433fe7b32SOliver Ruiz Dorantes				case 5:
2556a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Digitizer tablet");
256b9068dbfSOliver Ruiz Dorantes					break;
25733fe7b32SOliver Ruiz Dorantes				case 6:
2586a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Card reader");
259b9068dbfSOliver Ruiz Dorantes					break;
26033fe7b32SOliver Ruiz Dorantes				default:
2616a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("(reserved)");
262b9068dbfSOliver Ruiz Dorantes					break;
26333fe7b32SOliver Ruiz Dorantes			}
264b9068dbfSOliver Ruiz Dorantes			break;
26533fe7b32SOliver Ruiz Dorantes		}
26633fe7b32SOliver Ruiz Dorantes		case 6:	/* imaging */
26733fe7b32SOliver Ruiz Dorantes			if (minor & 4)
2686a3bada8SAdrien Destugues				minorClass << B_TRANSLATE("Display");
26933fe7b32SOliver Ruiz Dorantes			if (minor & 8)
2706a3bada8SAdrien Destugues				minorClass << B_TRANSLATE("Camera");
27133fe7b32SOliver Ruiz Dorantes			if (minor & 16)
2726a3bada8SAdrien Destugues				minorClass << B_TRANSLATE("Scanner");
27333fe7b32SOliver Ruiz Dorantes			if (minor & 32)
2746a3bada8SAdrien Destugues				minorClass << B_TRANSLATE("Printer");
275b9068dbfSOliver Ruiz Dorantes			break;
27633fe7b32SOliver Ruiz Dorantes		case 7: /* wearable */
27733fe7b32SOliver Ruiz Dorantes			switch(minor) {
27833fe7b32SOliver Ruiz Dorantes				case 1:
2796a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Wrist watch");
280b9068dbfSOliver Ruiz Dorantes					break;
28133fe7b32SOliver Ruiz Dorantes				case 2:
2826a3bada8SAdrien Destugues					minorClass << B_TRANSLATE_COMMENT("Pager",
2836a3bada8SAdrien Destugues					"A small radio device to receive short text messages");
284b9068dbfSOliver Ruiz Dorantes					break;
28533fe7b32SOliver Ruiz Dorantes				case 3:
2866a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Jacket");
287b9068dbfSOliver Ruiz Dorantes					break;
28833fe7b32SOliver Ruiz Dorantes				case 4:
2896a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Helmet");
290b9068dbfSOliver Ruiz Dorantes					break;
29133fe7b32SOliver Ruiz Dorantes				case 5:
2926a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Glasses");
293b9068dbfSOliver Ruiz Dorantes					break;
29433fe7b32SOliver Ruiz Dorantes			}
295b9068dbfSOliver Ruiz Dorantes			break;
29633fe7b32SOliver Ruiz Dorantes		case 8: /* toy */
29733fe7b32SOliver Ruiz Dorantes			switch(minor) {
29833fe7b32SOliver Ruiz Dorantes				case 1:
2996a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Robot");
300b9068dbfSOliver Ruiz Dorantes					break;
30133fe7b32SOliver Ruiz Dorantes				case 2:
3026a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Vehicle");
303b9068dbfSOliver Ruiz Dorantes					break;
30433fe7b32SOliver Ruiz Dorantes				case 3:
3056a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Doll/Action figure");
306b9068dbfSOliver Ruiz Dorantes					break;
30733fe7b32SOliver Ruiz Dorantes				case 4:
3086a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Controller");
309b9068dbfSOliver Ruiz Dorantes					break;
31033fe7b32SOliver Ruiz Dorantes				case 5:
3116a3bada8SAdrien Destugues					minorClass << B_TRANSLATE("Game");
312b9068dbfSOliver Ruiz Dorantes					break;
31333fe7b32SOliver Ruiz Dorantes			}
314b9068dbfSOliver Ruiz Dorantes			break;
31533fe7b32SOliver Ruiz Dorantes		case 63:	/* uncategorised */
31633fe7b32SOliver Ruiz Dorantes			minorClass << "";
317b9068dbfSOliver Ruiz Dorantes			break;
31833fe7b32SOliver Ruiz Dorantes		default:
3196a3bada8SAdrien Destugues			minorClass << B_TRANSLATE("Unknown (reserved) minor device class");
320b9068dbfSOliver Ruiz Dorantes			break;
32133fe7b32SOliver Ruiz Dorantes	}
322515e878cSOliver Ruiz Dorantes}
32333fe7b32SOliver Ruiz Dorantes
32433fe7b32SOliver Ruiz Dorantes
325515e878cSOliver Ruiz Dorantesvoid
326515e878cSOliver Ruiz DorantesDeviceClass::DumpDeviceClass(BString& string)
327515e878cSOliver Ruiz Dorantes{
328fef016caSFredrik Modéen	CALLED();
3296a3bada8SAdrien Destugues	string << B_TRANSLATE("Service classes: ");
330515e878cSOliver Ruiz Dorantes	GetServiceClass(string);
331515e878cSOliver Ruiz Dorantes	string << " | ";
3326a3bada8SAdrien Destugues	string << B_TRANSLATE("Major class: ");
333515e878cSOliver Ruiz Dorantes	GetMajorDeviceClass(string);
334515e878cSOliver Ruiz Dorantes	string << " | ";
3356a3bada8SAdrien Destugues	string << B_TRANSLATE("Minor class: ");
336515e878cSOliver Ruiz Dorantes	GetMinorDeviceClass(string);
337b9068dbfSOliver Ruiz Dorantes	string << ".";
33833fe7b32SOliver Ruiz Dorantes}
33933fe7b32SOliver Ruiz Dorantes
340155fa31eSOliver Ruiz Dorantes
341155fa31eSOliver Ruiz Dorantesvoid
342155fa31eSOliver Ruiz DorantesDeviceClass::Draw(BView* view, const BPoint& point)
343155fa31eSOliver Ruiz Dorantes{
344fef016caSFredrik Modéen	CALLED();
345155fa31eSOliver Ruiz Dorantes	rgb_color	kBlack = { 0,0,0,0 };
346155fa31eSOliver Ruiz Dorantes	rgb_color	kBlue = { 28,110,157,0 };
347155fa31eSOliver Ruiz Dorantes	rgb_color	kWhite = { 255,255,255,0 };
348155fa31eSOliver Ruiz Dorantes
349155fa31eSOliver Ruiz Dorantes
350155fa31eSOliver Ruiz Dorantes	view->SetHighColor(kBlue);
351155fa31eSOliver Ruiz Dorantes	view->FillRoundRect(BRect(point.x + IconInsets, point.y + IconInsets,
352155fa31eSOliver Ruiz Dorantes		point.x + IconInsets + PixelsForIcon, point.y + IconInsets + PixelsForIcon), 5, 5);
353155fa31eSOliver Ruiz Dorantes
354155fa31eSOliver Ruiz Dorantes	view->SetHighColor(kWhite);
355155fa31eSOliver Ruiz Dorantes
356981f1b11SOliver Ruiz Dorantes	switch (MajorDeviceClass()) {
357155fa31eSOliver Ruiz Dorantes
358155fa31eSOliver Ruiz Dorantes		case 2: // phone
359155fa31eSOliver Ruiz Dorantes			view->StrokeRoundRect(BRect(point.x + IconInsets + uint(PixelsForIcon/4),
360155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + 6,
361155fa31eSOliver Ruiz Dorantes				 point.x + IconInsets + uint(PixelsForIcon*3/4),
362155fa31eSOliver Ruiz Dorantes			 	 point.y + IconInsets + PixelsForIcon - 2), 2, 2);
363155fa31eSOliver Ruiz Dorantes			view->StrokeRect(BRect(point.x + IconInsets + uint(PixelsForIcon/4) + 4,
364155fa31eSOliver Ruiz Dorantes			 	 point.y + IconInsets + 10,
365155fa31eSOliver Ruiz Dorantes				 point.x + IconInsets + uint(PixelsForIcon*3/4) - 4,
366155fa31eSOliver Ruiz Dorantes			 	 point.y + IconInsets + uint(PixelsForIcon*3/4)));
367155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/4) + 4,
368155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + PixelsForIcon - 6),
369155fa31eSOliver Ruiz Dorantes				 BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4) - 4,
370155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + PixelsForIcon - 6));
371155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/4) + 4,
372155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + PixelsForIcon - 4),
373155fa31eSOliver Ruiz Dorantes				 BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4) - 4,
374155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + PixelsForIcon - 4));
375155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/4) + 4,
376155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + 2),
377155fa31eSOliver Ruiz Dorantes				 BPoint(point.x + IconInsets + uint(PixelsForIcon/4) + 4,
378155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + 6));
379155fa31eSOliver Ruiz Dorantes			break;
380155fa31eSOliver Ruiz Dorantes		case 3: // LAN
381155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/4),
382155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*3/8)),
383155fa31eSOliver Ruiz Dorantes				BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4),
384155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*3/8)));
385155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon*5/8),
386155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon/8)));
387155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4),
388155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*5/8)),
389155fa31eSOliver Ruiz Dorantes				BPoint(point.x + IconInsets + uint(PixelsForIcon/4),
390155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*5/8)));
391155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon*3/8),
392155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*7/8)));
393155fa31eSOliver Ruiz Dorantes			break;
394155fa31eSOliver Ruiz Dorantes		case 4: // audio/video
395155fa31eSOliver Ruiz Dorantes			view->StrokeRect(BRect(point.x + IconInsets + uint(PixelsForIcon/4),
396155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*3/8),
397155fa31eSOliver Ruiz Dorantes				 point.x + IconInsets + uint(PixelsForIcon*3/8),
398155fa31eSOliver Ruiz Dorantes			 	 point.y + IconInsets + uint(PixelsForIcon*5/8)));
399155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon*3/8),
400155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*3/8)),
401155fa31eSOliver Ruiz Dorantes				BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4),
402155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon/8)));
403155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4),
404155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*7/8)));
405155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon*3/8),
406155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*5/8)));
407155fa31eSOliver Ruiz Dorantes			break;
408155fa31eSOliver Ruiz Dorantes		default: // Bluetooth Logo
409155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/4),
410155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*3/4)),
411155fa31eSOliver Ruiz Dorantes				BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4),
412155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon/4)));
413155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/2),
414155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets +2));
415155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/2),
416155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + PixelsForIcon - 2));
417155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon*3/4),
418155fa31eSOliver Ruiz Dorantes				 point.y + IconInsets + uint(PixelsForIcon*3/4)));
419155fa31eSOliver Ruiz Dorantes			view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/4),
420155fa31eSOliver Ruiz Dorantes				point.y + IconInsets + uint(PixelsForIcon/4)));
421155fa31eSOliver Ruiz Dorantes			break;
422fef016caSFredrik Modéen	}
423155fa31eSOliver Ruiz Dorantes	view->SetHighColor(kBlack);
424155fa31eSOliver Ruiz Dorantes}
425155fa31eSOliver Ruiz Dorantes
42633fe7b32SOliver Ruiz Dorantes}
427