private CEMILData adjustMsgType(final CEMILData msg) { final boolean srcOk = msg.getSource().getRawAddress() != 0; // just return if we don't need to adjust source address and don't need LDataEx if ((srcOk || medium.getDeviceAddress().getRawAddress() == 0) && (medium instanceof TPSettings || msg instanceof CEMILDataEx)) return msg; return CEMIFactory.create(srcOk ? null : medium.getDeviceAddress(), null, msg, true); }