Up: GEOS SDK TechDocs | Up | Prev: UserRemoveAutoExec() ... | Next: VirtualSerialSetFormat() ...

UtilAsciiToHex32()

Boolean	UtilAsciiToHex32(
        const char *		string,
        dword *		value);

This routine converts a null-terminated ASCII string into a 32-bit integer. The string may begin with a hyphen, indicating a negative number. Aside from that, the string may contain nothing but numerals until the null termination. It may not contain whitespace.

If the routine is successful, it will return false and write an equivalent signed long integer to *value . If it fails, it will return true and write a member of the UtilAsciiToHexError enumerated type to *value . This type contains the following members:

UATH_NON_NUMERIC_DIGIT_IN_STRING
This string contained a non-numeric character before the trailing null (other than the allowed leading hyphen).
UATH_CONVERT_OVERFLOW
The string specified a number to large to be expressed as a signed 32-bit integer.

Include: system.h

UtilHex32ToAscii()

word	UtilHex32ToAscii(
        char *		buffer,
        dword		value, 
        UtilHexToAsciiFlags 		flags);

This routine converts a 32-bit unsigned integer to its ASCII representation and writes it to the specified buffer. It returns the length of the string (not counting the nulll termination, if any). The routine is passed the following arguments:

buffer
This is a pointer to a character buffer. The buffer must be long enough to accommodate the largest string; that is, there must be ten bytes for the characters, plus one for the trailing null (if necessary).
value
This is the value to convert to ASCII.
flags
This is a record of UtilHexToAscii flags. The following flags are available:
UHTAF_INCLUDE_LEADING_ZEROS
Pad the string with leading zeros to a length of ten total characters.
UHTAF_NULL_TERMINATE
Add a null to the end of the string. If this flag is set, the buffer must be at least 11 bytes long. If it is clear, the buffer may be ten bytes long.

Include: system.h

VarDataFlagsPtr()

VarDataFlags 	VarDataFlagsPtr(
        void *	ptr);

This macro fetches the flags of a variable data type when given a pointer to the extra data for the type. The flags are stored in a VarDataFlags record. Only the flags VDF_EXTRA_DATA and/or VDF_SAVE_TO_STATE will be returned.

Include: object.h

Warnings: You must pass a pointer to the beginning of the vardata entry's extra data space.

VarDataSizePtr()

word	VarDataSizePtr(
        void *	ptr);

This macro fetches the size of a variable data entry when given a pointer to the extra data for the type.

Include: object.h

Warnings: You must pass a pointer to the beginning of the vardata entry's extra data space.

VarDataTypePtr()

word	VarDataTypePtr(
        void *	ptr);

This macro fetches the type of a variable data entry when given a pointer to the extra data of the entry. The type is stored in a VarDataFlags record. All flags outside the VDF_TYPE section will be cleared.

Include: object.h

Warning: You must pass a pointer to the beginning of the vardata entry's extra data space.

VirtualSerialClose()

VirtualSerialStatus 	VirtualSerialClose ( void  );

Waits until all outgoing data is sent to remote unit, then flushes incoming data buffer and closes connection to remote unit.

Returns VS_OK if data was successfully written.

Returns VS_CLOSED if stream was already closed.

Warning: This is a low-level routine whose use is discouraged in favor of ModemClose(). Do not call any Virtual Serial function except VirtualSerialOpen() after calling this function.

Include: vserlib.h

See Also: VirtualSerialOpen().

VirtualSerialFlush()

VirtualSerialStatus 	VirtualSerialFlush(
	 word 		flushMode);

Flushes data from incoming buffer. The flushMode sets the operation direction. It may be:

STREAM_READ
Flushes the incoming data buffer.
STREAM_WRITE
Is ignored.
STREAM_BOTH
Same as STREAM_READ.

Returns VS_OK if the stream successfully flushed.

Returns VS_CLOSED if the stream is not open.

Include: vserlib.h

VirtualSerialOpen()

VirtualSerialStatus	 VirtualSerialOpen(
	VSOpenFlags 		stream_open_mode,    /* Fail or wait if stream is busy */
	word 		input_buffer_size,    /* # of bytes 1...4096 of input buffer */
	word 		output_buffer_size,    /* Ignore. Automatically set to 4352 bytes. */
	word 		timeout);    /* # of ticks to wait and retry if the stream is busy. */

This routine lets the client open a stream to the phone. Should the Virtual Phone data resource be in use and if stream_open_mode is set to SOF_NOBLOCK then the function fails immediately; otherwise, if stream_open_mode is set to SOF_TIMEOUT, the function will try again until it is either successful or timeout number of ticks (1 ... 32768) elapse. input_buffer_size is the size (in bytes 1...4096) of the input buffer. The output_buffer_size should be ignored, as the output buffer is set to 4352 bytes.

Returns VS_OK if successful.

Returns VS_DATA_RESOURCE_RESERVED if VP data resource is already in use.

Returns VS_STREAM_ALREADY_OPEN if stream has already been opened by another client.

Returns VS_CANNOT_ALLOC if cannot allocate memory for the streams buffer.

Warning: This is a low-level routine whose use is discouraged in favor of ModemOpen(). This routine must return VS_OK before client can start using other Virtual Serial functions. Outgoing data is not buffered in VirtualSerial library, but sent directly from calling client's buffer.

Include: vserlib.h

See Also: VirtualSerialClose().

VirtualSerialRead()

VirtualSerialStatus 	VirtualSerialRead(
        VSBlockingMode		blocking_mode, /* to block or not to block */
        word		data_size, /* # of bytes of data to be read */
        byte		*ptr_to_buffer, /* buffer to hold data */
        word		*bytes_read); /* # of bytes actually read */

Copies incoming data to buffer. If there is less than data_size number of bytes in the buffer and STREAM_BLOCK was specified in blocking_mode, will block until enough data becomes available; if there is less than data_size number of bytes in the buffer and STREAM_NO_BLOCK was specified, returns immediately with VS_SHORT_READ_WRITE.

Returns VS_OK if data was successfully written.

Returns VS_CLOSED if stream is not open.

Include: vserlib.h

See Also: VirtualSerialReadByte().

VirtualSerialReadByte()

VirtualSerialStatus 	VirtualSerialReadByte(
        VSBlockingMode		blockingMode, /* to block or not to block */
        byte		*dataByte); /* buffer to hold read data */

This routine reads a byte from the stream into dataByte. If the stream is empty and blockingMode is set to STREAM_BLOCK then the routine will wait for the request to be filled, or if STREAM_NO_BLOCK is specified the routine will immediately return an error.

Returns VS_OK if data was successfully written to dataByte.

Returns VS_SHORT_READ_WRITE if the data was not available and STREAM_NO_BLOCK was specified.

Returns VS_CLOSED if the stream is not open.

Warning: STREAM_BLOCK mode is dangerous to use: if the opposite end does not send data this function will block forever.

Include: vserlib.h

See Also: VirtualSerialRead(), VirtualSerialWriteByte().

VirtualSerialSendDTR()

VirtualSerialStatus 	VirtualSendDTR(
        byte		DTR_status);

Sends Data Terminal Ready status to modem.

Include: vserlib.h

VirtualSerialSetFlowControl()

VirtualSerialStatus 	VirtualSerialSetFlowControl(
        VSFlowControl		flow_control_mode); /* software or hardware */

Selects the flow control method used between the modem and the VirtualSerial Library. flow_control_mode can be set to either VSFC_SOFTWARE or VSFC_HARDWARE.

Returns VS_OK if successfully set or VS_CLOSED if stream is not open.

Include: vserlib.h


Up: GEOS SDK TechDocs | Up | Prev: UserRemoveAutoExec() ... | Next: VirtualSerialSetFormat() ...