| 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 "storage/discs/IDiscDriveHandler.h" |
| 12 |
|
| 13 |
#include <string> |
| 14 |
|
| 15 |
class CDiscDriveHandlerPosix : public IDiscDriveHandler |
| 16 |
{ |
| 17 |
public: |
| 18 |
/*! \brief Posix DiscDriveHandler constructor |
| 19 |
*/ |
| 20 |
CDiscDriveHandlerPosix() = default; |
| 21 |
|
| 22 |
/*! \brief Posix DiscDriveHandler default destructor |
| 23 |
*/ |
| 24 |
~CDiscDriveHandlerPosix() override = default; |
| 25 |
|
| 26 |
/*! \brief Get the optical drive state provided its device path |
| 27 |
* \param devicePath the path for the device drive (e.g. /dev/sr0) |
| 28 |
* \return The drive state |
| 29 |
*/ |
| 30 |
DriveState GetDriveState(const std::string& devicePath) override; |
| 31 |
|
| 32 |
/*! \brief Get the optical drive tray state provided the drive device path |
| 33 |
* \param devicePath the path for the device drive (e.g. /dev/sr0) |
| 34 |
* \return The drive state |
| 35 |
*/ |
| 36 |
TrayState GetTrayState(const std::string& devicePath) override; |
| 37 |
|
| 38 |
/*! \brief Eject the provided drive device |
| 39 |
* \param devicePath the path for the device drive (e.g. /dev/sr0) |
| 40 |
*/ |
| 41 |
void EjectDriveTray(const std::string& devicePath) override; |
| 42 |
|
| 43 |
/*! \brief Close the provided drive device |
| 44 |
* \note Some drives support closing appart from opening/eject |
| 45 |
* \param devicePath the path for the device drive (e.g. /dev/sr0) |
| 46 |
*/ |
| 47 |
void CloseDriveTray(const std::string& devicePath) override; |
| 48 |
|
| 49 |
/*! \brief Toggle the state of a given drive device |
| 50 |
* |
| 51 |
* Will internally call EjectDriveTray or CloseDriveTray depending on |
| 52 |
* the internal state of the drive (i.e. if open -> CloseDriveTray / |
| 53 |
* if closed -> EjectDriveTray) |
| 54 |
* |
| 55 |
* \param devicePath the path for the device drive (e.g. /dev/sr0) |
| 56 |
*/ |
| 57 |
void ToggleDriveTray(const std::string& devicePath) override; |
| 58 |
}; |