| | |
| | | */ |
| | | public enum DeviceField { |
| | | // 扫码器:每站点16字节,String[14] |
| | | BARCODE("DB103", 254, 16), |
| | | BARCODE("DB103", 254, 18, new int[]{0, 2}, 21), |
| | | // 出入库模式 |
| | | IO_MODE("DB103", 170, 4, new int[]{0, 2}, 21), |
| | | // 称重:每站点4字节,Float |
| | | //WEIGHT("DB102", 0, 4), |
| | | |
| | | WEIGHT("DB103", 634, 4), |
| | | WEIGHT("DB103", 634, 6, new int[]{0, 2}, 21), |
| | | // 尺寸异常:每站点2字节,Bit数组 |
| | | DIMENSION_WORD("DB103", 2, 8); |
| | | DIMENSION_WORD("DB103", 2, 8, new int[]{0, 2, 4, 6}, 21); |
| | | |
| | | private final String addressPattern; |
| | | private final int offset; |
| | | private final int byteLength; |
| | | private final int[] seg; |
| | | private final int arrLength; |
| | | |
| | | DeviceField(String addressPattern, int offset, int byteLength) { |
| | | DeviceField(String addressPattern, int offset, int byteLength, int[] seg, int arrLength) { |
| | | this.addressPattern = addressPattern; |
| | | this.offset = offset; |
| | | this.byteLength = byteLength; |
| | | this.seg = seg; |
| | | this.arrLength = arrLength; |
| | | } |
| | | |
| | | public String getAddressPattern() { |
| | |
| | | return byteLength; |
| | | } |
| | | |
| | | public int getArrLength() { |
| | | return arrLength; |
| | | } |
| | | |
| | | public int[] getSeg() { |
| | | return seg; |
| | | } |
| | | |
| | | /** |
| | | * 根据 DB 块编号和站点偏移生成具体地址 |
| | | * |