This member of Class WaveLinkAuxPort is supported on Windows Mobile, Windows CE, Palm, and DOS..
The QueryPort Method queries a the serial port of a device for input. The QueryPort Method also sends data to the device’s serial port.
Syntax
public String QueryPort(int port, char start,
char end, int maxLength,
int timeout, String request)
throws WaveLinkError
IllegalArgumentException
Parameters
port |
The communicating serial port of the device |
start |
The starting character for returned data that is framed. Any data received prior to the starting character is discarded |
end |
The ending character for returned data that is framed. Input terminates immediately after the ending character is received |
maxLength |
The maximum number of characters that may be received before input automatically returns from the serial port query |
timeout |
The maximum amount of time (in seconds) that may pass before input automatically returns from the serial port query |
request |
Data that is sent to the serial port before any query input is returned. Set this value to null if you do not wish to send data to the serial port before it is queried |
Returns
The response from the serial port of the device
Throws
WaveLinkError
IllegalArgumentException
Remarks
A serial port must first be configured using the ConfigurePort Method before the port may be queried using the QueryPort Method. This method may be used with RF-based printers when greater control over communications is required.
The possible values for port are:
WLCOM1 |
COM port 1 (serial port on Palm devices) |
WLCOM2 |
COM port 2 (infrared port on Palm devices) |
For the start parameter, enter the decimal equivalent of the ASCII character you wish to designate as the starting character of a data frame. If WLNOCHAR is entered, no starting character is defined.
For the end parameter, enter the decimal equivalent of the ASCII character you wish to designate as the ending character of a data frame. If WLNOCHAR is entered, no ending character is defined.
You can define an ending character without defining a starting character.
If NOMAXLENGTH is entered for the maxLength parameter, no maximum length is enforced.
If WLWAITFOREVER is entered for the timeout parameter, no timeout value is enforced. If zero is entered, any data that is immediately available is read and returned.
The request parameter is useful for sending data to devices that require a triggering event before responding, such as a scale. Set this value to null if you do not wish to send data to the serial port before it is queried.
Example
WaveLinkAuxPort AuxIface = new WaveLinkAuxPort();
int nPort = 0;
string sANs;
// You must set up the port before its first use.
try {
AuxIface.ConfigurePort(nPort,
WaveLinkAuxPort.BAUD1900,
WaveLinkAuxPort.DATABITS7,
WaveLinkAuxPort.STOPBITS1,
WaveLinkAuxPort.PARITYEVEN,
WaveLinkAuxPort.HARDWAREFLOWCTL);
sAns = AuxIface.QueryPort(nPort, 0, 13, -1, 10, "AS1T");
// Process sAns
}
catch (WaveLinkError wlErr) {
//Do error handling
}
Was this article useful?
The topic was:
Inaccurate
Incomplete
Not what I expected
Other