-
Notifications
You must be signed in to change notification settings - Fork 0
/
ahb_comm_MODBUS_TCP.cpp
81 lines (57 loc) · 2.42 KB
/
ahb_comm_MODBUS_TCP.cpp
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
aHomeBus Modbus TCP interface
@copyright 2019 Ivan Raspopov
Based on aSysBus - 2015-2017 Florian Knodt, www.adlerweb.info
Based on iSysBus - 2010 Patrick Amrhein, www.isysbus.org
This interface depends on the Modbus-Master-Slave-for-Arduino library.
Download: https://github.com/goddland16/Modbus-TCP
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AHB_MODBUS_TCP__C
#define AHB_MODBUS_TCP__C
#include "ahb_comm_MODBUS_RTU.h"
#include "ahb_proto.h"
#include "ModbusTCP.h"
AHB_MODBUS_TCP::AHB_MODBUS_TCP(void): //Добавить передачу ModbusDeviceIP
_interface(){
}
AHB_MODBUS_TCP::AHB_MODBUS_TCP(uint8_t u8MBUnitID): //Добавить передачу ModbusDeviceIP
_interface(u8MBUnitID){
}
void AHB_MODBUS_TCP::SetNodeId(uint8_t nodeId) {}
byte AHB_MODBUS_TCP::begin() {
//ModbusTCP node(1);
//node.setServerIPAddress(ModbusDeviceIP);
//Привязать к ETH
lastErr = 0; //Херня!!!! Обработать наличие ошибок. Лезть в класс чужой либы.
return lastErr;
}
void AHB_MODBUS_TCP::address_network_set(uint8_t *addr_net , int len_addr_net){
for (int i=0; i<len_addr_net; i++)
{
all_network_address[i]=addr_net[i];
#ifdef AHB_DEBUG
Serial.print(F("Address network CAN - "));Serial.println(all_network_address[i]);
#endif //AHB_DEBUG
}
}
uint8_t AHB_MODBUS_TCP::address_network_get(uint8_t i){
return all_network_address[i];
}
uint8_t AHB_MODBUS_TCP::busType(){
return type_MODBUS_TCP;
}
bool AHB_MODBUS_TCP::ahbSend_V(uint8_t type, uint8_t cmd, uint8_t target, uint8_t port, uint8_t source, uint8_t len, byte data[8]){
}
bool AHB_MODBUS_TCP::ahbReceive_V(ahbPacket &pkg){
}
#endif //AHB_MODBUS_TCP__C