2 Copyright (C) 2013, The AROS Development Team. All rights reserved.
8 #include <utility/tagitem.h>
11 #include "hiddclass_intern.h"
13 /*****************************************************************************************
22 This class represents a root of HIDD subsystem tree. In other words, it
23 represents your computer. Calling HW_EnumDrivers() on it will enumerate
24 installed subsystem classes.
26 By design this class is a singletone. In order to get access to it, just
27 call OOP_NewObject() on it. Every call will return the same pointer to
28 the same object. You do not need to call OOP_Dispose object on it. Such
29 calls will simply do nothing.
31 Subsystem classes need to register themselves in the tree by calling
32 HW_AddDriver() on this class. The class keeps an eye on the subsystem
33 usage and will allow to remove it using HW_RemoveDriver() only if the
34 subsystem being removed is not in use by any other components.
36 *****************************************************************************************/
38 OOP_Object
*HWRoot__Root__New(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_New
*msg
)
40 struct class_static_data
*csd
= CSD(cl
);
43 * This singletone lacks semaphore protection. It is OK since
44 * our instance is created during initialization procedure.
48 struct TagItem new_tags
[] =
50 {aHW_ClassName
, (IPTR
)"Computer"},
53 struct pRoot_New new_msg
=
59 csd
->hwroot
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, &new_msg
.mID
);
65 void HWRoot__Root__Dispose(OOP_Class
*cl
, OOP_Object
*o
, OOP_Msg msg
)
70 BOOL
HWRoot__HW__RemoveDriver(OOP_Class
*cl
, OOP_Object
*o
,
71 struct pHW_RemoveDriver
*msg
)
73 struct Library
*OOPBase
= CSD(cl
)->cs_OOPBase
;
76 OOP_GetAttr(msg
->driverObject
, aHW_InUse
, &used
);
80 return OOP_DoSuperMethod(cl
, o
, &msg
->mID
);
84 * TODO: Computer can have some OEM strings, like and vendor name.
85 * In future it would be nice to make use of them by implementing
86 * respective attributes of I_Hidd interface.
87 * Perhaps, in order to be able to retrieve this properties,
88 * this class will become hardware-specific, will be separated
89 * from hiddclass.hidd, and moved to BSP.