mikroSDK Reference Manual
modbus_server_misc.h
Go to the documentation of this file.
1
31#ifndef _MODBUS_SERVER_MISC_H
32#define _MODBUS_SERVER_MISC_H
33
34//Dependencies
35#include "core/net.h"
37
38//C++ guard
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43//Modbus/TCP server related functions
44void modbusServerTick(ModbusServerContext *context);
45
46void modbusServerRegisterConnectionEvents(ModbusClientConnection *connection,
47 SocketEventDesc *eventDesc);
48
49void modbusServerProcessConnectionEvents(ModbusClientConnection *connection);
50
51error_t modbusServerParseMbapHeader(ModbusClientConnection *connection);
52
53error_t modbusServerFormatMbapHeader(ModbusClientConnection *connection,
54 size_t length);
55
56void *modbusServerGetRequestPdu(ModbusClientConnection *connection,
57 size_t *length);
58
59void *modbusServerGetResponsePdu(ModbusClientConnection *connection);
60
61void modbusServerLock(ModbusClientConnection *connection);
62void modbusServerUnlock(ModbusClientConnection *connection);
63
64error_t modbusServerReadCoil(ModbusClientConnection *connection,
65 uint16_t address, bool_t *state);
66
67error_t modbusServerReadDiscreteInput(ModbusClientConnection *connection,
68 uint16_t address, bool_t *state);
69
70error_t modbusServerWriteCoil(ModbusClientConnection *connection,
71 uint16_t address, bool_t state, bool_t commit);
72
73error_t modbusServerReadHoldingReg(ModbusClientConnection *connection,
74 uint16_t address, uint16_t *value);
75
76error_t modbusServerReadInputReg(ModbusClientConnection *connection,
77 uint16_t address, uint16_t *value);
78
79error_t modbusServerWriteReg(ModbusClientConnection *connection,
80 uint16_t address, uint16_t value, bool_t commit);
81
82ModbusExceptionCode modbusServerTranslateExceptionCode(error_t status);
83
84//C++ guard
85#ifdef __cplusplus
86}
87#endif
88
89#endif
error_t
Error codes.
Definition error.h:43
ModbusExceptionCode
Modbus exception codes.
Definition modbus_common.h:103
Modbus/TCP server.
TCP/IP stack core.
Structure describing socket events.
Definition socket.h:395