public class HslHelper extends Object
| 构造器和说明 |
|---|
HslHelper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
CalculateBitStartIndex(String bit)
根据字符串内容,获取当前的位索引地址,例如输入 6,返回6,输入15,返回15,输入B,返回11
|
static int |
CalculateOccupyLength(int address,
int length)
根据位偏移的地址,长度信息,计算出实际的地址占用长度,地址的进制为 8
|
static int |
CalculateOccupyLength(int address,
int length,
int hex)
根据位偏移的地址,长度信息,计算出实际的地址占用长度
|
static OperateResultExThree<Integer,Short,Integer> |
CalculateStartBitIndexAndLength(int addressStart,
short length)
根据当前的位偏移地址及读取位长度信息,计算出实际的字节索引,字节数,字节位偏移
|
static OperateResultExTwo<Integer,String> |
ExtractParameter(String address,
String paraName)
解析地址的附加参数方法,比如你的地址是s=100;D100,可以提取出"s"的值的同时,修改地址本身,如果"s"不存在的话,返回错误的消息内容
The method of parsing additional parameters of the address, for example, if your address is s=100;D100, you can extract the value of "s" and modify the address itself. |
static OperateResultExTwo<Integer,String> |
ExtractParameter(String address,
String paraName,
int defaultValue)
解析地址的附加参数方法,比如你的地址是s=100;D100,可以提取出"s"的值的同时,修改地址本身,如果"s"不存在的话,返回给定的默认值
The method of parsing additional parameters of the address, for example, if your address is s=100;D100, you can extract the value of "s" and modify the address itself. |
static OperateResultExTwo<Integer,String> |
ExtractStartIndex(String address)
解析地址的起始地址的方法,比如你的地址是 A[1] , 那么将会返回 1,地址修改为 A,如果不存在起始地址,那么就不修改地址,返回 -1
The method of parsing the starting address of the address, for example, if your address is A[1], then it will return 1, and the address will be changed to A. |
static OperateResultExTwo<IByteTransform,String> |
ExtractTransformParameter(String address,
IByteTransform defaultTransform)
解析地址的附加
DataFormat 参数方法,比如你的地址是format=ABCD;D100,可以提取出"format"的值的同时,修改地址本身,如果"format"不存在的话,返回默认的 IByteTransform 对象Parse the additional DataFormat parameter method of the address. |
static OperateResultExTwo<Integer,String> |
GetBitIndexInformation(String address)
获取地址信息的位索引,在地址最后一个小数点的位置
|
static byte[] |
GetUTF8Bytes(String message)
从字符串的内容提取UTF8编码的字节,加了对空的校验
|
static OperateResultExTwo<int[],int[]> |
SplitReadLength(int address,
short length,
short segment)
切割当前的地址数据信息,根据读取的长度来分割成多次不同的读取内容,需要指定地址,总的读取长度,切割读取长度
Cut the current address data information, and divide it into multiple different read contents according to the read length. |
static <T> OperateResultExTwo<int[],ArrayList<T[]>> |
SplitWriteData(Class<T> tClass,
int address,
T[] value,
short segment,
int addressLength)
根据指定的长度切割数据数组,返回地址偏移量信息和数据分割信息
|
public static OperateResultExTwo<Integer,String> ExtractParameter(String address, String paraName, int defaultValue)
address - 复杂的地址格式,比如:s=100;D100paraName - 等待提取的参数名称defaultValue - 如果提取的参数信息不存在,返回的默认值信息public static OperateResultExTwo<Integer,String> ExtractParameter(String address, String paraName)
address - 复杂的地址格式,比如:s=100;D100paraName - 等待提取的参数名称public static OperateResultExTwo<Integer,String> ExtractStartIndex(String address)
address - 复杂的地址格式,比如:A[0]public static OperateResultExTwo<IByteTransform,String> ExtractTransformParameter(String address, IByteTransform defaultTransform)
DataFormat 参数方法,比如你的地址是format=ABCD;D100,可以提取出"format"的值的同时,修改地址本身,如果"format"不存在的话,返回默认的 IByteTransform 对象DataFormat parameter method of the address. For example, if your address is format=ABCD;D100,
you can extract the value of "format" and modify the address itself. If "format" does not exist,
Return the default IByteTransform objectaddress - 复杂的地址格式,比如:format=BADC;D100defaultTransform - 默认的数据转换信息public static OperateResultExTwo<int[],int[]> SplitReadLength(int address, short length, short segment)
address - 整数的地址信息length - 读取长度信息segment - 切割长度信息public static <T> OperateResultExTwo<int[],ArrayList<T[]>> SplitWriteData(Class<T> tClass, int address, T[] value, short segment, int addressLength)
T - 数组类型tClass - 数组类型address - 起始的地址value - 实际的数据信息segment - 分割的基本长度addressLength - 一个地址代表的数据长度public static OperateResultExTwo<Integer,String> GetBitIndexInformation(String address)
address - 地址信息public static byte[] GetUTF8Bytes(String message)
message - 字符串内容public static OperateResultExThree<Integer,Short,Integer> CalculateStartBitIndexAndLength(int addressStart, short length)
addressStart - 起始地址length - 读取的长度public static int CalculateBitStartIndex(String bit)
bit - 位字符串public static int CalculateOccupyLength(int address,
int length)
address - 偏移地址length - 长度信息public static int CalculateOccupyLength(int address,
int length,
int hex)
address - 偏移地址length - 长度信息hex - 地址的进制信息,一般为8 或是 16Copyright © 2022. All rights reserved.