TCP and serial specific data structs renamed.
This commit is contained in:
parent
78a6013d75
commit
e70c07e8f3
@ -1313,7 +1313,7 @@ mbus_handle *
|
||||
mbus_context_serial(const char *device)
|
||||
{
|
||||
mbus_handle *handle;
|
||||
mbus_serial_handle *serial_data;
|
||||
mbus_serial_data *serial_data;
|
||||
char error_str[128];
|
||||
|
||||
if ((handle = (mbus_handle *) malloc(sizeof(mbus_handle))) == NULL)
|
||||
@ -1322,7 +1322,7 @@ mbus_context_serial(const char *device)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((serial_data = (mbus_serial_handle *)malloc(sizeof(mbus_serial_handle))) == NULL)
|
||||
if ((serial_data = (mbus_serial_data *)malloc(sizeof(mbus_serial_data))) == NULL)
|
||||
{
|
||||
snprintf(error_str, sizeof(error_str), "%s: failed to allocate memory for handle\n", __PRETTY_FUNCTION__);
|
||||
mbus_error_str_set(error_str);
|
||||
@ -1354,7 +1354,7 @@ mbus_handle *
|
||||
mbus_context_tcp(const char *host, int port)
|
||||
{
|
||||
mbus_handle *handle;
|
||||
mbus_tcp_handle *tcp_data;
|
||||
mbus_tcp_data *tcp_data;
|
||||
char error_str[128];
|
||||
|
||||
if ((handle = (mbus_handle *) malloc(sizeof(mbus_handle))) == NULL)
|
||||
@ -1363,7 +1363,7 @@ mbus_context_tcp(const char *host, int port)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((tcp_data = (mbus_tcp_handle *)malloc(sizeof(mbus_tcp_handle))) == NULL)
|
||||
if ((tcp_data = (mbus_tcp_data *)malloc(sizeof(mbus_tcp_data))) == NULL)
|
||||
{
|
||||
snprintf(error_str, sizeof(error_str), "%s: failed to allocate memory for handle\n", __PRETTY_FUNCTION__);
|
||||
mbus_error_str_set(error_str);
|
||||
|
@ -32,14 +32,14 @@
|
||||
int
|
||||
mbus_serial_connect(mbus_handle *handle)
|
||||
{
|
||||
mbus_serial_handle *serial_data;
|
||||
mbus_serial_data *serial_data;
|
||||
const char *device;
|
||||
struct termios *term;
|
||||
|
||||
if (handle == NULL)
|
||||
return 0;
|
||||
|
||||
serial_data = (mbus_serial_handle *) handle->auxdata;
|
||||
serial_data = (mbus_serial_data *) handle->auxdata;
|
||||
if (serial_data == NULL || serial_data->device == NULL)
|
||||
return 0;
|
||||
|
||||
@ -102,7 +102,7 @@ mbus_serial_set_baudrate(mbus_handle *handle, int baudrate)
|
||||
if (handle == NULL)
|
||||
return -1;
|
||||
|
||||
mbus_serial_handle *serial_data = (mbus_serial_handle *) handle->auxdata;
|
||||
mbus_serial_data *serial_data = (mbus_serial_data *) handle->auxdata;
|
||||
|
||||
switch (baudrate)
|
||||
{
|
||||
@ -171,11 +171,11 @@ mbus_serial_disconnect(mbus_handle *handle)
|
||||
void
|
||||
mbus_serial_data_free(mbus_handle *handle)
|
||||
{
|
||||
mbus_serial_handle *serial_data;
|
||||
mbus_serial_data *serial_data;
|
||||
|
||||
if (handle)
|
||||
{
|
||||
serial_data = (mbus_serial_handle *) handle->auxdata;
|
||||
serial_data = (mbus_serial_data *) handle->auxdata;
|
||||
free(serial_data->device);
|
||||
free(serial_data);
|
||||
}
|
||||
|
@ -22,11 +22,11 @@
|
||||
#include "mbus-protocol-aux.h"
|
||||
#include "mbus-protocol.h"
|
||||
|
||||
typedef struct _mbus_serial_handle
|
||||
typedef struct _mbus_serial_data
|
||||
{
|
||||
char *device;
|
||||
struct termios t;
|
||||
} mbus_serial_handle;
|
||||
} mbus_serial_data;
|
||||
|
||||
int mbus_serial_connect(mbus_handle *handle);
|
||||
int mbus_serial_disconnect(mbus_handle *handle);
|
||||
|
@ -37,13 +37,13 @@ mbus_tcp_connect(mbus_handle *handle)
|
||||
struct hostent *host_addr;
|
||||
struct sockaddr_in s;
|
||||
struct timeval time_out;
|
||||
mbus_tcp_handle *tcp_data;
|
||||
mbus_tcp_data *tcp_data;
|
||||
int port;
|
||||
|
||||
if (handle == NULL)
|
||||
return 0;
|
||||
|
||||
tcp_data = (mbus_tcp_handle *) handle->auxdata;
|
||||
tcp_data = (mbus_tcp_data *) handle->auxdata;
|
||||
if (tcp_data == NULL || tcp_data->host == NULL)
|
||||
return 0;
|
||||
|
||||
@ -92,11 +92,11 @@ mbus_tcp_connect(mbus_handle *handle)
|
||||
void
|
||||
mbus_tcp_data_free(mbus_handle *handle)
|
||||
{
|
||||
mbus_tcp_handle *tcp_data;
|
||||
mbus_tcp_data *tcp_data;
|
||||
|
||||
if (handle)
|
||||
{
|
||||
tcp_data = (mbus_tcp_handle *) handle->auxdata;
|
||||
tcp_data = (mbus_tcp_data *) handle->auxdata;
|
||||
free(tcp_data->host);
|
||||
free(tcp_data);
|
||||
}
|
||||
|
@ -21,11 +21,11 @@
|
||||
#include "mbus-protocol.h"
|
||||
#include "mbus-protocol-aux.h"
|
||||
|
||||
typedef struct _mbus_tcp_handle
|
||||
typedef struct _mbus_tcp_data
|
||||
{
|
||||
char *host;
|
||||
int port;
|
||||
} mbus_tcp_handle;
|
||||
} mbus_tcp_data;
|
||||
|
||||
int mbus_tcp_connect(mbus_handle *handle);
|
||||
int mbus_tcp_disconnect(mbus_handle *handle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user