📄 sti.h
字号:
// Device description , provided by vendor
LPWSTR pszDeviceDescription;
// String , representing port on which device is accessible.
LPWSTR pszPortName;
// Control panel propery provider
LPWSTR pszPropProvider;
// Local specific ("friendly") name of the device, mainly used for showing in the UI
LPWSTR pszLocalName;
//
// WIA values
//
LPWSTR pszUiDll;
LPWSTR pszServer;
} STI_WIA_DEVICE_INFORMATIONW, *PSTI_WIA_DEVICE_INFORMATIONW;
typedef struct _STI_WIA_DEVICE_INFORMATIONA {
DWORD dwSize;
// Type of the hardware imaging device
STI_DEVICE_TYPE DeviceType;
// Device identifier for reference when creating device object
CHAR szDeviceInternalName[STI_MAX_INTERNAL_NAME_LENGTH];
// Set of capabilities flags
STI_DEV_CAPS DeviceCapabilities;
// This includes bus type
DWORD dwHardwareConfiguration;
// Vendor description string
LPCSTR pszVendorDescription;
// Device description , provided by vendor
LPCSTR pszDeviceDescription;
// String , representing port on which device is accessible.
LPCSTR pszPortName;
// Control panel propery provider
LPCSTR pszPropProvider;
// Local specific ("friendly") name of the device, mainly used for showing in the UI
LPCSTR pszLocalName;
//
// WIA values
//
LPCSTR pszUiDll;
LPCSTR pszServer;
} STI_WIA_DEVICE_INFORMATIONA, *PSTI_WIA_DEVICE_INFORMATIONA;
#if defined(UNICODE) || defined(STI_UNICODE)
typedef STI_WIA_DEVICE_INFORMATIONW STI_WIA_DEVICE_INFORMATION;
typedef PSTI_WIA_DEVICE_INFORMATIONW PSTI_WIA_DEVICE_INFORMATION;
#else
typedef STI_WIA_DEVICE_INFORMATIONA STI_WIA_DEVICE_INFORMATION;
typedef PSTI_WIA_DEVICE_INFORMATIONA PSTI_WIA_DEVICE_INFORMATION;
#endif
// end sti_device_information
//
// Device state information.
// ------------------------
//
// Following types are used to inquire state characteristics of the device after
// it had been opened.
//
// Device configuration structure contains configurable parameters reflecting
// current state of the device
//
//
// Device hardware status.
//
//
// Individual bits for state acquiring through StatusMask
//
// State of hardware as known to USD
#define STI_DEVSTATUS_ONLINE_STATE 0x0001
// State of pending events ( as known to USD)
#define STI_DEVSTATUS_EVENTS_STATE 0x0002
//
// Online state values
//
#define STI_ONLINESTATE_OPERATIONAL 0x00000001
#define STI_ONLINESTATE_PENDING 0x00000002
#define STI_ONLINESTATE_ERROR 0x00000004
#define STI_ONLINESTATE_PAUSED 0x00000008
#define STI_ONLINESTATE_PAPER_JAM 0x00000010
#define STI_ONLINESTATE_PAPER_PROBLEM 0x00000020
#define STI_ONLINESTATE_OFFLINE 0x00000040
#define STI_ONLINESTATE_IO_ACTIVE 0x00000080
#define STI_ONLINESTATE_BUSY 0x00000100
#define STI_ONLINESTATE_TRANSFERRING 0x00000200
#define STI_ONLINESTATE_INITIALIZING 0x00000400
#define STI_ONLINESTATE_WARMING_UP 0x00000800
#define STI_ONLINESTATE_USER_INTERVENTION 0x00001000
#define STI_ONLINESTATE_POWER_SAVE 0x00002000
//
// Event processing parameters
//
#define STI_EVENTHANDLING_ENABLED 0x00000001
#define STI_EVENTHANDLING_POLLING 0x00000002
#define STI_EVENTHANDLING_PENDING 0x00000004
typedef struct _STI_DEVICE_STATUS {
DWORD dwSize;
// Request field - bits of status to verify
DWORD StatusMask;
//
// Fields are set when status mask contains STI_DEVSTATUS_ONLINE_STATE bit set
//
// Bitmask describing device state
DWORD dwOnlineState;
// Device status code as defined by vendor
DWORD dwHardwareStatusCode;
//
// Fields are set when status mask contains STI_DEVSTATUS_EVENTS_STATE bit set
//
// State of device notification processing (enabled, pending)
DWORD dwEventHandlingState;
// If device is polled, polling interval in ms
DWORD dwPollingInterval;
} STI_DEVICE_STATUS,*PSTI_DEVICE_STATUS;
//
// Structure to describe diagnostic ( test ) request to be processed by USD
//
// Basic test for presence of associated hardware
#define STI_DIAGCODE_HWPRESENCE 0x00000001
//
// Status bits for diagnostic
//
//
// generic diagnostic errors
//
typedef struct _ERROR_INFOW {
DWORD dwSize;
// Generic error , describing results of last operation
DWORD dwGenericError;
// vendor specific error code
DWORD dwVendorError;
// String, describing in more details results of last operation if it failed
WCHAR szExtendedErrorText[255];
} STI_ERROR_INFOW,*PSTI_ERROR_INFOW;
typedef struct _ERROR_INFOA {
DWORD dwSize;
DWORD dwGenericError;
DWORD dwVendorError;
CHAR szExtendedErrorText[255];
} STI_ERROR_INFOA,*PSTI_ERROR_INFOA;
#if defined(UNICODE) || defined(STI_UNICODE)
typedef STI_ERROR_INFOW STI_ERROR_INFO;
#else
typedef STI_ERROR_INFOA STI_ERROR_INFO;
#endif
typedef STI_ERROR_INFO* PSTI_ERROR_INFO;
typedef struct _STI_DIAG {
DWORD dwSize;
// Diagnostic request fields. Are set on request by caller
// One of the
DWORD dwBasicDiagCode;
DWORD dwVendorDiagCode;
// Response fields
DWORD dwStatusMask;
STI_ERROR_INFO sErrorInfo;
} STI_DIAG,*LPSTI_DIAG;
//
typedef STI_DIAG DIAG;
typedef LPSTI_DIAG LPDIAG;
// end device state information.
//
// Flags passed to WriteToErrorLog call in a first parameter, indicating type of the message
// which needs to be logged
//
#define STI_TRACE_INFORMATION 0x00000001
#define STI_TRACE_WARNING 0x00000002
#define STI_TRACE_ERROR 0x00000004
//
// Event notification mechansims.
// ------------------------------
//
// Those are used to inform last subscribed caller of the changes in device state, initiated by
// device.
//
// The only supported discipline of notification is stack. The last caller to subscribe will be notified
// and will receive notification data. After caller unsubscribes , the previously subscribed caller will
// become active.
//
// Notifications are sent to subscriber via window message. Window handle is passed as
// parameter
#define STI_SUBSCRIBE_FLAG_WINDOW 0x0001
// Device notification is signalling Win32 event ( auto-set event). Event handle
// is passed as a parameter
#define STI_SUBSCRIBE_FLAG_EVENT 0x0002
typedef struct _STISUBSCRIBE {
DWORD dwSize;
DWORD dwFlags;
// Not used . Will be used for subscriber to set bit mask filtering different events
DWORD dwFilter;
// When STI_SUBSCRIBE_FLAG_WINDOW bit is set, following fields should be set
// Handle of the window which will receive notification message
HWND hWndNotify;
// Handle of Win32 auto-reset event , which will be signalled whenever device has
// notification pending
HANDLE hEvent;
// Code of notification message, sent to window
UINT uiNotificationMessage;
} STISUBSCRIBE,*LPSTISUBSCRIBE;
#define MAX_NOTIFICATION_DATA 64
//
// Structure to describe notification information
//
typedef struct _STINOTIFY {
DWORD dwSize; // Total size of the notification structure
// GUID of the notification being retrieved
GUID guidNotificationCode;
// Vendor specific notification description
BYTE abNotificationData[MAX_NOTIFICATION_DATA]; // USD specific
} STINOTIFY,*LPSTINOTIFY;
// end event_mechanisms
//
// STI device broadcasting
//
//
// When STI Device is being added or removed, PnP broadacst is being sent , but it is not obvious
// for application code to recognize if it is STI device and if so, what is the name of the
// device. STI subsystem will analyze PnP broadcasts and rebroadcast another message via
// BroadcastSystemMessage / WM_DEVICECHANGE / DBT_USERDEFINED .
// String passed as user defined message contains STI prefix, action and device name
#define STI_ADD_DEVICE_BROADCAST_ACTION "Arrival"
#define STI_REMOVE_DEVICE_BROADCAST_ACTION "Removal"
#define STI_ADD_DEVICE_BROADCAST_STRING "STI\\" STI_ADD_DEVICE_BROADCAST_ACTION "\\%s"
#define STI_REMOVE_DEVICE_BROADCAST_STRING "STI\\" STI_REMOVE_DEVICE_BROADCAST_ACTION "\\%s"
// end STI broadcasting
//
// Device create modes
//
// Device is being opened only for status querying and notifications receiving
#define STI_DEVICE_CREATE_STATUS 0x00000001
// Device is being opened for data transfer ( supersedes status mode)
#define STI_DEVICE_CREATE_DATA 0x00000002
#define STI_DEVICE_CREATE_BOTH 0x00000003
//
// Bit mask for legitimate mode bits, which can be used when calling CreateDevice
//
#define STI_DEVICE_CREATE_MASK 0x0000FFFF
//
// Flags controlling device enumeration
//
#define STIEDFL_ALLDEVICES 0x00000000
#define STIEDFL_ATTACHEDONLY 0x00000001
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -