ADTF  v2.14.3
cSystem Class Reference

System or platform specific functions. More...

Classes

class  cAdapterInfo
 Helper class to store ethernet adapter infos, see cSystem::GetEthernetAdapterInfo. More...
 
class  IAdapterInfoCallback
 Callback for cSystem::GetEthernetAdapterInfo() More...
 

Static Public Member Functions

static tUInt32 GetLastSystemError ()
 Returns the last system error. More...
 
static cString GetLastErrorString (const tUInt32 ui32Error)
 Returns a descriptive string of the last error. More...
 
static cString GetEnvVariable (const cString &strName, const cString &strDefaultValue="")
 This function fetches values from the system's environment configuration. More...
 
static tResult SetEnvVariable (const cString &strName, const cString &strValue)
 This function creates a system's environment variable for the current execution. More...
 
static cString GetUserName ()
 This function gets the user name currently logged on. More...
 
static cString GetComputerName ()
 This function gets the name of the local computer. More...
 
static tInt32 Execute (const cFilename &strExeFile, const cString &strArgs="", const cFilename &strWorkingPath="", const tBool bModal=tFalse, cString *pOutput=NULL)
 Starts an executable and optionally wait for the application to close down. More...
 
static tResult ChildExecute (tUInt64 *pChildProcessId, const cFilename &strExeFile, const cString &strArgs="")
 Starts a child process. More...
 
static tResult ChildWait (tUInt64 nChildProcessId, tTimeStamp tmTimeOut=-1)
 Wait until a child process exits. More...
 
static tResult ChildTerminate (tUInt64 nChildProcessId)
 Terminates a child process. More...
 
static tUInt32 OpenDocument (tHandle hWndParent, const cFilename &strFilename, const cString &strWorkingPath="", tBool bModal=tFalse, tBool bMessage=tFalse)
 Opens a document with the registered standard application. More...
 
static tUInt32 OpenFolder (tHandle hWndParent, const cFilename &strFilename, tHandle &hProcessHandle, tBool bModal=tFalse)
 Opens an Explorer window that points to the specified folder. More...
 
static cFilename GetModuleFilename (const tHandle hModule=NULL)
 Returns the filename of a given module. More...
 
static tTimeStamp GetTime ()
 On Windows platform method will return elapsed time in microseconds since the system was started. More...
 
static tVoid Sleep (tTimeStamp tmMicroseconds)
 The calling thread will sleep for the specified amount of time. More...
 
static tResult GetMACAddress (cString &strMACAddress)
 Returns the MAC Address of the first networking interface. More...
 
static tInt GetProcessorCount ()
 Returns the count of processors. More...
 
static tInt32 GetCurrentThreadId ()
 Returns the current thread id. More...
 
static tInt32 GetCurrentProcessId ()
 Returns the current process id. More...
 
static tUInt64 GetVirtualUserMemoryTotal ()
 Returns the total amount of virtual memory for User-mode applications. More...
 
static tUInt64 GetVirtualUserMemoryUsed ()
 Returns the amount of virtual user memory currently used (process) More...
 
static tUInt64 GetVirtualMemoryTotal ()
 Returns the total amount of virtual memory. More...
 
static tUInt64 GetVirtualMemoryUsed ()
 Returns the amount of virtual memory currently used (system global) More...
 
static tUInt64 GetVirtualMemoryUsedByMe ()
 Returns the amount of virtual memory currently used by the calling process. More...
 
static tUInt64 GetPhysicalMemoryTotal ()
 Returns the total amount of physical memory. More...
 
static tUInt64 GetPhysicalMemoryUsed (tBool bIncludeCaches=tFalse)
 Returns the amount of physical memory currently used (system global) More...
 
static tUInt64 GetPhysicalMemoryUsedByMe ()
 Returns the amount of physical memory currently used by the calling process. More...
 
static tResult GetMallocInfo (tUInt64 &nMallocTotal, tUInt64 &nMallocFree, tUInt64 &nMallocUsed)
 Returns information about the status of malloc memory handling. More...
 
static tResult HasIfaceWithMAC (const cString &strMACAddress)
 Checks whether he host as an interface with a specific MAC address. More...
 
static tBool QueryDriveSpace (const cString &strDriveLetter, tUInt64 &uint64FreeSize)
 This Function retrieves the free disk space in bytes for the specified location (win32). More...
 
static tResult SwapEndian (tUInt16 *pui16Value)
 Swaps the bytes of a 16 Bit value in place. More...
 
static tResult SwapEndian (tUInt32 *pui32Value)
 Swaps the bytes of a 32 Bit value in place. More...
 
static tResult SwapEndian (tUInt64 *pui64Value)
 Swaps the bytes of a 64 Bit value in place. More...
 
static tResult HostToNetwork (tUInt16 *pui16Value)
 Swaps the bytes of a 16 Bit value from host to network byte order. More...
 
static tResult HostToNetwork (tUInt32 *pui32Value)
 Swaps the bytes of a 32 Bit value from host to network byte order. More...
 
static tResult HostToNetwork (tUInt64 *pui64Value)
 Swaps the bytes of a 64 Bit value from host to network byte order. More...
 
static tResult NetworkToHost (tUInt16 *pui16Value)
 Swaps the bytes of a 16 Bit value from network to host byte order. More...
 
static tResult NetworkToHost (tUInt32 *pui32Value)
 Swaps the bytes of a 32 Bit value from network to host byte order. More...
 
static tResult NetworkToHost (tUInt64 *pui64Value)
 Swaps the bytes of a 64 Bit value from network to host byte order. More...
 
static tResult SendMail (const cString &strOriginator, const cString &strOriginatorName, const cString &strRecipient, const cString &strRecipientName, const cString &strSubject, const cString &strText, const cString &strFilePath)
 Sends an email (win32). More...
 
static tResult GetEthernetAdapterInfo (IAdapterInfoCallback *pAdapterInfo)
 Returns all detected ethernet adapters. More...
 

Detailed Description

System or platform specific functions.

Definition at line 27 of file system.h.

Member Function Documentation

static tResult ChildExecute ( tUInt64 pChildProcessId,
const cFilename strExeFile,
const cString strArgs = "" 
)
static

Starts a child process.

Parameters
[out]pChildProcessIdThe process id of the child process.
[in]strExeFileThe executable that should be launched.
[in]strArgsAddidional arguments.
Returns
ERR_UNEXPECTED if something goes wrong, see GetLastSystemError().
static tResult ChildTerminate ( tUInt64  nChildProcessId)
static

Terminates a child process.

Parameters
[in]nChildProcessIdThe process id of the child process.
Returns
ERR_UNKNOWN when something goes wrong, see GetLastSystemError().
static tResult ChildWait ( tUInt64  nChildProcessId,
tTimeStamp  tmTimeOut = -1 
)
static

Wait until a child process exits.

Note that after the process has exited, this method can only be called once.

Parameters
[in]nChildProcessIdThe process id of the child process.
[in]tmTimeOutTimeout in microseconds: -1 -> no timeout, 0 -> return immediately.
Returns
ERR_TIMEOUT when the process has not exited.
static tInt32 Execute ( const cFilename strExeFile,
const cString strArgs = "",
const cFilename strWorkingPath = "",
const tBool  bModal = tFalse,
cString pOutput = NULL 
)
static

Starts an executable and optionally wait for the application to close down.

Parameters
strExeFile[in] Path to executable.
strArgs[in] Arguments to be passed to the executable.
strWorkingPath[in] Working path. If empty uses current working directory.
bModal[in] Bool that specifies if the function should wait for the application to close down.
pOutput[out] Optional: all output to stdout will be stored here.
Returns
This function returns the exit code of the application. If the modal flag is set to tFalse , the function returns 0;
static cString GetComputerName ( )
static

This function gets the name of the local computer.

Returns
computer name
static tInt32 GetCurrentProcessId ( )
static

Returns the current process id.

Returns
Id of the current process
static tInt32 GetCurrentThreadId ( )
static

Returns the current thread id.

Returns
Id of the current thread
static cString GetEnvVariable ( const cString strName,
const cString strDefaultValue = "" 
)
static

This function fetches values from the system's environment configuration.

Parameters
strName[in] Name of environment variable to be fetched.
strDefaultValue[in] Value that is returned if the environment variable doesn't exist.
Returns
The function creates a new cString object that is initialized with the environment value.
static tResult GetEthernetAdapterInfo ( IAdapterInfoCallback pAdapterInfo)
static

Returns all detected ethernet adapters.

Parameters
[in,out]pAdapterInfoCallback for retrieval of all adapter information.
Returns
Standard result.
static cString GetLastErrorString ( const tUInt32  ui32Error)
static

Returns a descriptive string of the last error.

Parameters
ui32Error[in] An error code to be translated
Returns
The error string.
static tUInt32 GetLastSystemError ( )
static

Returns the last system error.

Returns
The last system error in windows and errno in linux
static tResult GetMACAddress ( cString strMACAddress)
static

Returns the MAC Address of the first networking interface.

Parameters
strMACAddress[out] The destination string.
Returns
Standard result.
static tResult GetMallocInfo ( tUInt64 nMallocTotal,
tUInt64 nMallocFree,
tUInt64 nMallocUsed 
)
static

Returns information about the status of malloc memory handling.

Parameters
[out]nMallocTotalThe total amount of memory requested from the OS.
[out]nMallocFreeThe unused portion of the requested memory.
[out]nMallocUsedThe used portion of the requested memory, this number tells how much memory your program uses.
Returns
Standard result.
static cFilename GetModuleFilename ( const tHandle  hModule = NULL)
static

Returns the filename of a given module.

Returns the filename of a module specified by a handle/pointer in the argument hModule. If hModule is NULL (or not set) the current executable is returned. If an error occurs the path returned is empty ("").

Note
If the filename of the module (including path) is longer than MAX_PATH characters, the result is truncated to MAX_PATH characters.
Warning
For some Linux/Unix derivatives (such as FreeBSD or Solaris) this method returns an empty string ("") if the current executable is requested (i.e. hModule is NULL or not set). More specific this method only names a valid executable on Linux/Unix systems that support a link via /proc/self/exe. (Regular calls with hModule != NULL work anyway.)
Parameters
hModule[in] Handle to a module or a function. If NULL (or not set), the current executable is returned.
Returns
The filename.
static tUInt64 GetPhysicalMemoryTotal ( )
static

Returns the total amount of physical memory.

Returns
number of bytes of physical memory total
static tUInt64 GetPhysicalMemoryUsed ( tBool  bIncludeCaches = tFalse)
static

Returns the amount of physical memory currently used (system global)

Parameters
[in]bIncludeCachesWhether or not to include system caches and buffers into the calculation (This has no effect on Windows).
Returns
number of bytes of physical memory used
static tUInt64 GetPhysicalMemoryUsedByMe ( )
static

Returns the amount of physical memory currently used by the calling process.

Returns
number of bytes of physical memory used by current process
static tInt GetProcessorCount ( )
static

Returns the count of processors.

Returns
Count of processors will be a positive number > 0
Remarks
This method will never fail and the return value will not change during runtime.
static tTimeStamp GetTime ( )
static

On Windows platform method will return elapsed time in microseconds since the system was started.

On Linux platform method will return time in microseconds since some unspecified starting point.

Returns
The time in microseconds.
This method is real-time safe.
See The ADTF Real-Time Extension.
static cString GetUserName ( )
static

This function gets the user name currently logged on.

Returns
user name
static tUInt64 GetVirtualMemoryTotal ( )
static

Returns the total amount of virtual memory.

Returns
number of bytes of virtual memory total
static tUInt64 GetVirtualMemoryUsed ( )
static

Returns the amount of virtual memory currently used (system global)

Returns
number of bytes of virtual memory used
static tUInt64 GetVirtualMemoryUsedByMe ( )
static

Returns the amount of virtual memory currently used by the calling process.

Returns
number of bytes of virtual memory used by current process
static tUInt64 GetVirtualUserMemoryTotal ( )
static

Returns the total amount of virtual memory for User-mode applications.

Returns
number of bytes of virtual user memory total
static tUInt64 GetVirtualUserMemoryUsed ( )
static

Returns the amount of virtual user memory currently used (process)

Returns
number of bytes of virtual user memory used
static tResult HasIfaceWithMAC ( const cString strMACAddress)
static

Checks whether he host as an interface with a specific MAC address.

Parameters
strMACAddress[in] The MAC address
Returns
Standard result.
static tResult HostToNetwork ( tUInt16 pui16Value)
static

Swaps the bytes of a 16 Bit value from host to network byte order.

Parameters
pui16Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult HostToNetwork ( tUInt32 pui32Value)
static

Swaps the bytes of a 32 Bit value from host to network byte order.

Parameters
pui32Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult HostToNetwork ( tUInt64 pui64Value)
static

Swaps the bytes of a 64 Bit value from host to network byte order.

Parameters
pui64Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult NetworkToHost ( tUInt16 pui16Value)
static

Swaps the bytes of a 16 Bit value from network to host byte order.

Parameters
pui16Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult NetworkToHost ( tUInt32 pui32Value)
static

Swaps the bytes of a 32 Bit value from network to host byte order.

Parameters
pui32Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult NetworkToHost ( tUInt64 pui64Value)
static

Swaps the bytes of a 64 Bit value from network to host byte order.

Parameters
pui64Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tUInt32 OpenDocument ( tHandle  hWndParent,
const cFilename strFilename,
const cString strWorkingPath = "",
tBool  bModal = tFalse,
tBool  bMessage = tFalse 
)
static

Opens a document with the registered standard application.

REMARK: On Linux this command will call "kfmclient", "gnome-open", "gvfs-open" or "xdg-open" with the document name. Make sure one of these programs is installed on the system to make cSystem::OpenDocument work.

Parameters
hWndParent[in] Parent window for application (win32). Can be NULL.
strFilename[in] Path to document.
strWorkingPath[in] Working path.
bModal[in] Bool that specifies if the function should wait for the application to close down.
bMessage[in] If true messages will be displayed
Returns
This function returns the exit code of the application. If the modal flag is set, the function returns 0;
static tUInt32 OpenFolder ( tHandle  hWndParent,
const cFilename strFilename,
tHandle hProcessHandle,
tBool  bModal = tFalse 
)
static

Opens an Explorer window that points to the specified folder.

This works only on windows. With Linux this method has no functionality and returns always with 0xFFFFFFFF

Parameters
hWndParent[in] Parent window for Exporer.
strFilename[in] Path to folder.
hProcessHandle[out] Process handle.
bModal[in] if true then the new window will be opened modal
Returns
returns the exit code of the dialog.
static tBool QueryDriveSpace ( const cString strDriveLetter,
tUInt64 uint64FreeSize 
)
static

This Function retrieves the free disk space in bytes for the specified location (win32).

There is no functionality with linux and returns always with tFalse

Parameters
strDriveLetter[in] Specifies the root directory of the disk. A trailing backslash is required.
uint64FreeSize[out] free bytes
Returns
const tBool -> tTrue: successful
static tResult SendMail ( const cString strOriginator,
const cString strOriginatorName,
const cString strRecipient,
const cString strRecipientName,
const cString strSubject,
const cString strText,
const cString strFilePath 
)
static

Sends an email (win32).

Under Linux this method has no functionality and returns always with ERR_NOT_SUPPORTED

Parameters
strOriginator[in] The senders mail address.
strOriginatorName[in] The senders name.
strRecipient[in] The recipients mali address.
strRecipientName[in] The recipients name.
strSubject[in] The subject of the message.
strText[in] The message content.
strFilePath[in] An attachment file.
Returns
Standard result.
static tResult SetEnvVariable ( const cString strName,
const cString strValue 
)
static

This function creates a system's environment variable for the current execution.

Parameters
[in]strNameName of environment variable to set.
[in]strValueValue to set.
Returns
The Standard Result Code.
static tVoid Sleep ( tTimeStamp  tmMicroseconds)
static

The calling thread will sleep for the specified amount of time.

Parameters
tmMicroseconds[in] The time to sleep in microsenconds.
Returns
void
static tResult SwapEndian ( tUInt16 pui16Value)
static

Swaps the bytes of a 16 Bit value in place.

Parameters
pui16Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult SwapEndian ( tUInt32 pui32Value)
static

Swaps the bytes of a 32 Bit value in place.

Parameters
pui32Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult SwapEndian ( tUInt64 pui64Value)
static

Swaps the bytes of a 64 Bit value in place.

Parameters
pui64Value[inout] The value.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)