/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: dialog_ctrl.cpp * Author: shjd * * Created on 2017年12月26日, 下午4:20 */ #include "dialog_ctrl.h" #include "gui_srv.h" extern gui_srv * w; dialog_ctrl *dlg_ctrl; typedef ST_RET(*ai_get_obj_dir_type)(AI_IED_CTRL*, AI_OBJ_ID, ST_BOOLEAN, AI_OBJ_ID **, ST_INT*); typedef AI_IED_CTRL * (*ac_get_srvm_ied_type)(ST_INT); typedef ST_RET(*ai_obj_id_to_ref_type)(AI_IED_CTRL *, AI_OBJ_ID, ST_CHAR *); typedef ST_RET(*ai_read_obj_primVals_type) (AI_OBJ_ID, AI_IED_CTRL*, AI_OBJ_VAL*); typedef ST_RET(*ai_prim_value_to_str_type)(AI_VAL_TYPE, ST_VOID *, ST_CHAR *); typedef ST_VOID(*ai_cleanup_objVals_type) (AI_OBJ_VAL *); extern ai_get_obj_dir_type ai_get_obj_dir_ad; extern ac_get_srvm_ied_type ac_get_srvm_ied_ad; extern ai_obj_id_to_ref_type ai_obj_id_to_ref_ad; extern ai_read_obj_primVals_type ai_read_obj_primVals_ad; extern ai_prim_value_to_str_type ai_prim_value_to_str_ad; extern ai_cleanup_objVals_type ai_cleanup_objVals_ad; dialog_ctrl::dialog_ctrl() { // ST_CHAR obj_name[MAX_IDENT_LEN + 1] = {0}; // ST_CHAR ctrval_ref[MAX_IDENT_LEN + 1] = {0}; // ST_INT srv_id; // AI_IED_CTRL *ied_ctrl; // ST_CHAR *strp; // AI_OBJ_ID ctlModel_id; // ST_RET ret; // AI_OBJ_VAL obj_val; // AI_OBJ_ID ctlval_id; // AI_OBJ_VAL ctlval_val; // ST_INT i; // char temp[MAX_REFERENCE_LENGTH + 1] = {0}; widget.setupUi(this); // widget.pB_op->setEnabled(false); // widget.pB_sel->setEnabled(false); // widget.pB_selv->setEnabled(false); // widget.pB_revoke->setEnabled(false); // widget.lb_opt->setText(""); // widget.lb_opinfo->setText(""); // widget.lE_ts->setText(""); // widget.lE_ms->setText(""); // widget.cB_ctrl->clear(); // ied_ctrl = ac_get_srvm_ied(srv_id); // ai_obj_id_to_ref(ied_ctrl, obj_id, obj_name); // ai_obj_id_to_ref(ied_ctrl, obj_id, ctrval_ref); // strp = strstr(obj_name, "$CO"); // if (strp == NULL) { // QMessageBox::warning(NULL, "warning", "读取控制对象属性失败!", QMessageBox::Yes); // return; // } // *(strp + 2) = 'F'; // strcat(obj_name, "$ctlModel"); // strcat(ctrval_ref, "$Oper$ctlVal"); // ctlModel_id = ai_obj_ref_to_id(ied_ctrl, obj_name); // ctlval_id = ai_obj_ref_to_id(ied_ctrl, ctrval_ref); // if (ctlModel_id == -1 || ctlval_id == -1) { // QMessageBox::warning(NULL, "warning", "读取控制对象属性失败!", QMessageBox::Yes); // return; // } // ret = ai_read_obj_primVals(ctlModel_id, ied_ctrl, &obj_val); // ret = ai_read_obj_primVals(ctlval_id, ied_ctrl, &ctlval_val); // ctlval_type = ctlval_val.prim_vals[0].type; // if (ctlval_type == VAL_TYPE_BOOLEAN) { // widget.cB_ctrl->insertItems(0, "true"); // widget.cB_ctrl->insertItems(1, "false"); // } else if (ctlval_type == VAL_TYPE_INT32) { // for (i = 0; i < 256; i++) { // m_ctrl_val.InsertString(i, itoa(i, temp, 10)); // } // } else if (ctlval_type == VAL_TYPE_CODEDENUM) { // widget.cB_ctrl->insertItems(0, "stop"); // widget.cB_ctrl->insertItems(1, "lower"); // widget.cB_ctrl->insertItems(2, "higher"); // widget.cB_ctrl->insertItems(3, "reserved"); // } else if (ctlval_type == VAL_TYPE_INT8) { // for (i = -64; i < 64; i++) { // m_ctrl_val.InsertString(i, itoa(i, temp, 10)); // } // } // ctlModel_val = *(ST_INT *) (obj_val.prim_vals[0].data); // ctlModel_val &= 0x000000ff; //XYS 2009-4-10 // if (ctlModel_val == 1 || ctlModel_val == 3) { // widget.pB_op->setEnabled(true); // } else if (ctlModel_val == 2) { // widget.pB_sel->setEnabled(true); // } else if (ctlModel_val == 4) { // widget.pB_selv->setEnabled(true); // } else { // QMessageBox::warning(NULL, "warning", "控制类型不对!", QMessageBox::Yes); // ai_cleanup_objVals(&obj_val); // ai_cleanup_objVals(&ctlval_val); // return; // } // ai_cleanup_objVals(&obj_val); // ai_cleanup_objVals(&ctlval_val); // // return; // return TRUE unless you set the focus to a control // // EXCEPTION: OCX Property Pages should return FALSE } void dialog_ctrl::SetIds(ST_INT srvid, AI_OBJ_ID objid) { srv_id = srvid; obj_id = objid; } void dialog_ctrl::on_pB_sel_clicked() { } void dialog_ctrl::on_pB_selv_clicked() { } void dialog_ctrl::on_pB_op_clicked() { } void dialog_ctrl::on_pB_revoke_clicked() { } void dialog_ctrl::on_pB_quit_clicked() { } dialog_ctrl::~dialog_ctrl() { }