rscada/libmbus — pull request #14 by jakubovsky (2012-07-06 09:59:14+00:00)
Title: Few improvements

1) mbus_tcp_recv_frame() :
- necessary return error codes for connection reset, slave response timeout and other read(2) errors, which makes possible for user to react (for instance to connect again with mbus_connect())
- calling mbus_tcp_recv_frame() with mbus_handle NULL pointer indicates an erroneous situation and should return -1 and not 0 which means frame receive successfully
2) M-Bus API change:
- mbus_connect_tcp and mbus_connect_serial splitted into two parts: 1) M-Bus context allocation with mbus_tcp_context/mbus_serial_context 2) connecting to either TCP client or serial port with mbus_connect(). This makes possible managing connection without reallocating context memory which is needed in more complex applications than examples
3) mbus_handle struct improvement:
- introduce function pointers to basic descriptor operations which makes possible to get rid of 'if (is_serial)' conditions in mbus-protocol-aux.c
- pointer to auxiliary TCP/serial specific data, previously held in mbus_tcp_handle and mbus_serial_handle
4) <> C includes replaced with ""
5) copying TCP host and device C strings with strdup(3) and free with free_auxdata()