Rebuilding M-Bus context structs in progress
- changed local library file includes from <> to "" - get rid of 'if (is_serial)' conditions - mbus_context_serial() and mbus_context_tcp() allocates memory and initialize context specific function pointers - simply mbus_connect() called instead of mbus_connect_tcp() or mbus_connect_serial() - context specific data can still be accessed via (void* auxdata) pointer - strdup(3) to copy host IP into TCP context struct
This commit is contained in:
19
mbus/mbus-tcp.h
Normal file → Executable file
19
mbus/mbus-tcp.h
Normal file → Executable file
@ -18,22 +18,19 @@
|
||||
#ifndef MBUS_TCP_H
|
||||
#define MBUS_TCP_H
|
||||
|
||||
#include <mbus/mbus.h>
|
||||
|
||||
typedef struct _mbus_tcp_handle {
|
||||
#include "mbus-protocol.h"
|
||||
#include "mbus-protocol-aux.h"
|
||||
|
||||
typedef struct _mbus_tcp_handle
|
||||
{
|
||||
char *host;
|
||||
|
||||
int port;
|
||||
int sock;
|
||||
|
||||
} mbus_tcp_handle;
|
||||
|
||||
|
||||
mbus_tcp_handle *mbus_tcp_connect(char *host, int port);
|
||||
int mbus_tcp_disconnect(mbus_tcp_handle *handle);
|
||||
int mbus_tcp_send_frame(mbus_tcp_handle *handle, mbus_frame *frame);
|
||||
int mbus_tcp_recv_frame(mbus_tcp_handle *handle, mbus_frame *frame);
|
||||
int mbus_tcp_connect(mbus_handle *handle);
|
||||
int mbus_tcp_disconnect(mbus_handle *handle);
|
||||
int mbus_tcp_send_frame(mbus_handle *handle, mbus_frame *frame);
|
||||
int mbus_tcp_recv_frame(mbus_handle *handle, mbus_frame *frame);
|
||||
|
||||
#endif /* MBUS_TCP_H */
|
||||
|
||||
|
Reference in New Issue
Block a user