/**
  * @brief  Callback function of the Settings dialog
  * @param  pMsg: pointer to a data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialogSettings(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode, idx;
  static int8_t sec, min, hour;
  static int8_t asec, amin, ahour;
  static int8_t day, month, max_days;
  static int16_t  year;
  SPINBOX_Handle   hSpin;
  DROPDOWN_Handle  hDropMonth; 
  TEXT_Handle     hText  ;
  static  CALENDAR_DATE   current_date;
  RTC_TimeTypeDef   RTC_TimeStructure;
  RTC_DateTypeDef   RTC_DateStructure;
  static uint8_t TempStr[50];  
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    /* Get Clock setting from RTC */
    RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure);
    
    sec    =  RTC_TimeStructure.RTC_Seconds;
    min    =  RTC_TimeStructure.RTC_Minutes;
    hour   =  RTC_TimeStructure.RTC_Hours;
    
    RTC_GetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
    
    asec  = RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds;
    amin  = RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes;
    ahour = RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours;
    
    RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure);
    
    year =  RTC_DateStructure.RTC_Year + 2000;
    month =  RTC_DateStructure.RTC_Month;
    day =  RTC_DateStructure.RTC_Date;
    
    max_days = GetMaxDays(month, year);
    
    /* Update the dialog items */
    hItem = pMsg->hWin;
    FRAMEWIN_SetFont(hItem, GUI_FONT_13B_ASCII);
    
    /* Date */
    
    hText = TEXT_CreateEx(20, 20, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x11F," Date : ");
    TEXT_SetFont(hText, GUI_FONT_13B_ASCII);
    TEXT_SetTextColor(hText, 0x00804000);
    
    hSpin = SPINBOX_CreateEx(20, 35, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_DAY, 1, max_days);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);
    SPINBOX_EnableBlink(hSpin, 250, 1);
      
      
    SPINBOX_SetValue(hSpin, day);
    
    hDropMonth = DROPDOWN_CreateEx(65, 35, 80, 160, pMsg->hWin, WM_CF_SHOW, 0,  ID_CLOCK_MONTH);
    DROPDOWN_SetFont(hDropMonth, GUI_FONT_13B_ASCII);
    DROPDOWN_SetTextColor(hDropMonth, DROPDOWN_CI_UNSEL, 0x00804000);
    DROPDOWN_SetTextColor(hDropMonth, DROPDOWN_CI_SEL, 0x00804000);    
    
    for (idx = 0; idx < 12; idx++ )
    {
      DROPDOWN_AddString (hDropMonth, (char *)strMonth[idx]);
    }
    
    DROPDOWN_SetSel(hDropMonth, month - 1);
    
    hSpin = SPINBOX_CreateEx(150, 35, 50, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_YEAR, 2000, 2099);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_EnableBlink(hSpin, 250, 1);
    SPINBOX_SetValue(hSpin, year);
    
    hItem = CHECKBOX_Create(205, 37, 20, 26, pMsg->hWin, ID_CLOCK_CHECK_DATE ,WM_CF_SHOW);
    CHECKBOX_SetState(hItem, 1);
    
    /* Time */
    
    hText = TEXT_CreateEx(20, 50 + 20, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x123," Time : ");
    TEXT_SetFont(hText, GUI_FONT_13B_ASCII);
    TEXT_SetTextColor(hText, 0x00804000);    
    
    hSpin = SPINBOX_CreateEx(20, 65 + 20, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_HOUR, 0,23);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);      
    SPINBOX_SetValue(hSpin, hour);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    hSpin = SPINBOX_CreateEx(75, 65 + 20, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_MIN, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);  
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, min);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    hSpin = SPINBOX_CreateEx(130, 65 + 20, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_SEC, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);  
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, sec);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    
    hItem = CHECKBOX_Create(205, 65 + 20, 20, 26, pMsg->hWin, ID_CLOCK_CHECK_TIME ,WM_CF_SHOW);
    CHECKBOX_SetState(hItem, 1);
    
    /* Alarm */
    
    hText = TEXT_CreateEx(20, 78 + 40, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x126," Alarm : ");
    TEXT_SetFont(hText, GUI_FONT_13B_ASCII);
    TEXT_SetTextColor(hText, 0x00804000);    
    
    hSpin = SPINBOX_CreateEx(20, 93 + 40, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_AHOUR, 0,23);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);      
    SPINBOX_SetValue(hSpin, ahour);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    
    hSpin = SPINBOX_CreateEx(75, 93 + 40, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_AMIN, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII); 
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, amin);
    SPINBOX_EnableBlink(hSpin, 250, 1);
        
    hSpin = SPINBOX_CreateEx(130, 93 + 40, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_ASEC, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);  
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, asec);
    hItem = CHECKBOX_Create(205, 93 + 40, 20, 26, pMsg->hWin, ID_CLOCK_CHECK_ALARM ,WM_CF_SHOW);
    CHECKBOX_SetState(hItem, 1);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
      
    case ID_CLOSE_SETTINGS: /* Notifications sent by 'Close' */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        /* Exit */
        GUI_EndDialog(pMsg->hWin, 0);
        GUI_EndDialog (hNumPad, 0);
        break;
      }
      break;
    case ID_SET_SETTINGS: /* Notifications sent by 'Apply' */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        
        if(CHECKBOX_GetState( WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CLOCK_CHECK_DATE)))
        { 
          current_date.Year = year =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_YEAR));
          current_date.Month = month = DROPDOWN_GetSel (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_MONTH)) + 1;
          current_date.Day = day =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_DAY)); 
          
          
          RTC_DateStructure.RTC_Year  = year - 2000;
          RTC_DateStructure.RTC_Month = month;
          RTC_DateStructure.RTC_Date  = day;
          RTC_DateStructure.RTC_WeekDay = 0;
          RTC_SetDate(RTC_Format_BIN, &RTC_DateStructure);
          
          hItem = WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CALENDAR);
          CALENDAR_SetDate(hItem, &current_date);
          CALENDAR_SetSel(hItem, &current_date);
          
          /* Date */
          hItem = WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_TEXT_DATE);    
          sprintf((char *)TempStr, "%02d, %s, %04d",day , strMonth[month-1], year);
          TEXT_SetText(hItem, (char *)TempStr);
        }
        
        if(CHECKBOX_GetState( WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CLOCK_CHECK_TIME)))
        {
          /* Save new param in RTC */
          sec    =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_SEC));
          min    =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_MIN));
          hour   =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_HOUR));
          
          RTC_TimeStructure.RTC_Seconds = sec;
          RTC_TimeStructure.RTC_Minutes = min;
          RTC_TimeStructure.RTC_Hours   = hour;
          RTC_SetTime(RTC_Format_BIN, &RTC_TimeStructure);
        }
        
        if(CHECKBOX_GetState( WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CLOCK_CHECK_ALARM)))
        {
          asec  = SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_ASEC));
          amin  = SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_AMIN));
          ahour = SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_AHOUR));
          
          /* Disable the Alarm A */
          RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
          
          /* Disable the RTC Alarm A Interrupt */
          RTC_ITConfig(RTC_IT_ALRA, DISABLE);
          
          STM_EVAL_LEDOff(LED4);
          
          RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = asec;
          RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = amin;
          RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = ahour;
          RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
          RTC_AlarmStructure.RTC_AlarmDateWeekDay = day;
          RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
          
          /* Enable the RTC Alarm A Interrupt */
          RTC_ITConfig(RTC_IT_ALRA, ENABLE);
          
          /* Enable the alarm  A */
          RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
          
          alarm_set = 1;
        }
        
        /* Exit */
        WM_InvalidateWindow(WM_GetParent(pMsg->hWin));
        GUI_EndDialog(pMsg->hWin, 0);
        GUI_EndDialog (hNumPad, 0);
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
/**
  * @brief  Callback function of the settings frame
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbSettingsDialog(WM_MESSAGE * pMsg)
{
  int     Id, NCode;
  WM_HWIN hItem;
  uint32_t tmp_param = 0;


  switch (pMsg->MsgId)
  {
  case WM_INIT_DIALOG:

    WM_MakeModal(pMsg->hWin);
    /* Settings frame initialization */
    hItem = pMsg->hWin;
    FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0);

    /* Create and attache the MULTIPAGE dialog windows */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE);

    /* 'OK' button initialization */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK);
    BUTTON_SetFont(hItem, GUI_FONT_13B_1);

    /* 'Cancel' button initialization */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL);
    BUTTON_SetFont(hItem, GUI_FONT_13B_1);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetFont(hItem, GUI_FONT_13B_1);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_0);

    SPINBOX_SetRange(hItem, 1, 10);

    if(ImSettings.b.ss_timer > 0)
    {
       SPINBOX_SetValue(hItem, ImSettings.b.ss_timer);
    }
    else
    {
      ImSettings.b.ss_timer = 1;
      SPINBOX_SetValue(hItem, 1);
    }

    break;

  case WM_NOTIFY_PARENT:
    Id = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;

    switch (Id)
    {
    /* Notification sent by "OK" button */
    case ID_BUTTON_OK:
      switch (NCode) {

      case WM_NOTIFICATION_RELEASED:

        /* Save image settings before delete settings frame */
        hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_0);
        ImSettings.b.ss_timer = SPINBOX_GetValue(hItem);

        WM_RestartTimer(hTimerTime, (ImSettings.b.ss_timer * 1000));

        tmp_param = k_BkupRestoreParameter(CALIBRATION_IMAGE_SETTINGS_BKP);

        /* check if new settings have to be saved */
        if(ImSettings.d32 != tmp_param)
        {
          k_BkupSaveParameter(CALIBRATION_IMAGE_SETTINGS_BKP, ImSettings.d32);
        }

        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break;
    /* Notification sent by "Cancel" button */
    case ID_BUTTON_CANCEL:
      switch (NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break;
    }
    break;

  }
}
Пример #3
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
	
	int i;
	
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'SensorsControl'
    //
    hItem = pMsg->hWin;
    FRAMEWIN_SetText(hItem, "Sensors Control");
    //
    // Initialization of 'exit_button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText(hItem, " X");
    //
    // Initialization of 'refresh_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetText(hItem, "delay of refresh:");
    //
    // Initialization of 'temperature_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "");
    //
    // Initialization of 'temp_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetText(hItem, "teperature:");
    //
    // Initialization of 'hum_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
    TEXT_SetText(hItem, "humidity:");
    //
    // Initialization of 'humidity_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
    EDIT_SetText(hItem, "");
    //
    // Initialization of 'sound_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
    TEXT_SetText(hItem, "sound:");
    //
    // Initialization of 'sound_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2);
    EDIT_SetText(hItem, "SILENCE");
    //
    // Initialization of 'distance_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4);
    TEXT_SetText(hItem, "distance:");
    //
    // Initialization of 'distance_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_3);
    EDIT_SetText(hItem, "FAR");
    //
    // Initialization of 'pres_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
    TEXT_SetText(hItem, "presence:");
    //
    // Initialization of 'presence_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_4);
    EDIT_SetText(hItem, "NO");
    //
    // Initialization of 'vibro_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_6);
    TEXT_SetText(hItem, "vibration:");
    //
    // Initialization of 'vibration_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_5);
    EDIT_SetText(hItem, "NO");
    //
    // Initialization of 'light_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_7);
    TEXT_SetText(hItem, "light:");
    //
    // Initialization of 'light_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_6);
    EDIT_SetText(hItem, "NO");
    //
    // Initialization of 'light_check'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
    CHECKBOX_SetText(hItem, "turn on all leds when there is no light in the area");
    //
    // Initialization of 'alarm_check'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
    CHECKBOX_SetText(hItem, "activate alarm on presence");
    //
    // Initialization of 'temp_check'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2);
    CHECKBOX_SetText(hItem, "activate alarm on temperature");
    //
    // Initialization of 'max_temp_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_8);
    TEXT_SetText(hItem, "max temperature:");
    // USER START (Optionally insert additional code for further widget initialization)

			actual_hWin = pMsg->hWin;
			UEZSemaphoreRelease(semaphore_actual_hWin);

		// USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'exit_button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
			  PlayAudio(600, 20);				
        PlayAudio(600, 20);				
        PlayAudio(200, 20);				
 
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)

				PlayAudio(900, 20);				
        PlayAudio(1000, 20);				
        PlayAudio(1100, 20);				

				check_sensors.alarm = 0;
				check_sensors.light = 0;
				check_sensors.temperature = 0;

				BS_wrapper(EXIT_CONTROLLER, INTERNAL, &pMsg);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SLIDER_0: // Notifications sent by 'refresh_slider'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
			
				hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0 );
				delay_from_slider = 10 + (SLIDER_GetValue(hItem) * 2);
				BS_wrapper(CHANGE_DELAY_QUERY_FROM_WINDOW, EXTERNAL, &delay_from_slider);
			
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_0: // Notifications sent by 'temperature_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_1: // Notifications sent by 'humidity_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_2: // Notifications sent by 'sound_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_3: // Notifications sent by 'distance_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_4: // Notifications sent by 'presence_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_5: // Notifications sent by 'vibration_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_6: // Notifications sent by 'light_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_0: // Notifications sent by 'light_check'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
			
					hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0 );
					check_sensors.light = CHECKBOX_GetState(hItem);
					BS_wrapper(NOTIFY_NO_LIGHT_SENSOR_CHANGED_FROM_WINDOW, EXTERNAL, NULL);
			
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_1: // Notifications sent by 'alarm_check'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

				hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1 );
				check_sensors.alarm = CHECKBOX_GetState(hItem);
				BS_wrapper(NOTIFY_ALARM_PRESENCE_SENSOR_CHANGED_FROM_WINDOW, EXTERNAL, NULL);

			// USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_2: // Notifications sent by 'temp_check'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

				hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2 );
				check_sensors.temperature = CHECKBOX_GetState(hItem);
				BS_wrapper(NOTIFY_ALARM_TEMPERATURE_SENSOR_CHANGED_FROM_WINDOW, EXTERNAL, NULL);

			// USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SPINBOX_0: // Notifications sent by 'Spinbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
			
				hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_0 );
				temperature_limit = SPINBOX_GetValue(hItem);
				BS_wrapper(NOTIFY_MAX_TEMPERATURE_THRESHOLD_FROM_WINDOW, EXTERNAL, &temperature_limit);
			
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
		
	case MB_MSG_SENSOR:

		//GESTISCO L'AGGIORNAMENTO DEI LABEL DEI SENSORI
	
		/** 
	i sensori sono stati mappati così:
	
	*(usRegHoldingBuf     ) = (USHORT *) &sensors.distance1;
	*(usRegHoldingBuf + 1 ) = (USHORT *) &sensors.distance2;
	*(usRegHoldingBuf + 2 ) = (USHORT *) &sensors.lumino;
	*(usRegHoldingBuf + 3 ) = (USHORT *) &sensors.mic;
	*(usRegHoldingBuf + 4 ) = (USHORT *) &sensors.vibro;
	*(usRegHoldingBuf + 5 ) = (USHORT *) &actual_DHT11.humidity;
	*(usRegHoldingBuf + 6 ) = (USHORT *) &actual_DHT11.temperature;

	
  "temperature_edit", ID_EDIT_0
  "humidity_edit", ID_EDIT_1
  "sound_edit", ID_EDIT_2
  "distance_edit", ID_EDIT_3
  "presence_edit", ID_EDIT_4
  "vibration_edit", ID_EDIT_5
  "light_edit", ID_EDIT_6

			*/
	
		//estrazione della temperatura
		
		
	break;
	
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
  int i;
  int j;
  int k;
  int slave_column;
  char buffer[10];

  new_GUI_value.BUTTON_value.send_button= FALSE;
  
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'id_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetText(hItem, "slave id:");
    //
    // Initialization of 'function_radio'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO_0);
    RADIO_SetText(hItem, "read holding registers", 0);
    RADIO_SetText(hItem, "write single register", 1);
    RADIO_SetText(hItem, "read single coil", 2);
    RADIO_SetText(hItem, "write single coil", 3);
    RADIO_SetText(hItem, "read multiple coils", 4);
    //
    // Initialization of 'multiple_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetText(hItem, "MULTIPLE REGISTER REQUEST");
    //
    // Initialization of 'from_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
    TEXT_SetText(hItem, "from:");
    //
    // Initialization of 'to_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
    TEXT_SetText(hItem, "to:");
    //
    // Initialization of 'single_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4);
    TEXT_SetText(hItem, "SINGLE REGISTER REQUEST");
    //
    // Initialization of 'number_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
    TEXT_SetText(hItem, "number:");
    //
    // Initialization of 'send_button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText(hItem, "SEND");
    //
    // Initialization of 'response_view'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0);
    LISTVIEW_AddColumn(hItem, 60, "address", GUI_TA_HCENTER | GUI_TA_VCENTER);
    LISTVIEW_AddColumn(hItem, 80, "slave 1", GUI_TA_HCENTER | GUI_TA_VCENTER);
    LISTVIEW_AddColumn(hItem, 80, "slave 2", GUI_TA_HCENTER | GUI_TA_VCENTER);
    LISTVIEW_AddRow(hItem, NULL);
    LISTVIEW_SetGridVis(hItem, 1);
    LISTVIEW_AddColumn(hItem, 30, "Col", GUI_TA_LEFT | GUI_TA_VCENTER);
    LISTVIEW_SetAutoScrollV(hItem, 1);
    //
    // Initialization of 'status_view'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_1);
    LISTVIEW_AddColumn(hItem, 129, "status", GUI_TA_HCENTER | GUI_TA_VCENTER);
    LISTVIEW_SetGridVis(hItem, 1);
    LISTVIEW_SetItemText(hItem, 0, 0, "0");
    LISTVIEW_SetItemText(hItem, 0, 0, "0");
    LISTVIEW_SetRowHeight(hItem, 20);
    LISTVIEW_SetHeaderHeight(hItem, 20);
    //
    // Initialization of 'exit_button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
    BUTTON_SetText(hItem, " X");
    //
    // Initialization of 'write_req_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_6);
    TEXT_SetText(hItem, "WRITE REGISTER REQUEST");
    //
    // Initialization of 'value_txt'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_7);
    TEXT_SetText(hItem, "value:");
    // USER START (Optionally insert additional code for further widget initialization)

    //aggiungo casella Status
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_1);
    LISTVIEW_AddRow(hItem, NULL);
    LISTVIEW_SetItemText(hItem, 0, 0, "Ready");

    //aggiungo caselle di risposta
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0);
    for (i = 0; i < 60; i++)
       LISTVIEW_AddRow(hItem, NULL);


    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_RADIO_0: // Notifications sent by 'function_radio'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

          hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO_0);
          new_GUI_value.RADIO_value.radio_selection = RADIO_GetValue(pMsg->hWinSrc);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_0: // Notifications sent by 'send_button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(600, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)

        modbus_task();

        hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_1);

        if (modbus_rx.error != 0)
        {
					GUI_Delay(100);
					modbus_task();
				}
				
				hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_1);
					
				if (modbus_rx.error != 0)
				{

					LISTVIEW_SetItemBkColor(hItem, 0,0,0, GUI_RED);
					GUI_Delay(100);
					LISTVIEW_SetItemText(hItem, 0, 0, "No Response");
					PlayAudio(50, 60);				
					PlayAudio(0, 20);				
					PlayAudio(50, 100);				
				}
					
				 else if (modbus_rx.func & 0x80)
				{
					LISTVIEW_SetItemBkColor(hItem, 0,0,0, GUI_YELLOW);
					GUI_Delay(100);
					LISTVIEW_SetItemText(hItem, 0, 0, "R: Wrong Message");
					PlayAudio(90, 60);				
					PlayAudio(90, 20);				
					PlayAudio(90, 100);				

				}

				else
				{
					//cancello vecchi valori
					hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0);
					LISTVIEW_DeleteAllRows(hItem);
					GUI_Delay(100);
					for (i = 0; i < 60; i++)
						LISTVIEW_AddRow(hItem, NULL);
					GUI_Delay(100);
					
					hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_1);

					LISTVIEW_SetItemBkColor(hItem, 0,0,0, GUI_GREEN);
					GUI_Delay(100);
					LISTVIEW_SetItemText(hItem, 0, 0, "R: Message Accepted");
					PlayAudio(600, 20);				
					PlayAudio(600, 20);				
					PlayAudio(200, 20);
					
					
					//se ho fatto una richiesta read
					if(new_GUI_value.RADIO_value.radio_selection == 0 || new_GUI_value.RADIO_value.radio_selection == 2 || new_GUI_value.RADIO_value.radio_selection == 4)
					{
						if(new_GUI_value.SPINBOX_value.slave_id == 1)
							slave_column = 1;
						else
							slave_column = 2;

						//scrivo sul listview 0
						hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0);

						
						//mi prendo la sezione dati effettivi

						//ho chiesto gli holding?
						if(new_GUI_value.RADIO_value.radio_selection == 0){
							for(i = 0; i < modbus_rx.len; i++)
							{
								//se leggo holdings
								sprintf(buffer, "%d", new_GUI_value.SPINBOX_value.multiple_register_from + i +2000);
								
								LISTVIEW_SetItemText(hItem, 0, i, buffer);
				
								sprintf(buffer, "%d", modbus_rx.data_converted[i]);
								LISTVIEW_SetItemText(hItem, slave_column, i, buffer);

							}
						}							


						//ho chiesto i coils?
						else if(new_GUI_value.RADIO_value.radio_selection == 4 ){
							for(i = 0; i < modbus_rx.len; i++)
							{
								sprintf(buffer, "%d", new_GUI_value.SPINBOX_value.multiple_register_from + i );
								
								LISTVIEW_SetItemText(hItem, 0, i, buffer);

								if(modbus_rx.data_converted[i] != 0)
									sprintf(buffer, "%s", "ON");
								else
									sprintf(buffer, "%s", "OFF");
								
								LISTVIEW_SetItemText(hItem, slave_column, i, buffer);

							}							
						}	

						//ho chiesto 1 coil?
						else if(new_GUI_value.RADIO_value.radio_selection == 2){
							
								sprintf(buffer, "%d", new_GUI_value.SPINBOX_value.single_register_number);
								LISTVIEW_SetItemText(hItem, 0, 0, buffer);
							
								if(modbus_rx.data_converted[0] != 0)
									sprintf(buffer, "%s", "ON");
								else
									sprintf(buffer, "%s", "OFF");
								
								LISTVIEW_SetItemText(hItem, slave_column, 0, buffer);
							
							
						}
						
					}						
				}

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_LISTVIEW_0: // Notifications sent by 'response_view'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SEL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_LISTVIEW_1: // Notifications sent by 'status_view'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SEL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'exit_button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(600, 20);				
        PlayAudio(600, 20);				
        PlayAudio(200, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        new_GUI_value.SPINBOX_value.slave_id = 0;
        new_GUI_value.SPINBOX_value.multiple_register_from = 0;
        new_GUI_value.SPINBOX_value.multiple_register_to = 0;
        new_GUI_value.SPINBOX_value.single_register_number = 0;
        new_GUI_value.SPINBOX_value.write_value = 0;
        new_GUI_value.RADIO_value.radio_selection = 0;

        PlayAudio(900, 20);				
        PlayAudio(1000, 20);				
        PlayAudio(1100, 20);				

        hItem = pMsg->hWin;
        GUI_EndDialog(hItem, 0);


        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SPINBOX_0: // Notifications sent by 'slave_id_spinbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

        hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_0);
        new_GUI_value.SPINBOX_value.slave_id = SPINBOX_GetValue(pMsg->hWinSrc);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SPINBOX_1: // Notifications sent by 'from_spinbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

        hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_1);
        new_GUI_value.SPINBOX_value.multiple_register_from = SPINBOX_GetValue(pMsg->hWinSrc);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SPINBOX_2: // Notifications sent by 'to_spinbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

        hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_2);
        new_GUI_value.SPINBOX_value.multiple_register_to = SPINBOX_GetValue(pMsg->hWinSrc);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SPINBOX_3: // Notifications sent by 'number_spinbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

        hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_3);
        new_GUI_value.SPINBOX_value.single_register_number = SPINBOX_GetValue(pMsg->hWinSrc);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SPINBOX_4: // Notifications sent by 'write_value_spinbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)

        hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_4);
        new_GUI_value.SPINBOX_value.write_value = SPINBOX_GetValue(pMsg->hWinSrc);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}