Exemplo n.º 1
0
// CBacnetVariable message handlers
LRESULT  CBacnetVariable::VariableMessageCallBack(WPARAM wParam, LPARAM lParam)
{
	_MessageInvokeIDInfo *pInvoke =(_MessageInvokeIDInfo *)lParam;
	bool msg_result=WRITE_FAIL;
	msg_result = MKBOOL(wParam);
	CString Show_Results;
	CString temp_cs = pInvoke->task_info;
	if(msg_result)
	{
		Show_Results = temp_cs + _T("Success!");
		SetPaneString(BAC_SHOW_MISSION_RESULTS,Show_Results);
		if((pInvoke->mRow < BAC_VARIABLE_ITEM_COUNT) && (pInvoke->mRow >= 0))
		{
			Post_Refresh_One_Message(g_bac_instance,READVARIABLE_T3000,
				pInvoke->mRow,pInvoke->mRow,sizeof(Str_variable_point));
			SetTimer(3,2000,NULL);
		}
	}
	else
	{
		memcpy_s(&m_Variable_data.at(pInvoke->mRow),sizeof(Str_variable_point),&m_temp_variable_data[pInvoke->mRow],sizeof(Str_variable_point));//还原没有改对的值
		PostMessage(WM_REFRESH_BAC_VARIABLE_LIST,pInvoke->mRow,REFRESH_ON_ITEM);
		Show_Results = temp_cs + _T("Fail!");
		SetPaneString(BAC_SHOW_MISSION_RESULTS,Show_Results);
	}
	if((pInvoke->mRow%2)==0)	//恢复前景和 背景 颜色;
		m_variable_list.SetItemBkColor(pInvoke->mRow,pInvoke->mCol,LIST_ITEM_DEFAULT_BKCOLOR,0);
	else
		m_variable_list.SetItemBkColor(pInvoke->mRow,pInvoke->mCol,LIST_ITEM_DEFAULT_BKCOLOR_GRAY,0);
	m_variable_list.RedrawItems(pInvoke->mRow,pInvoke->mRow);

	if(pInvoke)
		delete pInvoke;
	return 0;
}
void CGraphicView::OnTimer(UINT_PTR nIDEvent)
{
    // TODO: Add your message handler code here and/or call default
    switch(nIDEvent)
    {
    case 1:
        if(bac_cm5_graphic == true)	//如果是CM5 的Bacnet的协议 ;原来TSTAT的 处理方法和过程不要动;
        {
            for (int i=0; i<(int)m_graphic_refresh_data.size(); i++)
            {
                Post_Refresh_One_Message(m_graphic_refresh_data.at(i).deviceid,
                                         m_graphic_refresh_data.at(i).command,
                                         m_graphic_refresh_data.at(i).value_item,
                                         m_graphic_refresh_data.at(i).value_item,
                                         m_graphic_refresh_data.at(i).entitysize);
                CString temp;
                //	static int test_value;
#if 0
                if(m_graphic_refresh_data.at(i).value_type == 0)
                {
                    //	test_value ++;
                    //	temp.Format(_T("%d"),test_value);
                    temp.Format(_T("%d"),m_Input_data.at(m_graphic_refresh_data.at(i).value_item).value);
                }
                else if(m_graphic_refresh_data.at(i).value_type == 1)
                {
                    //test_value ++;
                    //	test_value ++;
                    //	temp.Format(_T("%d"),test_value);
                    temp.Format(_T("%d"),m_Output_data.at(m_graphic_refresh_data.at(i).value_item).value);
                }
                else if(m_graphic_refresh_data.at(i).value_type == 2)
                {
                    //	test_value ++;
                    //	test_value ++;
                    //	test_value ++;
                    //	temp.Format(_T("%d"),test_value);
                    temp.Format(_T("%d"),m_Variable_data.at(m_graphic_refresh_data.at(i).value_item).value);
                }

                m_graphic_refresh_data.at(i).control_pt->m_strValueText = temp;	//在Label上 设置显示的 值;
#endif
                m_graphic_refresh_data.at(i).control_pt->Invalidate();
                //	m_graphic_refresh_data.at(i).control_pt->i
            }

        }
        break;
    }
    CFormView::OnTimer(nIDEvent);
}