User's Manual

Table Of Contents
RK-5424-5 Reference Kit User’s Guide 4-15
iBeanAPI.h
Functions
1. ibApi_Open
ibApi_FUNC ibApi_Open(
ibApi_VERSION expected_version,
ibApi_CONST ibApi_CHAR *server_type,
ibApi_CONST ibApi_CHAR * connection_str
);
ibApi_Open( ) should be called to initialize the API before any other function is called.
The "server_type" parameter specifies the type of connection, and connection_str contains
various connection parameters that vary according to server type.
Notes: For the current release, the server_type should always be "local", and the default
connection string is"". These text strings are case-sensitive.
You can change the default COM port and Baud rate using the "connection_str"
parameters. The string format is “-p[n]|-B[baud rate]”, where n = (COM port number – 1).
For example, to select COM port 2 with a baud rate of 115200, you should supply the
connection_str “-p1 –B115200”. By default, the COM port is COM1 and the baud rate is
115200.
Notes: The connection baud rate needs to be consistent between the host and the
MeshGate gateway. The default baud rate on the gateway is 115200, so if ibApi_Open()
changes the baud rate to a different number, the baud rate on the gateway also needs to be
updated.
To access the COM port setting on Linux platforms, you need to either have root permission
or change the COM port permission to current user.
Parameters:
expected_version: (input) Should always be ibApi_EXPECTED_VERSION.
server_type: (input) "local" (Only valid setting for this release).
connection_str: (input) "" (NULL string to set to default values).
Return Value:
An ibApi_APIHANDLE value if successful, or an error code (<0) if not.
2. ibApi_Close
ibApi_FUNC ibApi_Close(
ibApi_APIHANDLE api_hdl
);
This disconnects from the server and releases the API resources. This should be called before
your application exits to avoid resource leaks.
Parameter:
api_hdl: (input) API handle returned from ibApi_Open()
Return Value:
An ibApi_RESULT_SUCCESS if successful, error code (<0) if not.