ApraLinuxUtils 1.0.0
C++ utility library for embedded Linux systems
 
Loading...
Searching...
No Matches
apra::StorageUSB Class Reference

#include <StorageUSB.h>

Public Member Functions

 StorageUSB (std::string mountPath, std::vector< STORAGE_TYPE > supportedTypes, bool shouldPrint, bool skipMount=false)
 
virtual ~StorageUSB ()
 
virtual string insertCheck ()
 
virtual string mountDevice ()
 
virtual bool ejectDevice ()
 
virtual bool isUnsafeEject ()
 
bool getStorageInfo (uint64_t &freeSpaceInMB, uint64_t &totalCapacityInMB)
 
STORAGE_STATE getStatus ()
 
std::string getMountPath ()
 
struct udev_device * getChildDevice (struct udev *udev, struct udev_device *parent, const char *subsystem)
 

Protected Member Functions

string findMountDeviceBylsblk (string devicePartitionNode)
 
string findMountedDevice (string devicePartitionNode)
 
std::string enumerateDevices (struct udev *udev)
 
std::vector< StorageMinimalInfogetPartitions (std::string devpath)
 
bool mountDeviceNode (string deviceNode)
 
bool mountUSBDevice (StorageMinimalInfo storageDevice, uint8_t retryLimit=3)
 
bool unMountUSBDevice ()
 
bool unMountWithPrivilege ()
 
bool unMountWithoutPrivilege ()
 
bool mountWithPrivilege (StorageMinimalInfo storageDevice, uint8_t retryLimit=3)
 
bool mountWithoutPrivilege (StorageMinimalInfo storageDevice)
 
StorageMinimalInfo getHighCapacityPartition (std::string deviceNode)
 
bool isDeviceNodeConnected ()
 
void checkDeviceNode ()
 

Protected Attributes

bool m_shouldPrint
 
std::vector< STORAGE_TYPEm_supportedTypes
 
std::string m_mountPoint
 
std::string m_deviceNode
 
std::string m_partitionNode
 
bool m_skipMount
 
STORAGE_STATE m_state
 
std::string m_manualPath
 
int8_t m_retryCount
 

Detailed Description

Definition at line 23 of file StorageUSB.h.

Constructor & Destructor Documentation

◆ StorageUSB()

apra::StorageUSB::StorageUSB ( std::string  mountPath,
std::vector< STORAGE_TYPE supportedTypes,
bool  shouldPrint,
bool  skipMount = false 
)

Definition at line 37 of file StorageUSB.cpp.

References m_mountPoint, and m_supportedTypes.

◆ ~StorageUSB()

apra::StorageUSB::~StorageUSB ( )
virtual

Definition at line 59 of file StorageUSB.cpp.

Member Function Documentation

◆ checkDeviceNode()

void apra::StorageUSB::checkDeviceNode ( )
protected

Definition at line 646 of file StorageUSB.cpp.

References m_deviceNode, m_retryCount, m_state, and apra::STORAGE_SAFE_EJECT.

◆ ejectDevice()

bool apra::StorageUSB::ejectDevice ( )
virtual

◆ enumerateDevices()

string apra::StorageUSB::enumerateDevices ( struct udev *  udev)
protected

Definition at line 98 of file StorageUSB.cpp.

References getChildDevice().

Referenced by insertCheck().

◆ findMountDeviceBylsblk()

string apra::StorageUSB::findMountDeviceBylsblk ( string  devicePartitionNode)
protected

◆ findMountedDevice()

string apra::StorageUSB::findMountedDevice ( string  devicePartitionNode)
protected

Definition at line 564 of file StorageUSB.cpp.

◆ getChildDevice()

struct udev_device * apra::StorageUSB::getChildDevice ( struct udev *  udev,
struct udev_device *  parent,
const char *  subsystem 
)

Definition at line 78 of file StorageUSB.cpp.

Referenced by enumerateDevices().

◆ getHighCapacityPartition()

StorageMinimalInfo apra::StorageUSB::getHighCapacityPartition ( std::string  deviceNode)
protected

◆ getMountPath()

std::string apra::StorageUSB::getMountPath ( )

Definition at line 68 of file StorageUSB.cpp.

References m_mountPoint, m_state, and apra::STORAGE_MOUNTED.

◆ getPartitions()

vector< StorageMinimalInfo > apra::StorageUSB::getPartitions ( std::string  devpath)
protected

◆ getStatus()

STORAGE_STATE apra::StorageUSB::getStatus ( )

Definition at line 63 of file StorageUSB.cpp.

References m_state.

◆ getStorageInfo()

bool apra::StorageUSB::getStorageInfo ( uint64_t &  freeSpaceInMB,
uint64_t &  totalCapacityInMB 
)

Definition at line 590 of file StorageUSB.cpp.

References m_mountPoint, and m_shouldPrint.

◆ insertCheck()

string apra::StorageUSB::insertCheck ( )
virtual

◆ isDeviceNodeConnected()

bool apra::StorageUSB::isDeviceNodeConnected ( )
protected

Definition at line 265 of file StorageUSB.cpp.

References m_mountPoint.

◆ isUnsafeEject()

bool apra::StorageUSB::isUnsafeEject ( )
virtual

◆ mountDevice()

◆ mountDeviceNode()

bool apra::StorageUSB::mountDeviceNode ( string  deviceNode)
protected

◆ mountUSBDevice()

bool apra::StorageUSB::mountUSBDevice ( StorageMinimalInfo  storageDevice,
uint8_t  retryLimit = 3 
)
protected

◆ mountWithoutPrivilege()

bool apra::StorageUSB::mountWithoutPrivilege ( StorageMinimalInfo  storageDevice)
protected

◆ mountWithPrivilege()

bool apra::StorageUSB::mountWithPrivilege ( StorageMinimalInfo  storageDevice,
uint8_t  retryLimit = 3 
)
protected

◆ unMountUSBDevice()

bool apra::StorageUSB::unMountUSBDevice ( )
protected

◆ unMountWithoutPrivilege()

bool apra::StorageUSB::unMountWithoutPrivilege ( )
protected

◆ unMountWithPrivilege()

bool apra::StorageUSB::unMountWithPrivilege ( )
protected

Definition at line 471 of file StorageUSB.cpp.

References m_mountPoint, and m_shouldPrint.

Referenced by unMountUSBDevice().

Member Data Documentation

◆ m_deviceNode

std::string apra::StorageUSB::m_deviceNode
protected

◆ m_manualPath

std::string apra::StorageUSB::m_manualPath
protected

Definition at line 63 of file StorageUSB.h.

Referenced by mountUSBDevice().

◆ m_mountPoint

std::string apra::StorageUSB::m_mountPoint
protected

◆ m_partitionNode

std::string apra::StorageUSB::m_partitionNode
protected

◆ m_retryCount

int8_t apra::StorageUSB::m_retryCount
protected

Definition at line 64 of file StorageUSB.h.

Referenced by checkDeviceNode(), ejectDevice(), isUnsafeEject(), and mountDevice().

◆ m_shouldPrint

◆ m_skipMount

bool apra::StorageUSB::m_skipMount
protected

Definition at line 61 of file StorageUSB.h.

Referenced by mountDevice().

◆ m_state

STORAGE_STATE apra::StorageUSB::m_state
protected

◆ m_supportedTypes

std::vector<STORAGE_TYPE> apra::StorageUSB::m_supportedTypes
protected

Definition at line 57 of file StorageUSB.h.

Referenced by mountDevice(), and StorageUSB().


The documentation for this class was generated from the following files: