Max OS 0.3
Loading...
Searching...
No Matches
driver.h
Go to the documentation of this file.
1
9#ifndef MAX_OS_DRIVERS_DRIVER_H
10#define MAX_OS_DRIVERS_DRIVER_H
11
12#include <cstdint>
13#include <common/outputStream.h>
14#include <common/eventHandler.h>
15#include <common/string.h>
16#include <common/logger.h>
18
19
20namespace MaxOS::drivers {
21
22
27 class Driver {
28 public:
29
30 Driver();
31 ~Driver();
32
33 virtual void activate();
34 virtual void deactivate();
35 virtual void initialise();
36 virtual uint32_t reset();
37
38 virtual string vendor_name();
39 virtual string device_name();
40 };
41
42 //NOTE: Driver doesn't use the EventHandler class because it doesn't need to be connected to anything (May want to change this later)
53
59 public:
61 virtual ~DriverSelector();
62 virtual void select_drivers(DriverSelectorEventHandler* handler);
63 };
64
70 private:
71
72 common::Vector<DriverSelector*> m_driver_selectors;
74
75 public:
78
81
82 void add_driver(Driver*);
83 void remove_driver(Driver*);
84 void on_driver_selected(Driver*) final;
85
86 void find_drivers();
87 uint32_t reset_devices();
88 void initialise_drivers();
89 void deactivate_drivers();
90 void activate_drivers();
91
92
93 };
94}
95
96
97#endif //MAX_OS_DRIVERS_DRIVER_H
Stores the left, top, width and height of a rectangle.
Definition rectangle.h:22
Manages the drivers, handles the adding and removing of drivers.
Definition driver.h:69
DriverManager()
Constructs the Driver Manager, adding any default driver selectors.
Definition driver.cpp:97
void add_driver(Driver *)
Adds a driver to the manager.
Definition driver.cpp:124
void activate_drivers()
Activate the drivers.
Definition driver.cpp:232
void on_driver_selected(Driver *) final
When a driver is selected add it to the manager.
Definition driver.cpp:145
uint32_t reset_devices()
Reset all the devices.
Definition driver.cpp:188
void remove_driver_selector(DriverSelector *)
Remove a driver selector from the manager.
Definition driver.cpp:165
void add_driver_selector(DriverSelector *)
Add a driver selector to the manager.
Definition driver.cpp:154
void deactivate_drivers()
Deactivate the drivers.
Definition driver.cpp:221
void initialise_drivers()
Initialise the drivers.
Definition driver.cpp:208
void find_drivers()
Find the drivers.
Definition driver.cpp:174
~DriverManager()
Destructor for the Driver Manager, removes all drivers and driver selectors.
Definition driver.cpp:107
void remove_driver(Driver *)
Removes a driver from the driver vector.
Definition driver.cpp:133
Event handler for the DriverSelector class, handles the event when a driver is selected.
Definition driver.h:47
virtual void on_driver_selected(Driver *)
This function is called when a driver is selected.
Definition driver.cpp:79
Selects the drivers to be used.
Definition driver.h:58
virtual void select_drivers(DriverSelectorEventHandler *handler)
Select the drivers available on the system.
Definition driver.cpp:91
base class for all drivers, handles the activation, deactivation, initialisation and reset of the dri...
Definition driver.h:27
virtual string vendor_name()
Get who created the device.
Definition driver.cpp:57
virtual uint32_t reset()
Reset the driver.
Definition driver.cpp:48
virtual string device_name()
Get the device name of the driver.
Definition driver.cpp:66
virtual void initialise()
Initialise the driver.
Definition driver.cpp:39
virtual void activate()
Activate the driver.
Definition driver.cpp:25
virtual void deactivate()
Deactivate the driver.
Definition driver.cpp:32
Defines classes for handling events and event managers.
Defines a Logger class for logging messages with different severity levels to multiple output streams...
Defines a MemoryManager class for handling memory allocation and deallocation.
Defines OutputStream and GenericOutputStream classes for writing data to streams.
Defines a String class for dynamically sized strings with various operations.