我应从记本中拿到身份证,但该法典没有给出正确的说法。 谁能告诉我,我的法典中有什么错误? (详情见下文)
for (int i = 0; i < numberOfSRecords; i++) {
socketReader.read(cbuf, 0, 4);
String Param_Codes_In_HEX =
Integer.toHexString(0x000000ff & cbuf[2]) +
Integer.toHexString(0x000000ff & cbuf[1]) +
Integer.toHexString(0x000000ff & cbuf[0]);
System.out.println("Param_Codes_In_HEX: "+Param_Codes_In_HEX);
int paramCode = Integer.parseInt(Param_Codes_In_HEX, 16);
if ((0x000000ff & cbuf[3]) ==0) {
EnumParamCodes enumParamCode =
EnumConverterUtil.getEnumFor(EnumParamCodes.class, paramCode);
System.out.println("Param_code " + paramCode + ": " + enumParamCode);
}
else if((0x000000ff & cbuf[3]) ==64)
{
paramCode = 0x0000ffff & paramCode ;
EnumParamCodes enumParamCode = EnumConverterUtil.getEnumFor(EnumParamCodes.class, paramCode);
System.out.println("Param_code " + paramCode + ": " + enumParamCode);
}
else if ((0x000000ff & cbuf[3]) ==128) {
paramCode = 0x00ffffff & paramCode ;
EnumAlarm enumParamCodeAlarm = EnumConverterUtil.getEnumFor(EnumAlarm.class, paramCode);
System.out.println("Param_code " + paramCode + ": " + enumParamCodeAlarm);
}
else{
System.out.println("Error in the body of message");
}
}
Note: • For Numerical and Enumerative Parameters (ActualValue), the Param_code corresponds to the ID in the Parameters section
• For Numerical and Enumerative Parameters (SetValue), the Param_code corresponds to 0x40000000 + the ID in the Parameters section
• For Alarm Parameters, the Param_code corresponds to 0x80000000 + the ID in the Parameters section