void CCO2_View::Fresh() { CString temp_id; float m_fFirmwareVersion=0; UINT m_nSerialNumber=0; unsigned short m_nHardwareVersion=0; temp_id.Format(_T("%d"),product_register_value[6]); m_co2_idAdressEdit.SetWindowTextW(temp_id); if(product_register_value[CO2_485_MODBUS_BAUDRATE]>=0&&product_register_value[CO2_485_MODBUS_BAUDRATE]<=1) m_co2_braudRateCombox.SetCurSel(product_register_value[CO2_485_MODBUS_BAUDRATE]); else m_co2_braudRateCombox.SetCurSel(0); m_co2_braudRateCombox.EnableWindow(0); m_co2_firmwareversion=get_curtstat_version(); m_co2_serialNumber=get_serialnumber(); m_co2_hardwareversion=product_register_value[CO2_485_MODBUS_HARDWARE_REV];//8 m_co2_temp_unit.ResetContent(); m_co2_temp_unit.AddString(_T("℃")); m_co2_temp_unit.AddString(_T("℉")); Get_CO2_Temperature_unit(cs_temp_unit); m_co2_temp_unit.SetCurSel(product_register_value[103]); C02_SHOW_TEMP(); m_humidity_value = (float)(product_register_value[CO2_485_MODBUS_HUMIDITY_RH]/10); if(m_humidity_value>100) { (CEdit *)GetDlgItem(IDC_EDIT_CO2_HUMIDITY)->EnableWindow(FALSE); m_humidity_value = 0; } else { (CEdit *)GetDlgItem(IDC_EDIT_CO2_HUMIDITY)->EnableWindow(TRUE); } CO2_Alarm_Set(); //CO2_Grid_init(); //Initial_List(); Fresh_External_List(); if(product_register_value[CO2_485_MODBUS_PASSWORD_ENABLE] == 1) { ((CButton *)GetDlgItem(IDC_RADIO_PASSWORD_ENABLE))->SetCheck(1); ((CButton *)GetDlgItem(IDC_RADIO_PASSWORD_DISABLE))->SetCheck(0); (GetDlgItem(IDC_EDIT_CO2_PASSWOR)->EnableWindow(TRUE)); } else { ((CButton *)GetDlgItem(IDC_RADIO_PASSWORD_ENABLE))->SetCheck(0); ((CButton *)GetDlgItem(IDC_RADIO_PASSWORD_DISABLE))->SetCheck(1); (GetDlgItem(IDC_EDIT_CO2_PASSWOR)->EnableWindow(FALSE)); } if(product_register_value[CO2_485_MODBUS_HUM_SENSOR_HEATING] == 1) { ((CButton *)GetDlgItem(IDC_RADIO_HUMIDITY_HEAT_ENABLE))->SetCheck(1); ((CButton *)GetDlgItem(IDC_RADIO_HUMIDITY_HEAT_DISABLE))->SetCheck(0); } else { ((CButton *)GetDlgItem(IDC_RADIO_HUMIDITY_HEAT_ENABLE))->SetCheck(0); ((CButton *)GetDlgItem(IDC_RADIO_HUMIDITY_HEAT_DISABLE))->SetCheck(1); } int cyear,cmonth,cday,chour,cmin,csec; cyear = product_register_value[CO2_485_MODBUS_RTC_YEAR]; if(cyear<100) cyear = cyear + 2000; cmonth = product_register_value[CO2_485_MODBUS_RTC_MONTH]; if(cmonth>12 || cmonth<=0) cmonth = 1; cday = product_register_value[CO2_485_MODBUS_RTC_DAY]; if(cday > 31 || cday <=0) cday = 1; chour = product_register_value[CO2_485_MODBUS_RTC_HOUR]; if(chour>23 ) chour = 1; cmin = product_register_value[CO2_485_MODBUS_RTC_MIN]; if(cmin >59) cmin = 0; csec = product_register_value[CO2_485_MODBUS_RTC_SEC]; if(csec>59) csec = 0; CTime TimeTemp(cyear,cmonth,cday,chour,cmin,csec); m_co2_time_picker.SetFormat(_T("HH:mm")); m_co2_day_picker.SetTime(&TimeTemp); m_co2_time_picker.SetTime(&TimeTemp); Show_PassWord(); Show_Each_Edit_Time(); UpdateData(FALSE); }
void T3000_Default_MainView::Fresh(){ CString strTemp; strTemp.Format(_T("%d"),g_tstat_id); GetDlgItem(IDC_ID_EDIT)->SetWindowTextW(strTemp); strTemp.Format(_T("%d"),get_serialnumber()); GetDlgItem(IDC_SERIALNUM_EDIT)->SetWindowTextW(strTemp); m_brandrate_combox.ResetContent(); m_brandrate_combox.AddString(L"9600"); m_brandrate_combox.AddString(L"19200"); m_brandrate_combox.AddString(L"38400"); m_brandrate_combox.AddString(L"57600"); m_brandrate_combox.AddString(L"115200"); m_brandrate_combox.AddString(L"76800"); if((product_register_value[15] >= 0) && (product_register_value[15] <= 5)) m_brandrate_combox.SetCurSel(product_register_value[15]); m_mstpmodbus_combox.ResetContent(); m_mstpmodbus_combox.AddString(L"BACnet MSTP"); m_mstpmodbus_combox.AddString(L"Modbus"); if (product_register_value[7] == PM_TSTAT8|| (product_register_value[7] == PM_TSTAT8_WIFI) || (product_register_value[7] == PM_TSTAT8_OCC) || (product_register_value[7] == PM_TSTAT7_ARM) || (product_register_value[7] == PM_TSTAT8_220V)) { if (product_register_value[21] == 0) { m_mstpmodbus_combox.SetCurSel(1); } else { m_mstpmodbus_combox.SetCurSel(0); } unsigned int temp_device_id; temp_device_id = product_register_value[992] * 65536 + product_register_value[991]; CString cs_deviceid; cs_deviceid.Format(_T("%u"), temp_device_id); GetDlgItem(IDC_EDIT_BACNET_DEVICE_ID)->SetWindowTextW(cs_deviceid); if (product_register_value[4] >= 86) { GetDlgItem(IDC_EDIT_BACNET_DEVICE_ID)->EnableWindow(true); } else { GetDlgItem(IDC_EDIT_BACNET_DEVICE_ID)->EnableWindow(false); } } else { GetDlgItem(IDC_EDIT_BACNET_DEVICE_ID)->EnableWindow(false); if (product_register_value[21] == 0) { m_mstpmodbus_combox.SetCurSel(0); } else { m_mstpmodbus_combox.SetCurSel(1); } } strTemp.Format(_T("%d"), product_register_value[39]); m_Editor_macmstp.SetWindowTextW(strTemp); strTemp.Format(_T("%d"), product_register_value[38]); m_BipPort_Edit.SetWindowTextW(strTemp); strTemp.Format(_T("%0.1f"),get_curtstat_version()); GetDlgItem(IDC_FIRMWARV_EDIT)->SetWindowTextW(strTemp); strTemp.Format(_T("%d"),product_register_value[8]);//8 GetDlgItem(IDC_HARDWAREV_EDIT)->SetWindowTextW(strTemp); int nModel=product_register_value[7]; CString ProductName = GetProductName(nModel); if (nModel == PM_CS_RSM_AC||nModel == PM_CS_SM_AC) { if (product_register_value[11] == 0) { ProductName+=_T("-100A"); } else if (product_register_value[11]==1) { ProductName+=_T("-200A"); } else if (product_register_value[11]==2) { ProductName+=_T("-300A"); } } GetDlgItem(IDC_MODEL_EDIT)->SetWindowTextW(ProductName); strTemp.Format(_T("%d"),product_register_value[9]); GetDlgItem(IDC_PIC_EDIT)->SetWindowText(strTemp); GetDlgItem(IDC_BUTTON_WIFI_CONFIG)->ShowWindow(FALSE); MODBUS_BAUDRATE = 15; if ( product_register_value[7] == PM_T322AI || product_register_value[7] == PM_T38AI8AO6DO || product_register_value[7] == PM_T3PT12 || product_register_value[7] == PM_T36CTA || product_register_value[7] == PM_PWMETER ||product_register_value[7]==STM32_HUM_NET ) { GetDlgItem (IDC_STATIC_IPTIPS)->ShowWindow (TRUE); GetDlgItem (IDC_APPLYBUTTON)->ShowWindow (TRUE); GetDlgItem (IDC_STATIC_IPMODEL)->ShowWindow (TRUE); GetDlgItem (IDC_STATIC_IPADDRESS)->ShowWindow (TRUE); GetDlgItem (IDC_STATICSUBNETMASK)->ShowWindow (TRUE); GetDlgItem (IDC_STATICGATEWAYADDRESS)->ShowWindow (TRUE); GetDlgItem (IDC_STATIC_LISTENNINGPORT)->ShowWindow (TRUE); GetDlgItem (IDC_STATICMACADDRESS)->ShowWindow (TRUE); CString strtemp; int CO2_NET_MODBUS_MAC_ADDRESS_START = 40; strtemp.Format(_T("%02X-%02X-%02X-%02X-%02X-%02X"),product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START],product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START+1],product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START+2],product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START+3],product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START+4],product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START+5]); m_Edit_MacAddress.SetWindowText(strtemp); m_Edit_MacAddress.ShowWindow (TRUE); int CO2_NET_MODBUS_IP_MODE = 46; m_ip_model.SetCurSel(product_register_value[CO2_NET_MODBUS_IP_MODE]); m_ip_model.ShowWindow (TRUE); int CO2_NET_MODBUS_IP_ADDRESS_START = 47; m_ipaddress.SetAddress((BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START], (BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START+1], (BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START+2], (BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START+3]); int CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START = 51; m_ipaddress.ShowWindow (TRUE); m_Subnet_Mask.SetAddress((BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START], (BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START+1], (BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START+2], (BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START+3]); int CO2_NET_MODBUS_GATEWAY_ADDRESS_START = 55; m_Subnet_Mask.ShowWindow (TRUE); m_GatewayAddress.SetAddress((BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START], (BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START+1], (BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START+2], (BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START+3]); int CO2_NET_MODBUS_LISTEN_PORT_AT_TCP_SERVER_MODE_START = 60; m_GatewayAddress.ShowWindow (TRUE); strtemp.Format(_T("%d"),product_register_value[CO2_NET_MODBUS_LISTEN_PORT_AT_TCP_SERVER_MODE_START]); m_ListenPort.SetWindowText(strtemp); m_ListenPort.ShowWindow (TRUE); } else if ( product_register_value[7] == PM_TSTAT8_WIFI) { GetDlgItem(IDC_STATIC_IPTIPS)->ShowWindow(TRUE); GetDlgItem(IDC_APPLYBUTTON)->ShowWindow(TRUE); GetDlgItem(IDC_STATIC_IPMODEL)->ShowWindow(TRUE); GetDlgItem(IDC_STATIC_IPADDRESS)->ShowWindow(TRUE); GetDlgItem(IDC_STATICSUBNETMASK)->ShowWindow(TRUE); GetDlgItem(IDC_STATICGATEWAYADDRESS)->ShowWindow(TRUE); GetDlgItem(IDC_STATIC_LISTENNINGPORT)->ShowWindow(TRUE); GetDlgItem(IDC_STATICMACADDRESS)->ShowWindow(TRUE); GetDlgItem(IDC_BUTTON_WIFI_CONFIG)->ShowWindow(TRUE); GetDlgItem(IDC_STATIC_BIPPORT)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_BIPPORT)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_MAC_MSTP)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_MSTP_MAC)->ShowWindow(FALSE); CString strtemp; int CO2_NET_MODBUS_MAC_ADDRESS_START = 40; strtemp.Format(_T("%02X-%02X-%02X-%02X-%02X-%02X"), product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START], product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START + 1], product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START + 2], product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START + 3], product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START + 4], product_register_value[CO2_NET_MODBUS_MAC_ADDRESS_START + 5]); m_Edit_MacAddress.SetWindowText(strtemp); m_Edit_MacAddress.ShowWindow(TRUE); int CO2_NET_MODBUS_IP_MODE = 46; m_ip_model.SetCurSel(product_register_value[CO2_NET_MODBUS_IP_MODE]); m_ip_model.ShowWindow(TRUE); int CO2_NET_MODBUS_IP_ADDRESS_START = 47; m_ipaddress.SetAddress((BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START], (BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START + 1], (BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START + 2], (BYTE)product_register_value[CO2_NET_MODBUS_IP_ADDRESS_START + 3]); int CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START = 51; m_ipaddress.ShowWindow(TRUE); m_Subnet_Mask.SetAddress((BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START], (BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START + 1], (BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START + 2], (BYTE)product_register_value[CO2_NET_MODBUS_SUBNET_MASK_ADDRESS_START + 3]); int CO2_NET_MODBUS_GATEWAY_ADDRESS_START = 55; m_Subnet_Mask.ShowWindow(TRUE); m_GatewayAddress.SetAddress((BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START], (BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START + 1], (BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START + 2], (BYTE)product_register_value[CO2_NET_MODBUS_GATEWAY_ADDRESS_START + 3]); int CO2_NET_MODBUS_LISTEN_PORT_AT_TCP_SERVER_MODE_START = 60; m_GatewayAddress.ShowWindow(TRUE); strtemp.Format(_T("%d"), product_register_value[CO2_NET_MODBUS_LISTEN_PORT_AT_TCP_SERVER_MODE_START]); m_ListenPort.SetWindowText(strtemp); m_ListenPort.ShowWindow(TRUE); } else if(product_register_value[7] == PWM_TRANSDUCER) { GetDlgItem(IDC_STATIC_IPTIPS)->ShowWindow(FALSE); GetDlgItem(IDC_APPLYBUTTON)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_IPMODEL)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_IPADDRESS)->ShowWindow(FALSE); GetDlgItem(IDC_STATICSUBNETMASK)->ShowWindow(FALSE); GetDlgItem(IDC_STATICGATEWAYADDRESS)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_LISTENNINGPORT)->ShowWindow(FALSE); GetDlgItem(IDC_STATICMACADDRESS)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_BIPPORT)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_MAC_MSTP)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_MSTP_MODBUS)->ShowWindow(FALSE); m_Edit_MacAddress.ShowWindow(FALSE); m_ip_model.ShowWindow(FALSE); m_ipaddress.ShowWindow(FALSE); m_Subnet_Mask.ShowWindow(FALSE); m_GatewayAddress.ShowWindow(FALSE); m_ListenPort.ShowWindow(FALSE); m_Editor_macmstp.ShowWindow(FALSE); m_mstpmodbus_combox.ShowWindow(FALSE); m_BipPort_Edit.ShowWindow(FALSE); } else { GetDlgItem (IDC_STATIC_IPTIPS)->ShowWindow (FALSE); GetDlgItem (IDC_APPLYBUTTON)->ShowWindow (FALSE); GetDlgItem (IDC_STATIC_IPMODEL)->ShowWindow (FALSE); GetDlgItem (IDC_STATIC_IPADDRESS)->ShowWindow (FALSE); GetDlgItem (IDC_STATICSUBNETMASK)->ShowWindow (FALSE); GetDlgItem (IDC_STATICGATEWAYADDRESS)->ShowWindow (FALSE); GetDlgItem (IDC_STATIC_LISTENNINGPORT)->ShowWindow (FALSE); GetDlgItem (IDC_STATICMACADDRESS)->ShowWindow (FALSE); GetDlgItem (IDC_STATIC_AEC_ENCRYPT)->ShowWindow(FALSE); GetDlgItem (IDC_EDIT_AES_ENCRYPT)->ShowWindow(FALSE); GetDlgItem (IDC_CHECK_PASSWORD)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_ACE)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_BIPPORT)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_BIPPORT)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_MAC_MSTP)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_MSTP_MAC)->ShowWindow(FALSE); m_Edit_MacAddress.ShowWindow (FALSE); m_ip_model.ShowWindow (FALSE); m_ipaddress.ShowWindow (FALSE); m_Subnet_Mask.ShowWindow (FALSE); m_GatewayAddress.ShowWindow (FALSE); m_ListenPort.ShowWindow (FALSE); GetDlgItem(IDC_STATIC_NETWORKID)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_NETWORKID2)->ShowWindow(FALSE); GetDlgItem(IDC_STATIC_NETWORKID3)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_NETWORKID)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_NODEID)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_FREID)->ShowWindow(FALSE); } if (product_register_value[7] == PM_TSTAT5i || product_register_value[7] == PM_TSTAT6 || product_register_value[7] == PM_TSTAT7 || product_register_value[7] == PM_TSTAT8 || (product_register_value[7] == PM_TSTAT8_WIFI) || (product_register_value[7] == PM_TSTAT8_OCC) || (product_register_value[7] == PM_TSTAT7_ARM) || (product_register_value[7] == PM_TSTAT8_220V) ) { bitset<16> value109(product_register_value[109]); int sel = value109[4];//第五位 m_combox_mrd.SetCurSel(sel); } else { bitset<16> value184(product_register_value[184]); int sel = value184[4];//第五位 m_combox_mrd.SetCurSel(sel); } Read_Multi(g_tstat_id, &product_register_value[599], 599, 100); if (product_register_value[599] == 0) { m_Edit_AESPassword.EnableWindow(FALSE); GetDlgItem(IDC_CHECK_PASSWORD)->EnableWindow(FALSE); } else { m_Edit_AESPassword.EnableWindow(TRUE); m_Edit_AESPassword.SetWindowTextW(GetTextFromReg(600)+ GetTextFromReg(604)); //m_Edit_AESPassword.SetPasswordChar('*'); ((CButton *)GetDlgItem(IDC_CHECK_PASSWORD))->SetCheck(1); } strTemp.Format(_T("%d"), (int)product_register_value[608]); m_Edit_Network.SetWindowTextW(strTemp); strTemp.Format(_T("%d"), (int)product_register_value[609]); m_Edit_NodeID.SetWindowTextW(strTemp); long long Freq = ((long long)product_register_value[610]) * 65536 + ((long long)product_register_value[611]); strTemp.Format(_T("%ld HZ"), Freq); m_Edit_FrequenceID.SetWindowTextW(strTemp); if (PM_T36CTA == product_register_value[7]) { m_Edit_FrequenceID.ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_AEC_ENCRYPT)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_AES_ENCRYPT)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_NETWORKID)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_NETWORKID2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_NETWORKID3)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_NETWORKID)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_NODEID)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_FREID)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_ACE)->ShowWindow(SW_SHOW); } else { m_Edit_FrequenceID.ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_AEC_ENCRYPT)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_AES_ENCRYPT)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_NETWORKID)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_NETWORKID2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_NETWORKID3)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_NETWORKID)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_NODEID)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_FREID)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_ACE)->ShowWindow(SW_HIDE); } switch_product_last_view(); }