Update possible minor classes

This commit is contained in:
Marcel Holtmann 2006-06-26 12:33:13 +00:00
parent 36e5deeafe
commit 5b81f02a53
3 changed files with 134 additions and 2 deletions

View File

@ -87,6 +87,79 @@ static const char *phone_minor_cls[] = {
"isdn"
};
static const char *access_point_minor_cls[] = {
"fully",
"1-17 percent",
"17-33 percent",
"33-50 percent",
"50-67 percent",
"67-83 percent",
"83-99 percent",
"not available"
};
static const char *audio_video_minor_cls[] = {
"uncategorized",
"headset",
"handsfree",
"unknown",
"microphone",
"loudspeaker",
"headphones",
"portable audio",
"car audio",
"set-top box",
"hifi audio",
"vcr",
"video camera",
"camcorder",
"video monitor",
"video display and loudspeaker",
"video conferencing",
"unknown",
"gaming/toy"
};
static const char *peripheral_minor_cls[] = {
"uncategorized",
"keyboard",
"pointing",
"combo"
};
static const char *peripheral_2_minor_cls[] = {
"uncategorized",
"joystick",
"gamepad",
"remote control",
"sensing",
"digitizer tablet",
"card reader"
};
static const char *imaging_minor_cls[] = {
"display",
"camera",
"scanner",
"printer"
};
static const char *wearable_minor_cls[] = {
"wrist watch",
"pager",
"jacket",
"helmet",
"glasses"
};
static const char *toy_minor_cls[] = {
"robot",
"vehicle",
"doll",
"controller",
"game"
};
static int check_address(const char *addr)
{
char tmp[18];
@ -2199,13 +2272,33 @@ const char *major_class_str(uint32_t class)
const char *minor_class_str(uint32_t class)
{
uint8_t major_index = (class >> 8) & 0x1F;
uint8_t minor_index = (class >> 2) & 0x3F;
uint8_t minor_index;
switch (major_index) {
case 1: /* computer */
minor_index = (class >> 2) & 0x3F;
return computer_minor_cls[minor_index];
case 2: /* phone */
minor_index = (class >> 2) & 0x3F;
return phone_minor_cls[minor_index];
case 3: /* access point */
minor_index = (class >> 5) & 0x07;
return access_point_minor_cls[minor_index];
case 4: /* audio/video */
minor_index = (class >> 2) & 0x3F;
return audio_video_minor_cls[minor_index];
case 5: /* peripheral */
minor_index = (class >> 6) & 0x03;
return peripheral_minor_cls[minor_index];
case 6: /* imaging */
minor_index = (class >> 4) & 0x0F;
return imaging_minor_cls[minor_index];
case 7: /* wearable */
minor_index = (class >> 2) & 0x3F;
return wearable_minor_cls[minor_index];
case 8: /* toy */
minor_index = (class >> 2) & 0x3F;
return toy_minor_cls[minor_index];
}
return "";

View File

@ -28,6 +28,23 @@ Minor classes computer uncategorized, desktop, server, laptop, handheld,
Minor classes phone uncategorized, cellular, cordless, smart phone,
modem, isdn
Minor classes access point fully, 1-17 percent, 17-33 percent,
33-50 percent, 50-67 percent, 67-83 percent,
83-99 percent, not available
Minor classes audio video uncategorized, headset, handsfree,microphone,
loudspeaker, headphones, portable audio, car audio,
set-top box, hifi audio, vcr, video camera, camcorder,
video monitor, video display and loudspeaker,
video conferencing, gaming/toy, unknown
Minor classes peripheral uncategorized, keyboard, pointing, combo
Minor classes imaging display, camera, scanner, printer
Minor classes wearable wrist watch, pager, jacket, helmet, glasses
Minor classes toy robot, vehicle, doll, controller, game
Error hierarchy
===============

View File

@ -36,6 +36,9 @@ dev_cmds = [ "GetAddress",
"GetRemoteManufacturer",
"GetRemoteCompany",
"GetRemoteName",
"GetRemoteMajorClass",
"GetRemoteMinorClass",
"GetRemoteServiceClasses",
"GetRemoteAlias",
"SetRemoteAlias",
"ClearRemoteAlias",
@ -276,7 +279,7 @@ class Tester:
print 'Usage: %s -i <dev> SetName newname' % self.name
elif self.cmd == 'GetRemoteName':
if len(self.cmd_args) == 1:
print self.device.GetRemoteName()
print self.device.GetRemoteName(self.cmd_args[0])
else:
print 'Usage: %s -i <dev> GetRemoteName address' % self.name
elif self.cmd == 'GetRemoteVersion':
@ -304,6 +307,21 @@ class Tester:
print self.device.GetRemoteAlias(self.cmd_args[0])
else:
print 'Usage: %s -i <dev> GetRemoteAlias address' % self.name
elif self.cmd == 'GetRemoteMajorClass':
if len(self.cmd_args) == 1:
print self.device.GetRemoteMajorClass(self.cmd_args[0])
else:
print 'Usage: %s -i <dev> GetRemoteMajorClass address' % self.name
elif self.cmd == 'GetRemoteMinorClass':
if len(self.cmd_args) == 1:
print self.device.GetRemoteMinorClass(self.cmd_args[0])
else:
print 'Usage: %s -i <dev> GetRemoteMinorClass address' % self.name
elif self.cmd == 'GetRemoteServiceClasses':
if len(self.cmd_args) == 1:
print self.device.GetRemoteServiceClasses(self.cmd_args[0])
else:
print 'Usage: %s -i <dev> GetRemoteServiceClasses address' % self.name
elif self.cmd == 'SetRemoteAlias':
if len(self.cmd_args) == 2:
self.device.SetRemoteAlias(self.cmd_args[0], self.cmd_args[1])
@ -363,6 +381,10 @@ class Tester:
print self.device.GetEncryptionKeySize(self.cmd_args[0])
else:
print 'Usage: %s -i <dev> GetEncryptionKeySize address' % self.name
elif self.cmd == 'DiscoverDevices':
print self.device.DiscoverDevices()
elif self.cmd == 'DiscoverDevicesWithoutNameResolving':
print self.device.DiscoverDevicesWithoutNameResolving()
else:
# FIXME: remove at future version
print 'Script Error: Method %s not found. Maybe a mispelled word.' % (self.cmd_args)