# Database Serial Comm Server

Topics

:

Overview
Functions

Overview

The gxSerialCommServer class is derived from the gxSerialComm class and is used to establish a client or server connection that can transmit and receive database blocks over a serial port.

Functions

gxSerialCommServer::gxSerialCommServer()
gxSerialCommServer::~gxSerialCommServer()
gxSerialCommServer::AddBlock()
gxSerialCommServer::ChangeBlock()
gxSerialCommServer::CloseConnection()
gxSerialCommServer::DeleteBlock()
gxSerialCommServer::InitCommServer()
gxSerialCommServer::ReadAckBlock()
gxSerialCommServer::ReadBlock()
gxSerialCommServer::ReadHeader()
gxSerialCommServer::RequestBlock()
gxSerialCommServer::SetBlockStatus()
gxSerialCommServer::TerminateConnection()
gxSerialCommServer::WriteAckBlock()
gxSerialCommServer::WriteBlock()
gxSerialCommServer::WriteHeader()

gxSerialCommServer::gxSerialCommServer()

- Default class constructor.

gxSerialCommServer::~gxSerialCommServer()

- Class destructor.

int gxSerialCommServer::AddBlock(const void *block, gxBlockHeader &block_header)

- Public member function used to request that the block pointed to by the "block" variable be added by a local or remote device. The block header must account for the total length of the data pointed to by the "block" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::ChangeBlock(const void *request, const void *block,gxBlockHeader &request_header, gxBlockHeader &block_header)

- Public member function used to request that the block pointed to by the "block" variable be changed by a local or remote device. The "request" variable points to the new information that will be inserted in place of the block pointed to by the "block" variable. The block header must account for the total length of the data pointed to by the "block" variable and the "request_header" must account for the total length of the data pointed to by the "request" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::CloseConnection()

- Public member function that sends a block command used to close a persistent client or server connection. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::DeleteBlock(const void *request, gxBlockHeader &request_header)

- Public member function used to request that the a block pointed to by the "request" variable be deleted. The "request_header" must account for the total length of the data pointed to by the "request" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::InitCommServer(char *dev, int sp = 9600, char pr = 'N', int cs = 8, int sb = 1,int flow = gxSerialComm::scommNO_FLOW_CONTROL)

- Public member function used to initialize a serial device. Returns zero to indicate success or a non-zero value to indicate a serial port error.

int gxSerialCommServer::ReadAckBlock()

- Public member function used to read an acknowledgment block. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::ReadBlock(void *buf, gxBlockHeader &gx)

- Public member function used to read a block. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::ReadHeader(gxBlockHeader &gx)

- Public member function used to read a header. Returns zero if no errors occur or a non-zero value to indicate a failure.

void *gxSerialCommServer::RequestBlock(const void *request, gxBlockHeader &request_header, gxBlockHeader &requested_block_header)

- Public member function used to request a block from the remote end. The "request" variable points to the request information. The "request_header" must account for the total length of the data pointed to by the "request" variable. Returns the requested block or a null value if an error occurs. The block returned by this function must be typecast to the correct type by the calling function.

void gxSerialCommServer::SetBlockStatus(gxBlockHeader &gx, __SBYTE__ dev_status,__SBYTE__ file_status = gxRemoteDeviceBlock)

- Public member function used to set the variable block header status member control byte. NOTE: The block's next deleted variable must be set, if needed, after a call to this function. The block length will not be set here.

int gxSerialCommServer::TerminateConnection()

- Public member function used to send a block command that will shutdown a server or client. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::WriteAckBlock()

- Public member function used to write an acknowledgment block. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::WriteBlock(const void *buf, int bytes)

- Public member function used to write a block of raw data to the socket. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::WriteBlock(const void *buf, gxBlockHeader &gx)

- Public member function used to write a block. The block header must account for the total length of the data pointed to by the "buf" variable. Returns zero if no errors occur or a non-zero value to indicate a failure.

int gxSerialCommServer::WriteHeader(gxBlockHeader &gx)

- Public member function used to write a header. Returns zero if no errors occur or a non-zero value to indicate a failure.

End Of Document