<< Click to Display Table of Contents >>
ZfxGetServerStatus
Get information about the server.
Syntax
ZFERR FAR ZfxGetServerStatus( ZFSESSIONHANDLE hSession, short ServerInfoSize, ZFSERVERINFO FAR *lpServerInfo short MaxDevices, short FAR *lpNumDevices, short DeviceInfoSize, ZFDEVICEINFO FAR *lpDeviceInfo)
Parameters
Parameter |
Description |
hSession |
API session handle, as returned by ZfxAPIInit call ServerInfoSizeSize of structure - should be set to size of (ZFSERVERINFO) lpServerInfoAddress of a ZFSERVERINFO structure used to return status information for the server |
MaxDevices |
Maximum number of device entries to be returned (ie number of elements in the DeviceInfo array)lpNumDevicesAddress of short integer variable used to return the number of events in the file. Note that the returned value may be larger than the value given for MaxDevices if the buffer was not large enough for all entries. |
DeviceInfoSize |
Size of structure - should be set to sizeof (ZFDEVICEINFO) |
lpDeviceInfo |
Address of array of 'n' ZFDEVICEINFO structures, where 'n' is the value given by the MaxDevices parameter. |
Description
This routine gets the current status of the server (number of entries in queues etc), and of each device.
If the number of devices configured exceeds the MaxDevices parameter, then the routine returns information about the first MaxDevices devices, but sets the lpNumDevices parameter to the total number of devices in the list. Be careful therefore to only read the lesser of (MaxDevices) and (lpNumDevices) elements of the array on return. Calling the routine with MaxDevices set to 0 will just return a count of the number of devices.
NOTE - this function is supplied for compatibility with version 5 of the Zetafax API only. Version 6 API applications should use ZfxGetServerStatusEx.
Return value
The routine returns 0 if successful, otherwise one of the following:
ZFERR_NOT_INITIALISED
ZFERR_INVALID_PARAMETERS
ZFERR_SERVER_NOT_RUNNING
ZFERR_FILE_OPEN_ERROR
ZFERR_FILE_ERROR
ZFERR_CANT_SUBMIT_REQUEST
Example
#include <stdio.h>
#include <zfapi.h>
...
#define LIST_SIZE 20
ZFSERVERINFO ServerInfo;
ZFDEVICEINFO aDeviceInfo[LIST_SIZE];
Err = ZfGetServerStatus(hSession, sizeof(ZFSERVERINFO), &ServerInfo,
LIST_SIZE, &NumDevices, sizeof(ZFDEVICEINFO), aDeviceInfo);
if (Err == 0)
{
printf("Items waiting for device = %d\n", ServerInfo.QueueWaitingDevice);
if (NumDevices >= 1 && aDeviceInfo[0].szUser[0] != '\0')
{
printf("First device is processing %s:%s", aDeviceInfo[0].szUser, aDeviceInfo[0].szMsgBody);
}
}
Related topics