Building Controls Virtual Test Bed
establishClientSocket.m
Go to the documentation of this file.
1 function sockfd = establishClientSocket(socketConfigurationFile)
2 % ESTABLISHCLIENTSOCKET - Establishes the client connection to the socket
3 %
4 % sockfd = establishClientSocket('socket.cfg') connect MATLAB to
5 % the BCVTB. This function will read the file socket.cfg to get
6 % information for how to connect to the BCVTB.
7 %
8 % If successful, sockfd will be a positive integer for the
9 % socket file descriptor. In case of error, sockfd will be negative.
10 %
11 % This function will also load the library libbcvtb unless it is
12 % already loaded.
13 
14 % Revision history
15 % ----------------
16 % 2009-06-26 MWetter@lbl.gov: First version, based on code of
17 % Charles Corbin, UC Boulder
18 
19 % Load library if it is not already loaded
20 BCVTBLIB=getBCVTBLibName();
23 end
24 if ~libisloaded(BCVTBLIB)
25  msg='Error. Failed to load BCVTB library.';
26  ME = MException('BCVTB:ConnectError', ...
27  msg);
28  throw(ME);
29  status = -1;
30 else
31  status = 1;
32 end
33 
34 % Establish the socket connection
35 if and(libisloaded(BCVTBLIB), (status == 1))
36  sockfd = calllib(BCVTBLIB,'establishclientsocket', socketConfigurationFile);
37 else
38  disp('Could not load library establishClientSocket.m');
39  sockfd = -1;
40 end
function sockfd
loadlibrary(LIBBCVTB,... 'matlabSocket.h',... 'includepath', './..',... 'mfilename', 'bcvtb.m')%-------------------------------------------------------------------%Check if Simulink is installed on this system.If Simulink is%is not installed
function described below The Simulink Library Browser needs to know which libraries in your Blockset it should and what names to give them To provide this information
Definition: slblocks.m:1
function sockfd will be a positive integer for the socket file descriptor In case of error
function if the BCVTB library can be loaded and if sockfd is not a negative then this function sends signal to the socket If sending a message to the socket was successful
Definition: processError.m:1
int establishclientsocket(const char *const docname)
Establishes a connection to the socket.
end Establish the socket connection if and(libisloaded(BCVTBLIB),(status==1)) sockfd
static void XMLCALL end(void *data, const char *el)
Call back functions that will be used by the expat xml parser.
Definition: util/utilXml.c:707
if(strcmp(os,'windows'))%have Windows LIBBCVTB
Load library if it is not already loaded BCVTBLIB
Definition: processError.m:26
function[retVal, flaRea, simTimRea, dblValRea]
else disp('Could not load library establishClientSocket.m')
if ~libisloaded(BCVTBLIB) loadlibrary(BCVTBLIB
throw(ME)