/*********************************************************************
*                     SEGGER Microcontroller GmbH                    *
*        Solutions for real time microcontroller applications        *
**********************************************************************
*                                                                    *
*        (c) 1996 - 2022  SEGGER Microcontroller GmbH                *
*                                                                    *
*        Internet: www.segger.com    Support:  support@segger.com    *
*                                                                    *
**********************************************************************
----------------------------------------------------------------------
File        : ID_SCREEN_BUC_CONTROL_Slots.c
Purpose     : AppWizard managed file, function content could be changed
---------------------------END-OF-HEADER------------------------------
*/

#include "Application.h"
#include "../Generated/Resource.h"
#include "../Generated/ID_SCREEN_BUC_CONTROL.h"
#include "../Generated/ID_SCREEN_BUC_CONTROL_UPDATE.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../utilities/fsl_debug_console.h"

/*** Begin of user code area ***/
/*** End of user code area ***/

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       cbID_SCREEN_BUC_CONTROL
*/
void cbID_SCREEN_BUC_CONTROL(WM_MESSAGE * pMsg) {
  GUI_USE_PARA(pMsg);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__APPW_NOTIFICATION_INITDIALOG__ID_TEXT_ATTENUATION_CTRL__APPW_JOB_SETTEXT
*/
void ID_SCREEN_BUC_CONTROL__APPW_NOTIFICATION_INITDIALOG__ID_TEXT_ATTENUATION_CTRL__APPW_JOB_SETTEXT(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__APPW_NOTIFICATION_MOTION
*/
void ID_SCREEN_BUC_CONTROL__APPW_NOTIFICATION_MOTION(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
////	if(Buc_ctrl_RF_attn_ctrl_save_flag==1)
////	{
//		//PRINTF("CONTROL gui_attenution_ctrl=%s",gui_attenution_ctrl);
//		APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, gui_attenution_ctrl);
////	}
//	if(Buc_ctrl_RF_attn_ctrl_save_flag==0)
//	{
//		if(strcmp(Backup_gui_attenution_ctrl,"")==0)
//		{
//						//PRINTF("\n NULL MATCHED");
//						strcpy(Backup_gui_attenution_ctrl,gui_Screen_Param_Default_number);
//						APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, "");
//						APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, Backup_gui_attenution_ctrl);
//		}
//		else
//		{
//							if(atoi(Backup_gui_attenution_ctrl)>=0 && atoi(Backup_gui_attenution_ctrl)<=31)
//							{
//								APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, Backup_gui_attenution_ctrl);
//							}
//
//		}
//	}
//  	//PRINTF("\n\r [UDP-APPW] gui_Ext_10MHz_Ref_Src=%s\tudp_Ext_10MHz_Ref_Src=%d",gui_Ext_10MHz_Ref_Src,udp_Ext_10MHz_Ref_Src);
//  	//PRINTF("\n\r [UDP-APPW] gui_RF_Mute_Ctrl=%s\tudp_RF_Mute_Ctrl=%d",gui_RF_Mute_Ctrl,udp_RF_Mute_Ctrl);
//		    if(Buc_ctrl_Ext_10MHz_Ref_Src_save_flag==0 || Parameter_UDP_Pkt_from_BUC_Received==1)
//			{
//				APPW_SetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_EXT_10MHZ_REF_SRC, udp_Ext_10MHz_Ref_Src);
//			}
//			if(Buc_ctrl_RF_Mute_save_flag==0 || Parameter_UDP_Pkt_from_BUC_Received==1)
//			{
//				APPW_SetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_BUC_CTRL_RF_MUTE, udp_RF_Mute_Ctrl);
//			}
  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__ID_BUTTON_BACK_BUC_CTRL__WM_NOTIFICATION_CLICKED
*/
void ID_SCREEN_BUC_CONTROL__ID_BUTTON_BACK_BUC_CTRL__WM_NOTIFICATION_CLICKED(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__ID_BUTTON_HOME_CONTROL__WM_NOTIFICATION_CLICKED
*/
void ID_SCREEN_BUC_CONTROL__ID_BUTTON_HOME_CONTROL__WM_NOTIFICATION_CLICKED(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__ID_BUTTON_ATTN_CTRL_UPDATE__WM_NOTIFICATION_CLICKED
*/
void ID_SCREEN_BUC_CONTROL__ID_BUTTON_ATTN_CTRL_UPDATE__WM_NOTIFICATION_CLICKED(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__ID_SLIDER_EXT_10MHZ_REF_SRC__WM_NOTIFICATION_VALUE_CHANGED__ID_SLIDER_EXT_10MHZ_REF_SRC__APPW_JOB_SETVALUE
*/
void ID_SCREEN_BUC_CONTROL__ID_SLIDER_EXT_10MHZ_REF_SRC__WM_NOTIFICATION_VALUE_CHANGED__ID_SLIDER_EXT_10MHZ_REF_SRC__APPW_JOB_SETVALUE(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
	Buc_ctrl_Ext_10MHz_Ref_Src_save_flag=1;
	Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter = APPW_GetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_EXT_10MHZ_REF_SRC, NULL);
	//PRINTF("\n\r APPWIZARD::Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter =%d",Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter);
		if(Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter==1)
		{
			Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter=0;
		}
		else if(Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter==0)
		{
			Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter=1;
		}
		else
		{
			;
		}
		//PRINTF("\n\r AFTER APPWIZARD::Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter =%d",Buc_ctrl_Ext_10MHz_Ref_Src_switch_value_counter);

  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__ID_SLIDER_BUC_CTRL_RF_MUTE__WM_NOTIFICATION_VALUE_CHANGED__ID_SLIDER_BUC_CTRL_RF_MUTE__APPW_JOB_SETVALUE
*/
void ID_SCREEN_BUC_CONTROL__ID_SLIDER_BUC_CTRL_RF_MUTE__WM_NOTIFICATION_VALUE_CHANGED__ID_SLIDER_BUC_CTRL_RF_MUTE__APPW_JOB_SETVALUE(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {

	Buc_ctrl_RF_Mute_save_flag=1;
	Buc_ctrl_RF_Mute_switch_value_counter = APPW_GetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_BUC_CTRL_RF_MUTE, NULL);
	//	Buc_ctrl_RF_Mute_switch_value_counter = APPW_GetValue(ID_SCREEN_BUC_CONTROL, ID_SWITCH_RF_MUTE, NULL);
	if(Buc_ctrl_RF_Mute_switch_value_counter==1)
	{
		Buc_ctrl_RF_Mute_switch_value_counter=0;
	}
	else if(Buc_ctrl_RF_Mute_switch_value_counter==0)
	{
		Buc_ctrl_RF_Mute_switch_value_counter=1;
	}
	else
	{
		;
	}
	//PRINTF("\n\r APPWIZARD::Buc_ctrl_RF_Mute_switch_value_counter =%d",Buc_ctrl_RF_Mute_switch_value_counter);
  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__ID_TEXT_ATTN_CTRL_DISP__WM_NOTIFICATION_TEXT_CHANGED__ID_TEXT_ATTN_CTRL_DISP__APPW_JOB_SETTEXT
*/
void ID_SCREEN_BUC_CONTROL__ID_TEXT_ATTN_CTRL_DISP__WM_NOTIFICATION_TEXT_CHANGED__ID_TEXT_ATTN_CTRL_DISP__APPW_JOB_SETTEXT(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {

  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*********************************************************************
*
*       ID_SCREEN_BUC_CONTROL__ID_BUTTON_REFRESH_CONTROL__WM_NOTIFICATION_CLICKED
*/
void ID_SCREEN_BUC_CONTROL__ID_BUTTON_REFRESH_CONTROL__WM_NOTIFICATION_CLICKED(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
//	if(Buc_ctrl_RF_attn_ctrl_save_flag==1)
//		{
			//PRINTF("CONTROL gui_attenution_ctrl=%s",gui_attenution_ctrl);
			APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, gui_attenution_ctrl);
		//}
		if(Buc_ctrl_RF_attn_ctrl_save_flag==0)
		{
			if(strcmp(gui_attenution_ctrl,"")==0)
			{
								//PRINTF("\n NULL MATCHED");
				strcpy(Backup_gui_attenution_ctrl,gui_Screen_Param_Default_number);
				APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, "");
				APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, Backup_gui_attenution_ctrl);
			}
			else
				APPW_SetText(ID_SCREEN_BUC_CONTROL, ID_TEXT_ATTN_CTRL_DISP, Backup_gui_attenution_ctrl);
		}
		APPW_SetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_EXT_10MHZ_REF_SRC, udp_Ext_10MHz_Ref_Src);
		APPW_SetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_BUC_CTRL_RF_MUTE, udp_RF_Mute_Ctrl);
//		if(Buc_ctrl_Ext_10MHz_Ref_Src_save_flag==0 || Parameter_UDP_Pkt_from_BUC_Received==1)
//		{
//			APPW_SetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_EXT_10MHZ_REF_SRC, udp_Ext_10MHz_Ref_Src);
//		}
//		if(Buc_ctrl_RF_Mute_save_flag==0 || Parameter_UDP_Pkt_from_BUC_Received==1)
//		{
//			APPW_SetValue(ID_SCREEN_BUC_CONTROL, ID_SLIDER_BUC_CTRL_RF_MUTE, udp_RF_Mute_Ctrl);
//		}
  GUI_USE_PARA(pAction);
  GUI_USE_PARA(hScreen);
  GUI_USE_PARA(pMsg);
  GUI_USE_PARA(pResult);
}

/*************************** End of file ****************************/
