public class AllenBradleyHelper extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
CIP_Execute_PCCC
CIP命令中PCCC命令相关的信息
|
static int |
CIP_MULTIREAD_DATA
CIP命令中的对数据读取服务
|
static int |
CIP_READ_DATA
CIP命令中的读取数据的服务
|
static int |
CIP_READ_FRAGMENT
CIP命令中的读片段的数据服务
|
static int |
CIP_READ_LIST
CIP指令中读取数据的列表
|
static int |
CIP_READ_WRITE_DATA
CIP命令中的读并写的数据服务
|
static int |
CIP_Type_BitArray
二进制数据内容
|
static int |
CIP_Type_Bool
bool型数据,一个字节长度
|
static int |
CIP_Type_Byte
byte型数据,一个字节长度
|
static int |
CIP_Type_D1
Bit string, 16-bits, WORD
|
static int |
CIP_Type_D2
Bit string, 32 bits, DWORD
|
static int |
CIP_Type_Double
实数数据,八个字节的长度
|
static int |
CIP_Type_DWord
长整型,四个字节长度
|
static int |
CIP_Type_LInt
特长整型,8个字节
|
static int |
CIP_Type_Real
实数数据,四个字节长度
|
static int |
CIP_Type_String
字符串数据内容
|
static int |
CIP_Type_Struct
结构体数据,不定长度
|
static int |
CIP_Type_UDint
Unsigned 32-bit integer, UDINT
|
static int |
CIP_Type_UInt
Unsigned 16-bit integer, UINT
|
static int |
CIP_Type_ULint
Unsigned 64-bit integer, ULINT
|
static int |
CIP_Type_USInt
Unsigned 8-bit integer, USINT
|
static int |
CIP_Type_Word
整型,两个字节长度
|
static int |
CIP_WRITE_DATA
CIP命令中的写数据的服务
|
static int |
CIP_WRITE_FRAGMENT
CIP命令中的写片段的数据服务
|
static int |
OriginatorSerialNumber
连接方的序列号
|
static short |
OriginatorVendorID
连接方的厂商标识
|
| 构造器和说明 |
|---|
AllenBradleyHelper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static OperateResultExTwo<String,Integer> |
AnalysisArrayIndex(String address)
分析地址数据信息里的位索引的信息,例如a[10] 返回 a 和 10 索引,如果没有指定索引,就默认为0
|
static OperateResult |
CheckResponse(byte[] response)
初步检查返回的CIP协议的报文是否正确
Initially check whether the returned CIP protocol message is correct |
static OperateResultExThree<byte[],Short,Boolean> |
ExtractActualData(byte[] response,
boolean isRead)
从PLC反馈的数据解析
|
static byte[] |
PackCleanCommandService(byte[] portSlot,
byte[]... cips)
将所有的cip指定进行打包操作。
|
static byte[] |
PackCommandService(byte[] portSlot,
byte[]... cips)
将所有的cip指定进行打包操作。
|
static byte[] |
PackCommandSingleService(byte[] command,
int code,
boolean isConnected)
将所有的cip指定进行打包操作。
|
static byte[] |
PackCommandSpecificData(byte[]... service)
生成读取直接节点数据信息的内容
|
static OperateResultExOne<byte[]> |
PackExecutePCCCRead(int tns,
String address,
short length)
打包一个PCCC的读取的命令报文
|
static OperateResultExOne<byte[]> |
PackExecutePCCCWrite(int tns,
String address,
byte[] value)
打包一个PCCC的写入的命令报文
|
static OperateResultExOne<byte[]> |
PackExecutePCCCWrite(int tns,
String address,
int bitIndex,
boolean value) |
static byte[] |
PackRequestHeader(int command,
int session,
byte[] commandSpecificData)
将CommandSpecificData的命令,打包成可发送的数据指令
|
static byte[] |
PackRequestHeader(int command,
int session,
byte[] commandSpecificData,
byte[] senderContext) |
static byte[] |
PackRequestReadSegment(String address,
int startIndex,
int length)
打包生成一个请求读取数据片段的节点信息,CIP指令信息
|
static byte[] |
PackRequestWrite(String address,
boolean value)
写入Bool数据的基本指令信息
|
static byte[] |
PackRequestWrite(String address,
int typeCode,
byte[] value)
根据指定的数据和类型,生成对应的数据
|
static byte[] |
PackRequestWrite(String address,
int typeCode,
byte[] value,
int length)
根据指定的数据和类型,生成对应的数据
|
static byte[] |
PackRequestWrite(String address,
int typeCode,
byte[] value,
int length,
boolean isConnectedAddress)
根据指定的数据和类型,生成对应的数据
|
static byte[] |
PackRequsetRead(String address,
int length)
打包生成一个请求读取数据的节点信息,CIP指令信息
|
static byte[] |
PackRequsetRead(String address,
int length,
boolean isConnectedAddress)
打包生成一个请求读取数据的节点信息,CIP指令信息
|
static OperateResultExOne<String> |
ReadPlcType(IReadWriteDevice plc)
从PLC里读取当前PLC的型号信息
Read the current PLC model information from the PLC |
static byte[] |
RegisterSessionHandle()
向PLC注册会话ID的报文
Register a message with the PLC for the session ID |
static byte[] |
RegisterSessionHandle(byte[] senderContext)
向PLC注册会话ID的报文
Register a message with the PLC for the session ID |
static byte[] |
UnRegisterSessionHandle(int sessionHandle)
获取卸载一个已注册的会话的报文
Get a message to uninstall a registered session |
public static final int CIP_Execute_PCCC
public static final int CIP_READ_DATA
public static final int CIP_WRITE_DATA
public static final int CIP_READ_WRITE_DATA
public static final int CIP_READ_FRAGMENT
public static final int CIP_WRITE_FRAGMENT
public static final int CIP_READ_LIST
public static final int CIP_MULTIREAD_DATA
public static final int CIP_Type_Bool
public static final int CIP_Type_Byte
public static final int CIP_Type_Word
public static final int CIP_Type_DWord
public static final int CIP_Type_LInt
public static final int CIP_Type_USInt
public static final int CIP_Type_UInt
public static final int CIP_Type_UDint
public static final int CIP_Type_ULint
public static final int CIP_Type_Real
public static final int CIP_Type_Double
public static final int CIP_Type_Struct
public static final int CIP_Type_String
public static final int CIP_Type_D1
public static final int CIP_Type_D2
public static final int CIP_Type_BitArray
public static final short OriginatorVendorID
public static final int OriginatorSerialNumber
public static byte[] PackRequsetRead(String address, int length)
address - 地址length - 指代数组的长度public static byte[] PackRequsetRead(String address, int length, boolean isConnectedAddress)
address - 地址length - 指代数组的长度isConnectedAddress - 是否基于连接的协议的格式public static byte[] PackRequestReadSegment(String address, int startIndex, int length) throws IOException
address - 节点的名称startIndex - 起始的索引位置length - 读取的数据长度,对于short来说,最大是489长度IOExceptionpublic static byte[] PackRequestWrite(String address, int typeCode, byte[] value)
address - 地址信息typeCode - 数据类型value - 字节值public static byte[] PackRequestWrite(String address, int typeCode, byte[] value, int length)
address - 地址信息typeCode - 数据类型value - 字节值length - 如果节点为数组,就是数组长度public static byte[] PackRequestWrite(String address, int typeCode, byte[] value, int length, boolean isConnectedAddress)
address - 地址信息typeCode - 数据类型value - 字节值length - 如果节点为数组,就是数组长度isConnectedAddress - 是否基于连接的协议实现public static byte[] PackRequestWrite(String address, boolean value) throws IOException
address - 地址value - 值IOException - 错误信息public static OperateResultExTwo<String,Integer> AnalysisArrayIndex(String address)
address - 数据地址public static byte[] PackCommandService(byte[] portSlot,
byte[]... cips)
throws IOException
portSlot - PLC所在的面板槽号cips - 所有的cip打包指令信息IOExceptionpublic static byte[] PackCommandSingleService(byte[] command,
int code,
boolean isConnected)
command - 指令信息code - 服务器的代号信息isConnected - 是否基于连接的服务public static byte[] PackCommandSpecificData(byte[]... service)
service - cip指令内容IOExceptionpublic static OperateResultExOne<byte[]> PackExecutePCCCRead(int tns, String address, short length)
tns - 请求序号信息address - 请求的文件地址,地址示例:N7:1length - 请求的字节长度public static OperateResultExOne<byte[]> PackExecutePCCCWrite(int tns, String address, byte[] value)
tns - 请求序号信息address - 请求的文件地址,地址示例:N7:1value - 写入的原始数据信息public static OperateResultExOne<byte[]> PackExecutePCCCWrite(int tns, String address, int bitIndex, boolean value)
public static byte[] RegisterSessionHandle()
public static byte[] RegisterSessionHandle(byte[] senderContext)
senderContext - 发送的上下文信息public static byte[] UnRegisterSessionHandle(int sessionHandle)
sessionHandle - 当前会话的ID信息public static OperateResult CheckResponse(byte[] response)
response - CIP的报文信息public static byte[] PackRequestHeader(int command,
int session,
byte[] commandSpecificData)
command - 实际的命令暗号session - 当前会话的idcommandSpecificData - CommandSpecificData命令public static byte[] PackRequestHeader(int command,
int session,
byte[] commandSpecificData,
byte[] senderContext)
public static OperateResultExThree<byte[],Short,Boolean> ExtractActualData(byte[] response, boolean isRead)
response - PLC的反馈数据isRead - 是否是返回的操作public static OperateResultExOne<String> ReadPlcType(IReadWriteDevice plc)
plc - PLC对象public static byte[] PackCleanCommandService(byte[] portSlot,
byte[]... cips)
portSlot - PLC所在的面板槽号cips - 所有的cip打包指令信息Copyright © 2022. All rights reserved.