⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main_menu.c

📁 OBDII的ScanTool源码,对此有兴趣的朋友可以参考一下
💻 C
📖 第 1 页 / 共 2 页
字号:

                  if (status == ERR_NO_DATA || status == UNABLE_TO_CONNECT)
                     alert("Protocol could not be detected.", "Please check connection to the vehicle,", "and make sure the ignition is ON", "OK", NULL, 0, 0);
                  else if (status != HEX_DATA)
                     alert("Communication error", NULL, NULL, "OK", NULL, 0, 0);
                     
                  return D_CLOSE;
               }
               else if (serial_time_out) // if the timer timed out
               {
                  stop_serial_timer(); // stop the timer
                  alert("Interface not found", NULL, NULL, "OK", NULL, 0, 0);
                  return D_CLOSE;
               }
         }
         break;
   }

   return D_O_K;
}


int read_codes_proc(int msg, DIALOG *d, int c)
{
   int ret;
   ret = nostretch_icon_proc(msg, d, c); // call the parent object

   if (msg == MSG_GOTMOUSE) // if we got mouse, display description
      sprintf(button_description, "Read codes and their definitions, turn off MIL and erase diagnostic test data.");

   if (ret == D_CLOSE)           // trap the close value
   {
     display_trouble_codes(); // display trouble code dialog
     strcpy(button_description, welcome_message);
     return D_REDRAW;
   }
   return ret;  // return
}


int sensor_data_proc(int msg, DIALOG *d, int c)
{
   int ret;
   int reset = FALSE;
   ret = nostretch_icon_proc(msg, d, c); // call the parent object

   if (msg == MSG_GOTMOUSE) // if we got mouse, display description
      sprintf(button_description, "Display current sensor data (RPM, Engine Load, Coolant Temperature, Speed, etc.)");

   if (ret == D_CLOSE)           // trap the close value
   {
      if (comport.status != READY)
      {
         reset = TRUE;
         if (open_comport() != 0)
         {
            comport.status = NOT_OPEN;   // reset comport status
            while (comport.status == NOT_OPEN)
            {
               if (alert("COM Port could not be opened.", "Please check that port settings are correct", "and that no other application is using it", "&Configure Port", "&Ignore", 'c', 'i') == 1)
                  display_options();
               else
                  comport.status = USER_IGNORED;
            }
         }
         else
            comport.status = READY;
      }
      display_sensor_dialog(reset);  // display sensor data dialog
      strcpy(button_description, welcome_message);
      return D_REDRAW;
   }
   return ret;  // return
}


int freeze_frame_proc(int msg, DIALOG *d, int c)
{
   int ret;
   ret = nostretch_icon_proc(msg, d, c); // call the parent object

   if (msg == MSG_GOTMOUSE) // if we got mouse, display description
      sprintf(button_description, "Display freeze frame data (not implemented in this version).");

   if (ret == D_CLOSE)           // trap the close value
   {
      alert("This feature is not implemented", " in this version", NULL, "OK", NULL, 0, 0);
      //display_freeze_frame(); // display freeze frame data
      //strcpy(button_description, welcome_message);
      return D_REDRAWME;
   }
   return ret;  // return
}


int tests_proc(int msg, DIALOG *d, int c)
{
   int ret;

   if (msg == MSG_GOTMOUSE) // if we got mouse, display description
      sprintf(button_description, "Display mode 5, 6, & 7 test results (not implemented in this version).");

   ret = nostretch_icon_proc(msg, d, c); // call the parent object

   if (ret == D_CLOSE)           // trap the close value
   {  
      alert("This feature is not implemented", " in this version", NULL, "OK", NULL, 0, 0);
      return D_REDRAWME;
   }
   return ret;  // return
}


int options_proc(int msg, DIALOG *d, int c)
{
   static int chip_was_reset = FALSE;
   int old_port;
   int ret;

   switch (msg)
   {
      case MSG_GOTMOUSE: // if we got mouse, display description
         sprintf(button_description, "Select system of measurements (US or Metric), and select serial port.");
         break;

      case MSG_IDLE:
         if (comport.status == NOT_OPEN)
         {
            if (alert("COM Port could not be opened.", "Please check that port settings are correct", "and that no other application is using it", "&Configure Port", "&Ignore", 'c', 'i') == 1)
               display_options();
            else
               comport.status = USER_IGNORED;
         }
         else if ((comport.status == READY) && (chip_was_reset == FALSE)) // if the port is ready,
         {
            reset_chip();
            chip_was_reset = TRUE;
         }
         break;
   }

   ret = nostretch_icon_proc(msg, d, c); // call the parent object

   if (ret == D_CLOSE)           // trap the close value
   {
      old_port = comport.number;
      display_options(); // display options dialog
      if (comport.number != old_port)
         chip_was_reset = FALSE;
      return D_REDRAWME;
   }
   return ret;  // return
}


int about_proc(int msg, DIALOG *d, int c)
{
   int ret;
   ret = nostretch_icon_proc(msg, d, c); // call the parent object

   if (msg == MSG_GOTMOUSE) // if we got mouse, display description
      sprintf(button_description, "Learn more about this program, and find out where you can buy the OBD-II interface.");

   if (ret == D_CLOSE)           // trap the close value
   {
      display_about(); // display information about the program
      strcpy(button_description, welcome_message);
      return D_REDRAW;
   }
   return ret;  // return
}


int exit_proc(int msg, DIALOG *d, int c)
{
   int ret;
   ret = nostretch_icon_proc(msg, d, c); // call the parent object

   if (msg == MSG_GOTMOUSE) // if we got mouse, display description
      sprintf(button_description, "Exit the program.");

   if (ret == D_CLOSE)           // trap the close value
   {
      if (alert("Do you really want to exit?", NULL, NULL, "&Yes", "&No", 'y', 'n') == 2)
         return D_REDRAWME;
   }
   return ret;  // return
}


int button_desc_proc(int msg, DIALOG *d, int c)
{
   int ret;
   ret = super_textbox_proc(msg, d, c); // call the parent object

   if (msg == MSG_START)
      d->dp2 = datafile[ARIAL18_FONT].dat;

   if (strcmp(current_description, button_description)) // if buttons are different
   {
      strcpy(current_description, button_description);
      return D_REDRAWME;
   }

   return ret;  // return
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -