|  |  |  | 
|---|
|  |  |  | * @throws Exception 异常 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { | 
|---|
|  |  |  | DataV202404 dV1 = (DataV202404)data.getSubData() ; | 
|---|
|  |  |  | DataV202404 dV202404 = (DataV202404)data.getSubData() ; | 
|---|
|  |  |  | DataCd84Vo cdData = new DataCd84Vo(CodeV202404.getCodeName(dataCode)) ; | 
|---|
|  |  |  | dV1.subData = cdData ; | 
|---|
|  |  |  | dV202404.subData = cdData ; | 
|---|
|  |  |  | int index = ProtocolConstantV206V202404.dataIndex ; | 
|---|
|  |  |  | cdData.controllerType = ByteUtil.bytes2Hex(bs, false, index, 1) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index ++ ;//水泵/阀   0xf0:阀门 0x00:水泵 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index ++ ;//当前用水方式   1个HEX 0x00:正常刷卡开泵/阀用水 | 
|---|
|  |  |  | index ++ ;//当前用水方式 | 
|---|
|  |  |  | cdData.opType = bs[index]; | 
|---|
|  |  |  | //进行兼容转换 | 
|---|
|  |  |  | cdData.opType = CommonV202404.openType2P206V1(cdData.opType) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index++ ; | 
|---|
|  |  |  | cdData.icCardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | index += 5 ; | 
|---|
|  |  |  | GlParse.parseAlarmAndState(bs, index, cdData) ;//四个字节 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | cdData.price = ByteUtil.BCD2Int_LE(bs, index, index + 1)/100.0 ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public static void main(String[] args) throws Exception { | 
|---|
|  |  |  | String hex = "69426981371425010201130084020AF00200000000620902003004050077289364503912943449101006255833070000000000000000000000000000000000014000009000C616"; | 
|---|
|  |  |  | byte[] bs = ByteUtil.hex2Bytes(hex) ; | 
|---|
|  |  |  | Cd_84_Up p = new Cd_84_Up() ; | 
|---|
|  |  |  | Data d = new Data() ; | 
|---|
|  |  |  | DataV202404 subd = new DataV202404() ; | 
|---|
|  |  |  | d.subData = subd ; | 
|---|
|  |  |  | p.doParse(bs, bs.length, "84", d); | 
|---|
|  |  |  | System.out.println(d.toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|