📄 exdevice.h
字号:
#ifndef __EXDEVICE__H__
#define __EXDEVICE__H__
/*---------------------------------------------------------------------------------*/
#include "excustom.h"
#include "defines.h"
#include "exstatus.h"
/*---------------------------------------------------------------------------------*/
/* device types */
typedef enum
{
EX_EMPTY_DEVICE = 0, /* unknown device */
EX_MEM_DEVICE, /* dynamic allocated memory */
EX_COMMAND_LINE_DEVICE, /* command line parameters */
EX_MSG_DEVICE, /* messages */
EX_ERROR_MSG_DEVICE, /* error messages */
EX_SERIAL_READ_DEVICE, /* non-random access media - read */
EX_SERIAL_WRITE_DEVICE, /* non-random access media - write */
EX_PROGRESS_BAR_DEVICE, /* progress bar "x of y" */
EX_USER_INPUT_DEVICE /* keyboard/mouse input */
} ExDeviceType;
/*---------------------------------------------------------------------------------*/
/* device record */
typedef struct
{
#ifdef EX_USE_CLOSE_ALL_DEVICES
ExDeviceType type; /* device type */
EXWORD wCloseAllEntry;
#endif /* EX_USE_CLOSE_ALL_DEVICES */
void EXFAR* data; /* device customization buffer */
}ExDevice;
/*---------------------------------------------------------------------------------*/
/* Command line device functions prototypes */
#ifdef EX_USE_COMMAND_LINE_DEVICE
ExStatus OpenCmdLineDevice( ExDevice* pDevice );
ExStatus CloseCmdLineDevice( ExDevice* pDevice );
ExStatus ReadCmdLineDevice( ExDevice* pDevice, EXWORD argc, void**retCommand );
#endif /* EX_USE_COMMAND_LINE_DEVICE */
/*---------------------------------------------------------------------------------*/
/* Massage device functions prototypes */
#ifdef EX_USE_MSG_DEVICE
ExStatus OpenMsgDevice( ExDevice* pDevice );
ExStatus CloseMsgDevice( ExDevice* pDevice );
ExStatus WriteMsgDevice( ExDevice* pDevice, void* pStr );
#endif /* EX_USE_MSG_DEVICE */
/*---------------------------------------------------------------------------------*/
/* Error Massage device functions prototypes */
#ifdef EX_USE_MSG_DEVICE
ExStatus OpenErrorMsgDevice( ExDevice* pDevice );
ExStatus CloseErrorMsgDevice( ExDevice* pDevice );
ExStatus WriteErrorMsgDevice( ExDevice* pDevice, void* pErrStr );
#endif /* EX_USE_MSG_DEVICE */
/*---------------------------------------------------------------------------------*/
/* Progress bar device functions prototypes */
ExStatus OpenPrgBarDevice( ExDevice* pDevice, EXCHAR* pPrgBarName, EXDWORD dwPrgBarSize );
ExStatus ClosePrgBarDevice( ExDevice* pDevice );
ExStatus WritePrgBarDevice( ExDevice* pDevice, EXDWORD dwDoneSoFar );
/*---------------------------------------------------------------------------------*/
/* Serial file device functions prototypes */
ExStatus OpenSerialReadFileDevice( ExDevice* pDevice, EXCHAR* pFileName );
ExStatus OpenSerialWriteFileDevice( ExDevice* pDevice, EXCHAR* pFileName );
ExStatus CloseWriteSerialFileDevice( ExDevice* pDevice );
ExStatus CloseReadSerialFileDevice( ExDevice* pDevice );
ExStatus ReadSerialFileDevice( ExDevice* pDevice, void EXFAR* pBuff, EXDWORD Len ,EXDWORD* retBytesRead );
ExStatus WriteSerialFileDevice( ExDevice* pDevice, void EXFAR* pBuff, EXDWORD Len);
ExStatus SeekSerialFileDevice ( ExDevice* pDevice,EXDWORD dwOffset,int Origin);
ExStatus GetLengthOfSerialFileDevice( ExDevice* pDevice, EXDWORD* retLen );
#define EX_READ_ONLY_FILE 1
#define EX_WRITE_ONLY_FILE 2
/*---------------------------------------------------------------------------------*/
/* Serial user input device functions prototypes */
#ifdef EX_USE_USER_INPUT
typedef struct
{
EXCHAR* pName;
EXCHAR cKey;
}ExChoices;
typedef struct
{
EXCHAR* pName;
EXWORD wNoOfChoices;
EXWORD wDefaultChoice;
ExChoices* pChoices;
EXWORD wResult; /* no of choiced or wNoOfChoices */
}ExWaitForCharChoices;
/*---------------------------------------------------------------------------------*/
/* for example,
"All data on disk C: will be destroyed. Continue? "Yes" "No" "Cancel" "Help" "help me!"
{
EXCHAR*pName; "All data on disk C: will be destroyed. Continue?"
EXWORD wNoOfChoices; 5
EXWORD wDefaultChoice; 4
struct
{
EXCHAR*pName;
EXCHAR cKey;
}pChoices[5]; {"Yes",'y'},{"No",'n'},{"Cancel",'c'},{"Help",'h'},{"hElp me!",'e'}
}
"Press any key..."
{
EXCHAR*pName; "Press any key..."
EXWORD wNoOfChoices; 0
}
*/
/*---------------------------------------------------------------------------------*/
ExStatus EXAPI OpenUserInputDevice( ExDevice* pDevice );
ExStatus EXAPI CloseUserInputDevice( ExDevice* pDevice );
ExStatus EXAPI WaitForCharUserInputDevice( ExDevice* pDevice, ExWaitForCharChoices* waitForCharChoices );
#endif /* EX_USE_USER_INPUT */
/*---------------------------------------------------------------------------------*/
/* Close all devices function */
#ifdef EX_USE_CLOSE_ALL_DEVICES
ExStatus EXAPI ExCloseAllDevices(void);
#endif /* EX_USE_CLOSE_ALL_DEVICES */
/*---------------------------------------------------------------------------------*/
#ifdef EX_USE_DIRECT_API
typedef struct
{
EXDWORD totalClusters;
EXDWORD availClusters;
EXDWORD sectorsPerCluster;
EXDWORD bytesPerSector;
} ExDiskInfoRecord;
#endif /* EX_USE_DIRECT_API
*/
#endif /* __EXDEVICE__H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -