code: public DeviceDataHistory[] command_history(final DeviceProxy deviceProxy, final String cmdname,
              final int nb) throws DevFailed {
          checkIfTango(deviceProxy, "command_history");
  
          build_connection(deviceProxy);
  
          if (DeviceProxy.isCheck_idl() && get_idl_version(deviceProxy) < 2) {
              Except.throw_non_supported_exception("TangoApi_IDL_NOT_SUPPORTED",
                  "Not supported by the IDL version used by device", deviceProxy
                      .getFull_class_name()
                      + ".command_history()");
  	    }
  
          DeviceDataHistory[] histories = new DeviceDataHistory[0];
          try {
              // Check IDL revision to know kind of history.
              if (deviceProxy.device_5 != null) {
                  final DevCmdHistory_4 cmdHistory =
                          deviceProxy.device_5.command_inout_history_4(cmdname, nb);
                  histories = ConversionUtil.commandHistoryToDeviceDataHistoryArray(cmdname, cmdHistory);
              }
              else if (deviceProxy.device_4 != null) {
                  final DevCmdHistory_4 cmdHistory =
                          deviceProxy.device_4.command_inout_history_4(cmdname, nb);
                  histories = ConversionUtil.commandHistoryToDeviceDataHistoryArray(cmdname, cmdHistory);
              }
              else {
                  final DevCmdHistory[] cmdHistory =
                          deviceProxy.device_2.command_inout_history_2(cmdname, nb);
                  histories = new DeviceDataHistory[cmdHistory.length];
                  for (int i = 0; i < cmdHistory.length; i++) {
                      histories[i] = new DeviceDataHistory(cmdname, cmdHistory[i]);
                  }
              }
          } catch (final DevFailed e) {
              throw e;
          } catch (final Exception e) {
              throw_dev_failed(deviceProxy, e, "command_inout_history()", false);
          }
          return histories;
      }
docs: ==========================================================================