Author Topic: What is COD (Class Of Devices)?  (Read 14406 times)

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3052
  • Karma: 1000
    • Soft Service Company
What is COD (Class Of Devices)?
« on: July 09, 2010, 10:30:57 AM »
What is COD?

A COD (Class Of Device) is a number which describes Bluetooth Device. A COD contains three fields: Major COD, Minor COD and Service COD.

All the COD constrants are declared in:
  • VCL: wclCODs unit
  • .NET: wcl.wclCODs class
  • C++: wclCODs.h

Constants

There are few constants help you to decode COD:

COD_MINOR_BIT_OFFSET = 2
COD_MAJOR_BIT_OFFSET = 8 * 1
COD_SERVICE_BIT_OFFSET = 8 * 1 + 5

COD_MINOR_MASK = 0x0000FC
COD_MAJOR_MASK = 0x001F00
COD_SERVICE_MASK = 0xFFE000


Major COD

Major COD describes devices class. The following classes are possible:

COD_MAJOR_MISCELLANEOUS = 0x00
COD_MAJOR_COMPUTER = 0x01
COD_MAJOR_PHONE = 0x02
COD_MAJOR_LAN_ACCESS = 0x03
COD_MAJOR_AUDIO = 0x04
COD_MAJOR_PERIPHERAL = 0x05
COD_MAJOR_IMAGING = 0x06
COD_MAJOR_WEARABLE = 0x07
COD_MAJOR_TOY = 0x08
COD_MAJOR_UNCLASSIFIED = 0x1F


How to decode Major COD

C++
DWORD dwMajorCOD = (dwCOD & COD_MAJOR_MASK) >> COD_MAJOR_BIT_OFFSET;

C#
UInt32 MajorCOD = (COD & COD_MAJOR_MASK) >> COD_MAJOR_BIT_OFFSET;

VCL
MajorCOD := (COD and COD_MAJOR_MASK) shr COD_MAJOR_BIT_OFFSET;

Minor COD

Each Major COD class has its own Minor codes:

COD_MAJOR_COMPUTER

COD_COMPUTER_MINOR_UNCLASSIFIED = 0x00
COD_COMPUTER_MINOR_DESKTOP = 0x01
COD_COMPUTER_MINOR_SERVER = 0x02
COD_COMPUTER_MINOR_LAPTOP = 0x03
COD_COMPUTER_MINOR_HANDHELD = 0x04
COD_COMPUTER_MINOR_PALM = ox05
COD_COMPUTER_MINOR_WEARABLE = 0x06


COD_MAJOR_PHONE

COD_PHONE_MINOR_UNCLASSIFIED = 0x00
COD_PHONE_MINOR_CELLULAR = 0x01
COD_PHONE_MINOR_CORDLESS = 0x02
COD_PHONE_MINOR_SMART = 0x03
COD_PHONE_MINOR_WIRED_MODEM = 0x04
COD_PHONE_MINOR_COMMON_ISDN_ACCESS = 0x05


COD_MAJOR_AUDIO

COD_AUDIO_MINOR_UNCLASSIFIED = 0x00
COD_AUDIO_MINOR_HEADSET = 0x01
COD_AUDIO_MINOR_HANDS_FREE = 0x02
COD_AUDIO_MINOR_HEADSET_HANDS_FREE = 0x03
COD_AUDIO_MINOR_MICROPHONE = 0x04
COD_AUDIO_MINOR_LOUDSPEAKER = 0x05
COD_AUDIO_MINOR_HEADPHONES = 0x06
COD_AUDIO_MINOR_PORTABLE_AUDIO = 0x07
COD_AUDIO_MINOR_CAR_AUDIO = 0x08
COD_AUDIO_MINOR_SET_TOP_BOX = 0x09
COD_AUDIO_MINOR_HIFI_AUDIO = 0x0A
COD_AUDIO_MINOR_VCR = 0x0B
COD_AUDIO_MINOR_VIDEO_CAMERA = 0C0x
COD_AUDIO_MINOR_CAMCORDER = 0x0D
COD_AUDIO_MINOR_VIDEO_MONITOR = 0x0E
COD_AUDIO_MINOR_VIDEO_DISPLAY_LOUDSPEAKER = 0x0F
COD_AUDIO_MINOR_VIDEO_DISPLAY_CONFERENCING = 0x10
COD_AUDIO_MINOR_GAMING_TOY = 0x12


COD_MAJOR_PERIPHERAL

COD_PERIPHERAL_MINOR_NO_CATEGORY = 0x00
COD_PERIPHERAL_MINOR_UNCLASSIFIED = 0x00
COD_PERIPHERAL_MINOR_JOYSTICK = 0x01
COD_PERIPHERAL_MINOR_GAMEPAD = 0x02
COD_PERIPHERAL_MINOR_REMOTE_CONTROL = 0x03
COD_PERIPHERAL_MINOR_SENSING = 0x04
COD_PERIPHERAL_MINOR_DIGITIZER_TABLET = 0x05
COD_PERIPHERAL_MINOR_CARD_READER = 0x06
COD_PERIPHERAL_MINOR_KEYBOARD_MASK = 0x10
COD_PERIPHERAL_MINOR_POINTER_MASK = 0x20


COD_MAJOR_IMAGING

COD_IMAGING_MINOR_DISPLAY_MASK = 0x04
COD_IMAGING_MINOR_CAMERA_MASK = 0x08
COD_IMAGING_MINOR_SCANNER_MASK = 0x10
COD_IMAGING_MINOR_PRINTER_MASK = 0x20


COD_MAJOR_WEARABLE

COD_WEARABLE_MINOR_WRIST_WATCH = 0x01
COD_WEARABLE_MINOR_PAGER = 0x02
COD_WEARABLE_MINOR_JACKET = 0x03
COD_WEARABLE_MINOR_HELMET = 0x04
COD_WEARABLE_MINOR_GLASSES = 0x05


COD_MAJOR_TOY

COD_TOY_MINOR_ROBOT = 0x01
COD_TOY_MINOR_VEHICLE = 0x02
COD_TOY_MINOR_DOLLACTIONFIGURE = 0x03
COD_TOY_MINOR_CONTROLLER = 0x04
COD_TOY_MINOR_GAME = 0x05


COD_MAJOR_LAN_ACCESS

The minor CODs for LAN Access uses different constrants:

COD_LAN_ACCESS_BIT_OFFSET = 5

COD_LAN_MINOR_MASK = 0x00001C
COD_LAN_ACCESS_MASK = 0x0000E0

COD_LAN_MINOR_UNCLASSIFIED = 0x00

COD_LAN_ACCESS_0_USED = 0x00
COD_LAN_ACCESS_17_USED = 0x01
COD_LAN_ACCESS_33_USED = 0x02
COD_LAN_ACCESS_50_USED = 0x03
COD_LAN_ACCESS_67_USED = 0x04
COD_LAN_ACCESS_83_USED = 0x05
COD_LAN_ACCESS_99_USED = 0x06
COD_LAN_ACCESS_FULL = 0x07


How to decode Minor COD

Its mostly the same way

C++
DWORD dwMinorCOD = (dwCOD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET;

C#
UInt32 MinorCOD = (COD & COD_MINOR_MASK) >> COD_MINOR_BIT_OFFSET;

VCL
MinorCOD := (COD and COD_MINOR_MASK) shr COD_MINOR_BIT_OFFSET;

The important thing you must know about Minor COD. It means nothing without known Major COD. So you must decode Major COD first and then you can decode Minor one.

WCL features

WCL provides additional method to decode CODs. wclBluetoothDevice class includes DecodeCOD function:

C++
wclClassOfDevice DecodeCOD(DWORD dwCOD);

.NET
wclClassOfDevice DecodeCOD(Uint32 COD);

VCL
function DecodeCOD(COD: Cardinal): TwclClassOfDevice;

wclClassOfDevice = (
    codMisc,
    codComputer,
    codDesktop,
    codServer,
    codLaptop,
    codHandheld,
    codPalm,
    codWearable,
    codPhone,
    codCellurar,
    codCordLess,
    codSmart,
    codWiredModem,
    codISDN,
    codAudio,
    codHeadSet,
    codHandsFree,
    codHeadSetHandsFree,
    codMicrophone,
    codLoudspeaker,
    codHeadphones,
    codPortableAudio,
    codCarAudio,
    codSetTopBox,
    codHiFiAudio,
    codVCR,
    codVideoCamera,
    codCamcoder,
    codVideoMonitor,
    codDisplayLoudspeaker,
    codDisplayConferencing,
    codGamingToy,
    codPeripheral,
    codJoystick,
    codGamepad,
    codRemoteControl,
    codSensing,
    codDigitizerTablet,
    codCardReader,
    codKeyboard,
    codPointer,
    codDisplay,
    codCamera,
    codScanner,
    codPrinter,
    codImaging,
    codWristWatch,
    codPager,
    codJacket,
    codHelmet,
    codGlasses,
    codWearableOther,
    codRobot,
    codVehicle,
    codDollActionFigure,
    codController,
    codGame,
    codToy,
    codLAN,
    codUnknown);
« Last Edit: July 10, 2010, 10:52:19 AM by Mike Petrichenko »

 

Sitemap 1 2 3 4 5 6 7 8 9