Building Controls Virtual Test Bed
matlabSocket.h File Reference

Methods for interfacing matlab using BSD sockets. More...

#include "defines.h"
Include dependency graph for matlabSocket.h:

Go to the source code of this file.

Functions

int establishclientsocket (const char *const docname)
 Establishes a connection to the socket. More...
 
int sendclienterror (const int *sockfd, const int *flaWri)
 Writes an error flag to the socket stream. More...
 
int exchangedoubleswithsocket (const int *sockfd, const int *flaWri, int *flaRea, const int *nDblWri, int *nDblRea, double *simTimWri, double dblValWri[], double *simTimRea, double dblValRea[])
 Exchanges data with the socket. More...
 
int closeipc (int *sockfd)
 Closes the inter process communication socket. More...
 

Detailed Description

Methods for interfacing matlab using BSD sockets.

Author
Michael Wetter, Simulation Research Group, LBNL, MWett.nosp@m.er@l.nosp@m.bl.go.nosp@m.v
Date
2009-06-26

This file provides methods that allows matlab to establish a socket connection. It is a wrapper for utilSocket.h that hides the C functions that are not exported in the dll. Without this wrapper, matlab writes warnings for each function that is not exported in the dll. The file compile.m calls this file.

Definition in file matlabSocket.h.

Function Documentation

int closeipc ( int *  sockfd)

Closes the inter process communication socket.

Parameters
sockfdSocket file descripter.
Returns
The return value of the close function.
Parameters
sockfdSocket file descripter.
Returns
Zero.

Definition at line 1193 of file util/utilSocket.c.

Referenced by closeBSDSocket(), closeModelicaClient(), and main().

int establishclientsocket ( const char *const  docname)

Establishes a connection to the socket.

This method establishes the client socket.

Parameters
docnameName of xml file that contains the socket information.
Returns
The socket file descripter, or a negative value if an error occured.

This method establishes the client socket.

Parameters
docnameName of xml file that contains the socket information.
Returns
Negative one.

Definition at line 468 of file util/utilSocket.c.

References BUFFER_LENGTH, f1, fprintf(), getsockethost(), getsocketportnumber(), REQUIRED_READ_LENGTH, REQUIRED_WRITE_LENGTH, retVal, and sockfd.

Referenced by establishBSDSocket(), establishModelicaClient(), first(), and main().

int exchangedoubleswithsocket ( const int *  sockfd,
const int *  flaWri,
int *  flaRea,
const int *  nDblWri,
int *  nDblRea,
double *  simTimWri,
double  dblValWri[],
double *  simTimRea,
double  dblValRea[] 
)

Exchanges data with the socket.

Clients can call this method to exchange data through the socket.

Parameters
sockfdSocket file descripter
flaWriCommunication flag to write to the socket stream.
flaReaCommunication flag read from the socket stream.
nDblWriNumber of double values to write.
nDblReaNumber of double values to read.
simTimWriCurrent simulation time in seconds to write.
dblValWriDouble values to write.
simTimReaCurrent simulation time in seconds read from socket.
dblValReaDouble values read from socket.
See Also
int establishclientsocket(uint16_t *portNo)
Returns
The exit value of send or read, or a negative value if an error occured.

Definition at line 1119 of file util/utilSocket.c.

References exchangewithsocket().

Referenced by exchangeDoublesWithBSDSocket(), exchangeModelicaClient(), first(), and main().

int sendclienterror ( const int *  sockfd,
const int *  flaWri 
)

Writes an error flag to the socket stream.

This method should be used by clients if they experience an error and need to terminate the socket connection.

Parameters
sockfdSocket file descripter
flaWrishould be set to a negative value.

This method should be used by clients if they experience an error and need to terminate the socket connection.

Deprecated:
Use sendclientmessage instead
Parameters
sockfdSocket file descripter
flaWrishould be set to a negative value.

This method should be used by clients if they experience an error and need to terminate the socket connection.

Deprecated:
Use sendclientmessage instead
Parameters
sockfdSocket file descripter
flaWrishould be set to a negative value.

Definition at line 322 of file util/utilSocket.h.

References sendclientmessage().