-
5.4. Get Back Cover Open/Close status
Function Description:
Back cover switch is beside UPS battery. This switch will be pressed (close) when back cover is
installed into MR650 main body. And switch will be released when back cover is remove from
MR650(Open). Application program can detect switch status to see if MR650
'
s back plate is
remove or not for security purpose.
Function call:
BOOL IOC_GetCoverStatus(DWORD *pStatus);
Parameters(Output):
pStatus:
DWORD *
: Cover status = TRUE : Close
=
FALSE
:
Open
Return code:
TRUE = Success
FALSE = Unsupported
Example:
Cover change event shares the same name as optical input, which is “IOCOpticalInputEvent”.
Applications can use a thread to catch this event for necessary tasks. An example thread as
below,
void WINAPI IOCoverSwitchMonitor()
{
HANDLE gCoverSwitchEvent = NULL;
DWORD dwStatus;
HANDLE gIOControlDriverHandle;
…
gIOControlDriverHandle = CreateFile(L”IOC1:”, GENERIC_READ |
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, 0);
If (gIOControlDriverHandle == INVALID_HANDLE_VALUE)
{
// IO device not found, function not supported,
// error process
}
…
gCoverSwitchEvent = CreateEvent(NULL, FALSE, FALSE,
IOC_OPTICAL_INPUT_EVENT);
if (gCoverSwitchEvent == NULL)
{
// not supported
// error process
}
while (1)
{
WaitForSingleObject(gCoverSwitchEvent, INFINITE);
IOC_GetCoverStatus (&dwStatus);
// process cover change tasks
//
…
}
CloseHandle(gIOControlDriverHandle);
CloseHandle(gCoverSwitchEvent);
…
In ioc_ioctl.h, IOC_OPTICAL_INPUT_EVENT is defined as
#define IOC_OPTICAL_INPUT_EVENT _T("IOCOpticalInputEvent")