public class AllenBradleyNet extends NetworkDeviceBase
| 限定符和类型 | 字段和说明 |
|---|---|
int |
ArraySegment |
byte[] |
PortSlot |
WordLengthAlienSession, isPersistentConn, IsSocketError, isUseAccountCertificate, LogMsgFormatBinary, simpleHybirdLockCoreSocket, fileCacheSize, LogNet, TokenLogNet| 构造器和说明 |
|---|
AllenBradleyNet()
Instantiate a communication object for a Allenbradley PLC protocol
|
AllenBradleyNet(String ipAddress)
Instantiate a communication object for a Allenbradley PLC protocol
|
AllenBradleyNet(String ipAddress,
int port)
Instantiate a communication object for a Allenbradley PLC protocol
|
| 限定符和类型 | 方法和说明 |
|---|---|
OperateResultExOne<byte[]> |
BuildReadCommand(String[] address)
Build a read command bytes
|
OperateResultExOne<byte[]> |
BuildReadCommand(String[] address,
int[] length)
Build a read command bytes
|
OperateResultExOne<byte[]> |
BuildWriteCommand(String address,
Boolean data)
Create a written message instruction
|
OperateResultExOne<byte[]> |
BuildWriteCommand(String address,
short typeCode,
byte[] data)
Create a written message instruction
|
OperateResultExOne<byte[]> |
BuildWriteCommand(String address,
short typeCode,
byte[] data,
int length)
Create a written message instruction
|
protected OperateResult |
ExtraOnDisconnect(Socket socket)
A next step handshake agreement is required before disconnecting the Allenbradley plc
|
int |
getArraySegment()
when read array type, this means the segment length. when data type is 8-byte data, it should set to be 50
|
MessageRouter |
getMessageRouter()
获取或设置当前的通信的消息路由信息,可以实现一些复杂情况的通信,数据包含背板号,路由参数,slot,例如:1.15.2.18.1.1
Get or set the message routing information of the current communication, which can realize some complicated communication. |
protected INetMessage |
GetNewNetMessage()
获取一个新的消息对象的方法,需要在继承类里面进行重写
The method to get a new message object needs to be overridden in the inheritance class |
byte[] |
getPortSlot()
port and slot information
|
int |
getSessionHandle()
The current session handle, which is determined by the PLC when communicating with the PLC handshake
|
byte |
getSlot()
Gets the slot number information for the current plc, which should be set before connections
|
protected OperateResult |
InitializationOnConnect(Socket socket)
根据实际的协议选择是否重写本方法,有些协议在创建连接之后,需要进行一些初始化的信号握手,才能最终建立网络通道。
|
protected byte[] |
PackCommandService(byte[] portSlot,
byte[]... cips) |
protected byte[] |
PackCommandWithHeader(byte[] command)
对当前的命令进行打包处理,通常是携带命令头内容,标记当前的命令的长度信息,需要进行重写,否则默认不打包
|
OperateResultExOne<byte[]> |
Read(String[] address)
Bulk read Data information
|
OperateResultExOne<byte[]> |
Read(String[] address,
int[] length)
批量读取数据信息,数据长度为读取的数组长度信息 -> Bulk read data information, data length for read array length information
|
OperateResultExOne<byte[]> |
Read(String address,
short length)
Read data information, data length for read array length information
|
OperateResultExOne<Boolean> |
ReadBool(String address)
读取单个的bool数据信息 -> Read a single BOOL data information
|
OperateResultExOne<boolean[]> |
ReadBool(String address,
short length)
|
OperateResultExOne<boolean[]> |
ReadBoolArray(String address)
批量读取的bool数组信息 -> Bulk read of bool array information
|
OperateResultExOne<Byte> |
ReadByte(String address)
读取PLC的byte类型的数据 -> Read the byte type of PLC data
|
OperateResultExOne<byte[]> |
ReadCipFromServer(byte[]... cips)
使用CIP报文和服务器进行核心的数据交换
|
OperateResultExOne<double[]> |
ReadDouble(String address,
short length)
读取PLC的double类型的数组 -> An array that reads the double type of the PLC
|
OperateResultExOne<float[]> |
ReadFloat(String address,
short length)
读取PLC的float类型的数组 -> An array that reads the float type of the PLC
|
OperateResultExOne<short[]> |
ReadInt16(String address,
short length)
读取PLC的short类型的数组 -> Read an array of the short type of the PLC
|
OperateResultExOne<int[]> |
ReadInt32(String address,
short length)
读取PLC的int类型的数组 -> An array that reads the int type of the PLC
|
OperateResultExOne<long[]> |
ReadInt64(String address,
short length)
读取PLC的long类型的数组 -> An array that reads the long type of the PLC
|
OperateResultExOne<String> |
ReadPlcType()
读取PLC的型号信息
|
OperateResultExOne<byte[]> |
ReadSegment(String address,
int startIndex,
int length)
Read Segment Data Array form plc, use address tag name
|
OperateResultExOne<String> |
ReadString(String address)
读取PLC的string类型的数据 -> read plc string type value
|
OperateResultExOne<String> |
ReadString(String address,
short length,
String encoding)
读取PLC的string类型的数据 -> read plc string type value
|
OperateResultExTwo<Short,byte[]> |
ReadTag(String address,
int length)
从PLC里读取一个指定标签名的原始数据信息及其数据类型信息
Read the original data information of a specified tag name and its data type information from the PLC |
OperateResultExOne<int[]> |
ReadUInt16(String address,
short length)
读取PLC的ushort类型的数组 -> Read an array of the ushort type of the PLC
|
OperateResultExOne<long[]> |
ReadUInt32(String address,
short length)
读取PLC的int类型的数组 -> An array that reads the int type of the PLC
|
void |
setArraySegment(int value)
when read array type, this means the segment length. when data type is 8-byte data, it should set to be 50
|
void |
setMessageRouter(MessageRouter value)
获取或设置当前的通信的消息路由信息,可以实现一些复杂情况的通信,数据包含背板号,路由参数,slot,例如:1.15.2.18.1.1
Get or set the message routing information of the current communication, which can realize some complicated communication. |
void |
setPortSlot(byte[] value)
port and slot information
|
void |
setSlot(byte value)
Sets the slot number information for the current plc, which should be set before connections
|
String |
toString()
返回表示当前对象的字符串
|
OperateResult |
Write(String address,
boolean value)
写入单个Bool的数据信息。
|
OperateResult |
Write(String address,
byte value)
向PLC中写入byte数据,返回是否写入成功
|
OperateResult |
Write(String address,
double[] values)
Writes an array of double to the PLC to return whether the write was successful
|
OperateResult |
Write(String address,
float[] values)
Writes an array of float to the PLC to return whether the write was successful
|
OperateResult |
Write(String address,
int[] values)
向PLC中写入int数组,返回是否写入成功 -> Writes an int array to the PLC to return whether the write was successful
|
OperateResult |
Write(String address,
long[] values)
Writes an array of long to the PLC to return whether the write was successful
|
OperateResult |
Write(String address,
short[] values)
向PLC中写入short数组,返回是否写入成功 -> Writes a short array to the PLC to return whether the write was successful
|
OperateResult |
Write(String address,
String value)
向PLC中写入string数据,返回是否写入成功,针对的是ASCII编码的数据内容
|
OperateResult |
WriteTag(String address,
short typeCode,
byte[] value)
使用指定的类型写入指定的节点数据 -> Writes the specified node data with the specified type
|
OperateResult |
WriteTag(String address,
short typeCode,
byte[] value,
int length)
使用指定的类型写入指定的节点数据 -> Writes the specified node data with the specified type
|
ReadCustomer, ReadDouble, ReadFloat, ReadInt16, ReadInt32, ReadInt64, ReadString, ReadString, ReadUInt16, ReadUInt32, Write, Write, Write, Write, Write, Write, Write, Write, Write, Write, WriteCustomer, WriteUnicodeString, WriteUnicodeStringAccountCertificate, ConnectClose, ConnectServer, ConnectServer, ExtraAfterReadFromCoreServer, GetAvailableSocket, getByteTransform, getConnectionId, getConnectTimeOut, getIpAddress, getPort, getReceiveTimeOut, getSleepTime, IpAddressPing, ReadFromCoreServer, ReadFromCoreServer, ReadFromCoreServer, setByteTransform, setConnectionId, setConnectTimeOut, setIpAddress, SetLoginAccount, SetPersistentConnection, setPort, setReceiveTimeOut, setSleepTime, UnpackResponseContentCheckRemoteToken, CloseSocket, CreateSocketAndConnect, CreateSocketAndConnect, CreateSocketAndConnect, ReadStream, Receive, Receive, Receive, ReceiveAndCheckBytes, ReceiveByMessage, ReceiveByMessage, ReceiveBytesContentFromSocket, ReceiveBytesContentFromSocket, ReceiveCommandLineFromSocket, ReceiveCommandLineFromSocket, ReceiveCommandLineFromSocket, ReceiveCommandLineFromSocket, ReceiveFrameWebSocketPayload, ReceiveHslMessage, ReceiveMqttMessage, ReceiveRedisCommand, ReceiveRedisCommandString, ReceiveStringArrayContentFromSocket, ReceiveStringArrayContentFromSocket, ReceiveStringContentFromSocket, ReceiveStringContentFromSocket, ReceiveWebSocketPayload, Send, Send, SendAccountAndCheckReceive, SendBaseAndCheckReceive, SendBytesAndCheckReceive, SendStreamToSocket, SendStringAndCheckReceive, SendStringAndCheckReceive, ThreadPoolCheckTimeOut, WriteStream, WriteStreamFromSocketclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitReadFromCoreServerConnectClose, getConnectionId, setConnectionIdpublic AllenBradleyNet()
public AllenBradleyNet(String ipAddress)
ipAddress - Ip addresspublic AllenBradleyNet(String ipAddress, int port)
ipAddress - ip addressport - portprotected INetMessage GetNewNetMessage()
NetworkDoubleBaseGetNewNetMessage 在类中 NetworkDoubleBaseprotected byte[] PackCommandWithHeader(byte[] command)
NetworkDoubleBasePackCommandWithHeader 在类中 NetworkDoubleBasecommand - 发送的数据命令内容public int getSessionHandle()
public byte getSlot()
public void setSlot(byte value)
value - valuepublic int getArraySegment()
public void setArraySegment(int value)
value - valuepublic byte[] getPortSlot()
public void setPortSlot(byte[] value)
value - public MessageRouter getMessageRouter()
public void setMessageRouter(MessageRouter value)
value - 路由消息内容protected OperateResult InitializationOnConnect(Socket socket)
NetworkDoubleBaseInitializationOnConnect 在类中 NetworkDoubleBasesocket - 网络套接字protected OperateResult ExtraOnDisconnect(Socket socket)
ExtraOnDisconnect 在类中 NetworkDoubleBasesocket - socket before connection closepublic OperateResultExOne<byte[]> BuildReadCommand(String[] address, int[] length)
address - the address of the tag namelength - Array information, if not arrays, is 1public OperateResultExOne<byte[]> BuildReadCommand(String[] address)
address - The address of the tag namepublic OperateResultExOne<byte[]> BuildWriteCommand(String address, short typeCode, byte[] data)
address - The address of the tag nametypeCode - Data typedata - Source Datapublic OperateResultExOne<byte[]> BuildWriteCommand(String address, short typeCode, byte[] data, int length)
address - The address of the tag nametypeCode - Data typedata - Source Datalength - In the case of arrays, the length of the arraypublic OperateResultExOne<byte[]> BuildWriteCommand(String address, Boolean data)
address - The address of the tag namedata - Bool Datapublic OperateResultExOne<byte[]> Read(String address, short length)
Read 在接口中 IReadWriteNetRead 在类中 NetworkDeviceBaseaddress - Address format of the nodelength - In the case of arrays, the length of the arraypublic OperateResultExOne<byte[]> Read(String[] address)
address - Name of the nodepublic OperateResultExOne<byte[]> Read(String[] address, int[] length)
address - 节点的名称 -> Name of the nodelength - 如果是数组,就为数组长度 -> In the case of arrays, the length of the arraypublic OperateResultExOne<byte[]> ReadSegment(String address, int startIndex, int length)
address - Tag name in plcstartIndex - array start indexlength - array lengthpublic OperateResultExOne<byte[]> ReadCipFromServer(byte[]... cips)
cips - Cip commandspublic OperateResultExOne<Boolean> ReadBool(String address)
ReadBool 在接口中 IReadWriteNetReadBool 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodepublic OperateResultExOne<boolean[]> ReadBoolArray(String address)
address - 节点的名称 -> Name of the nodepublic OperateResultExOne<boolean[]> ReadBool(String address, short length)
IReadWriteNetBoolean 数组信息,需要指定地址和长度,返回 Boolean 数组Boolean array information, need to specify the address and length, return Boolean arrayReadBool 在接口中 IReadWriteNetReadBool 在类中 NetworkDeviceBaseaddress - 数据地址length - 数据长度public OperateResultExOne<Byte> ReadByte(String address)
address - 节点的名称 -> Name of the nodepublic OperateResultExOne<short[]> ReadInt16(String address, short length)
ReadInt16 在接口中 IReadWriteNetReadInt16 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodelength - 数组长度 -> Array lengthpublic OperateResultExOne<int[]> ReadUInt16(String address, short length)
ReadUInt16 在接口中 IReadWriteNetReadUInt16 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodelength - 数组长度 -> Array lengthpublic OperateResultExOne<int[]> ReadInt32(String address, short length)
ReadInt32 在接口中 IReadWriteNetReadInt32 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodelength - 数组长度 -> Array lengthpublic OperateResultExOne<long[]> ReadUInt32(String address, short length)
ReadUInt32 在接口中 IReadWriteNetReadUInt32 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodelength - 数组长度 -> Array lengthpublic OperateResultExOne<float[]> ReadFloat(String address, short length)
ReadFloat 在接口中 IReadWriteNetReadFloat 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodelength - 数组长度 -> Array lengthpublic OperateResultExOne<long[]> ReadInt64(String address, short length)
ReadInt64 在接口中 IReadWriteNetReadInt64 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodelength - 数组长度 -> Array lengthpublic OperateResultExOne<double[]> ReadDouble(String address, short length)
ReadDouble 在接口中 IReadWriteNetReadDouble 在类中 NetworkDeviceBaseaddress - 起始地址 节点的名称 -> Name of the nodelength - 数组长度 -> Array lengthpublic OperateResultExOne<String> ReadString(String address)
address - Name of the nodepublic OperateResultExOne<String> ReadString(String address, short length, String encoding)
address - Name of the nodelength - Array lengthencoding - Result data with result infopublic OperateResultExOne<String> ReadPlcType()
public OperateResultExTwo<Short,byte[]> ReadTag(String address, int length)
address - PLC的标签地址信息length - 读取的数据长度public OperateResult WriteTag(String address, short typeCode, byte[] value)
address - 节点的名称 -> Name of the nodetypeCode - 类型代码,详细参见 AllenBradleyHelper 上的常用字段 -> Type code, see the commonly used Fields section on the AllenBradleyHelper in detailvalue - 实际的数据值 -> The actual data valuepublic OperateResult WriteTag(String address, short typeCode, byte[] value, int length)
address - 节点的名称 -> Name of the nodetypeCode - 类型代码,详细参见 AllenBradleyHelper 上的常用字段 -> Type code, see the commonly used Fields section on the AllenBradleyHelper in detailvalue - 实际的数据值 -> The actual data valuelength - 如果节点是数组,就是数组长度 -> If the node is an array, it is the array lengthpublic OperateResult Write(String address, short[] values)
Write 在接口中 IReadWriteNetWrite 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodevalues - 实际数据 -> Actual datapublic OperateResult Write(String address, int[] values)
Write 在接口中 IReadWriteNetWrite 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodevalues - 实际数据 -> Actual datapublic OperateResult Write(String address, float[] values)
Write 在接口中 IReadWriteNetWrite 在类中 NetworkDeviceBaseaddress - Name of the nodevalues - Actual datapublic OperateResult Write(String address, long[] values)
Write 在接口中 IReadWriteNetWrite 在类中 NetworkDeviceBaseaddress - Name of the nodevalues - Actual datapublic OperateResult Write(String address, double[] values)
Write 在接口中 IReadWriteNetWrite 在类中 NetworkDeviceBaseaddress - Name of the nodevalues - Actual datapublic OperateResult Write(String address, String value)
Write 在接口中 IReadWriteNetWrite 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodevalue - 实际数据 -> Actual datapublic OperateResult Write(String address, boolean value)
Write 在接口中 IReadWriteNetWrite 在类中 NetworkDeviceBaseaddress - 节点的名称 -> Name of the nodevalue - 实际数据 -> Actual datapublic OperateResult Write(String address, byte value)
address - 节点的名称 -> Name of the nodevalue - 实际数据 -> Actual dataprotected byte[] PackCommandService(byte[] portSlot,
byte[]... cips)
throws IOException
IOExceptionpublic String toString()
toString 在类中 NetworkDeviceBaseCopyright © 2022. All rights reserved.