function PAPI_moni_Handlder(handler) {
  /*************************************************************************
   **************** PRIVATE VARIABLES AND METHODS ***************************
   *************************************************************************/
  //Private Promax handler
  //var handler = new PAPI_P_Handler();

  var get_command = function (id, param) {
    return new PAPI_newClientData(PAPI_data_type.CMD, 'MONI ' + id, param);
  };

  var get_command_scan = function (id, param) {
    return new PAPI_newClientData(PAPI_data_type.CMD, 'SCAN ' + id, param);
  };

  var get_question = function (id, param) {
    return new PAPI_newClientData(PAPI_data_type.CMD, '?MONI ' + id, param);
  };

  var get_question_scan = function (id, param) {
    return new PAPI_newClientData(PAPI_data_type.CMD, '?SCAN ' + id, param);
  };

  /*************************************************************************
   ******************** PUBLIC METHODS **************************************
   *************************************************************************/

  /*Starts monitoring*/
  this.start = function (monId) {
    // handler.closeSocket("ws_SPMONI"); //close SPMoni socket to start normal monitoring
    handler.send(get_question('START ', monId));
  };

  this.stop = function () {
    handler.send(get_command('STOP'));
    // handler.onMONI();
  };

  /*Starts SP monitoring*/
  this.startSPMonitoring = function (monId) {
    // handler.closeSocket("ws_MONI"); //close Moni socket to start mask monitoring
    // handler.send(new PAPI_newClientData(PAPI_data_type.CMD, 'MODE SP+MEASURE '));
    handler.send(get_question_scan('START GRPID=', monId));
  };

  this.stopSPMonitoring = function () {
    handler.send(get_command_scan('STOP'));
    // handler.onMONI();
  };

  this.getJSONStatic = function () {
    handler.send(new PAPI_newClientData(PAPI_data_type.CMD, '?JSON ', 'MONI STATIC'));
  };

  this.getFileList = function () {
    handler.send(get_question('FILES'));
  };

  this.getDefaultConfig = function (chSet) {
    handler.send(get_question('NEW CHSET=', chSet));
  };

  this.delete = function (monId) {
    handler.send(get_question('DELETE ', monId));
  };

  this.deleteSPMonitoring = function (grpId) {
    handler.send(get_question_scan('DELETE GRPID=', grpId));
  };

  this.exportMonitoring = function (monType, id) {
    if (monType != 'MON') {
      handler.send(get_question_scan('EXPORT CONFIG GRPID=', id + ' ZIP /tmp/WEB/'));
    } else {
      handler.send(get_question('EXPORT CONFIG ID=', id + ' ZIP /tmp/WEB/'));
    }
  };

  this.importMonitoring = function (monType) {
    if (monType != 'MON') {
      handler.send(get_question_scan('IMPORT ZIP /tmp/WEB/importMonitor.ZIP'));
    } else {
      handler.send(get_question('IMPORT ZIP /tmp/WEB/importMonitor.ZIP'));
    }
  };

  this.load = function (monId) {
    handler.send(get_question('LOAD ', monId));
  };

  this.saveNewMoni = function (name, desc) {
    var cmd = get_question('SAVE NAME=' + name);

    if (desc != undefined) {
      desc = desc.replace(/ +/g, '_'); //replace ' ' for '_'
      cmd.add_field(' DESC=', desc);
    }

    handler.send(cmd);
  };

  this.saveExistingMoni = function (monId, desc) {
    var cmd = get_question('SAVE ', monId);

    if (desc != undefined) {
      desc = desc.replace(/s+/g, '_'); //replace ' ' for '_'
      cmd.add_field(' DESC=', desc);
    }

    handler.send(cmd);
  };

  this.loadSPMonitoringGroup = function (groupId) {
    handler.send(get_question_scan('LOAD GRPID=', groupId));
  };

  this.updateSPMoniConfig = function (groupId) {
    handler.send(get_question_scan('UPDATE GRPID=', groupId));
  };

  this.newSPMonitoring = function (newSPMonitoringGroup) {
    handler.send(get_question_scan('NEW'));
  };

  this.newSPMoniEntry = function (input) {
    handler.send(get_question_scan('NEW ENTRY=', input.RFENTRY));
  };

  this.getInputReferences = function (inputID) {
    handler.send(get_question_scan('REFERENCE PREPARE ENTRY=', inputID));
  };

  this.disableInput = function (input) {
    handler.send(get_question_scan('DELETE ENTRY=', input.RFENTRY));
  };

  this.commitSPMonitoring = function () {
    handler.send(get_question_scan('COMMIT'));
  };

  this.getChannelsfromInput = function (inputId) {
    handler.send(get_question_scan('REFERENCE GET_CHANNELS ENTRY=', inputId));
  };

  this.getMasksFromInput = function (inputId) {
    handler.send(get_question_scan('REFERENCE GET_MASKS ENTRY=', inputId));
  };
}
