2020-10-03 19:02:31 +02:00
/*
* Self . h
*
* Created on : Sep 28 , 2020
* Author : jief
*/
# ifndef PLATFORM_SELFOEM_H_
# define PLATFORM_SELFOEM_H_
2021-04-28 20:30:34 +02:00
# include "../Settings/Self.h"
# include "../Settings/ConfigManager.h"
2020-10-03 19:02:31 +02:00
class SelfOem
{
protected :
2020-10-20 09:55:46 +02:00
XString8 m_ConfName = NullXString8 ; // Initialisation required by -Weffc++. Couldn't use default ctor.
2020-10-03 19:02:31 +02:00
2021-09-28 15:54:31 +02:00
// XBool m_OemDirExists;
2020-10-17 15:01:33 +02:00
EFI_FILE * m_OemDir = NULL ;
2020-10-20 09:55:46 +02:00
XStringW m_OemPathRelToSelfDir = NullXStringW ;
XStringW m_OemFulPath = NullXStringW ;
2020-10-03 19:02:31 +02:00
2020-10-17 15:01:33 +02:00
// const EFI_FILE* m_userConfigDir = NULL;
2020-10-20 09:55:46 +02:00
XStringW m_configDirPathRelToSelfDir = NullXStringW ; // could also be empty if config dir is clover dir.
XStringW m_configDirPathRelToSelfDirWithTrailingSlash = NullXStringW ; // could also be empty if config dir is clover dir.
2020-10-17 15:01:33 +02:00
EFI_FILE * m_KextsDir = NULL ;
2020-10-20 09:55:46 +02:00
XStringW m_KextsPathRelToSelfDir = NullXStringW ;
XStringW m_KextsFullPath = NullXStringW ;
2020-10-03 19:02:31 +02:00
2021-09-28 15:54:31 +02:00
// EFI_STATUS _openDir(const XStringW& path, XBool* b, EFI_FILE** efiDir);
XBool _checkOEMPath ( ) ;
XBool _setOemPathRelToSelfDir ( XBool isFirmwareClover , const XString8 & OEMBoard , const XString8 & OEMProduct , INT32 frequency , const XObjArray < LanCardClass > & lanCardArray ) ;
2020-10-03 19:02:31 +02:00
EFI_STATUS _initialize ( ) ;
public :
2020-10-17 15:01:33 +02:00
SelfOem ( ) { } ;
2020-10-03 19:02:31 +02:00
SelfOem ( const SelfOem & ) = delete ;
SelfOem & operator = ( const SelfOem & ) = delete ;
~ SelfOem ( ) { } ;
2021-09-28 15:54:31 +02:00
EFI_STATUS initialize ( const XString8 & confName , XBool isFirmwareClover , const XString8 & OEMBoard , const XString8 & OEMProduct , INT32 frequency , const XObjArray < LanCardClass > & lanCardArray ) ;
2020-10-23 08:04:01 +02:00
void unInitialize ( ) ;
2020-10-03 19:02:31 +02:00
EFI_STATUS reInitialize ( ) ;
void closeHandle ( ) ;
2021-09-28 15:54:31 +02:00
XBool isInitialized ( ) const { return m_ConfName . notEmpty ( ) ; }
2021-04-23 14:20:48 +02:00
2020-10-03 19:02:31 +02:00
const XString8 & getConfName ( ) { return m_ConfName ; }
2021-09-28 15:54:31 +02:00
XBool oemDirExists ( ) { return m_OemPathRelToSelfDir . notEmpty ( ) ; }
2020-10-17 15:01:33 +02:00
const EFI_FILE & getOemDir ( ) { assert ( m_OemDir ! = NULL ) ; return * m_OemDir ; }
const XStringW & getOemPathRelToSelfDir ( ) { assert ( m_OemPathRelToSelfDir . notEmpty ( ) ) ; return m_OemPathRelToSelfDir ; }
const XStringW & getOemFullPath ( ) { assert ( m_OemFulPath . notEmpty ( ) ) ; return m_OemFulPath ; }
const EFI_FILE & getConfigDir ( ) { if ( m_OemDir ! = NULL ) return * m_OemDir ; return self . getCloverDir ( ) ; }
const XStringW & getConfigDirPathRelToSelfDir ( ) { return m_configDirPathRelToSelfDirWithTrailingSlash ; }
const XStringW & getConfigDirPathRelToSelfDirWithTrailingSlash ( ) { return m_configDirPathRelToSelfDirWithTrailingSlash ; }
const XStringW & getConfigDirFullPath ( ) { if ( m_OemDir ! = NULL ) return getOemFullPath ( ) ; return self . getCloverDirFullPath ( ) ; }
2020-10-03 19:02:31 +02:00
2021-09-28 15:54:31 +02:00
XBool isKextsDirFound ( ) { return m_KextsDir ! = NULL ; }
2020-10-17 15:01:33 +02:00
const EFI_FILE & getKextsDir ( ) { assert ( m_KextsDir ! = NULL ) ; return * m_KextsDir ; }
2024-01-02 19:54:23 +01:00
const XStringW & getKextsDirPathRelToSelfDir ( ) { assert ( m_KextsPathRelToSelfDir . notEmpty ( ) ) ; return m_KextsPathRelToSelfDir ; } // Usually "Kexts". Init from KEXTS_DIRNAME
2020-10-17 15:01:33 +02:00
const XStringW & getKextsFullPath ( ) { assert ( m_KextsFullPath . notEmpty ( ) ) ; return m_KextsFullPath ; }
2020-10-03 19:02:31 +02:00
} ;
extern SelfOem selfOem ;
# endif /* PLATFORM_SELF_H_ */