-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmodbusServer.h
More file actions
46 lines (33 loc) · 909 Bytes
/
modbusServer.h
File metadata and controls
46 lines (33 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Created by irvy on 8/6/15.
//
#ifndef MODBUSSERVER_MODBUSSERVER_H
#define MODBUSSERVER_MODBUSSERVER_H
#include <stdlib.h>
#include <iostream>
#include <unistd.h>
#include <mutex>
#include <modbus/modbus.h>
class modbusServer {
public:
modbusServer();
~modbusServer();
void recieveMessages();
bool initModbus(int port, bool debugging);
bool isRunning();
bool setRegisterValue(int registerNumber, uint16_t value);
uint16_t getRegisterValue(int registerNumber);
private:
modbus_t *ctx;
modbus_mapping_t *mapping;
bool m_initialized;
int m_modbusSocket;
int m_port;
int m_errCount;
// Mapping!
int m_numBits;
int m_numInputBits;
int m_numRegisters;
int m_numInputRegisters;
};
#endif //MODBUSSERVER_MODBUSSERVER_H