kodi
IDiscDriveHandler.h
1 /*
2  * Copyright (C) 2022 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include <memory>
12 #include <string>
13 
15 enum class DriveState
16 {
18  OPEN,
20  NOT_READY,
22  READY,
24  CLOSED_NO_MEDIA,
26  CLOSED_MEDIA_PRESENT,
28  NONE,
30  CLOSED_MEDIA_UNDEFINED
31 };
32 
34 enum class TrayState
35 {
37  UNDEFINED,
39  OPEN,
41  CLOSED_NO_MEDIA,
43  CLOSED_MEDIA_PRESENT
44 };
45 
49 {
50 public:
55  virtual DriveState GetDriveState(const std::string& devicePath) = 0;
56 
61  virtual TrayState GetTrayState(const std::string& devicePath) = 0;
62 
66  virtual void EjectDriveTray(const std::string& devicePath) = 0;
67 
72  virtual void CloseDriveTray(const std::string& devicePath) = 0;
73 
82  virtual void ToggleDriveTray(const std::string& devicePath) = 0;
83 
88  static std::shared_ptr<IDiscDriveHandler> CreateInstance();
89 
90 protected:
91  virtual ~IDiscDriveHandler() = default;
92  IDiscDriveHandler() = default;
93 };
Generic interface for platform disc drive handling.
Definition: IDiscDriveHandler.h:48