00001 /* 00002 * Copyright (c) 2010, Bosch LLC 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of Bosch LLC nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 //\Author Joerg Wagner, Bosch LLC 00031 00032 #ifndef CONFIG_USER_INTERFACE_H_ 00033 #define CONFIG_USER_INTERFACE_H_ 00034 00035 //wxwidgets stuff 00036 #include <wx/wx.h> 00037 00038 //commoon Headers 00039 #include <stdint.h> 00040 00041 //ROS Headers 00042 #include "skin_config/config_skin.h" 00043 #include <ros/ros.h> 00044 #include <ros/time.h> 00045 00047 namespace gui_id { 00048 //ID of menubar 00049 const int ID_About = 100; 00050 00051 //ID of Buttons 00052 const int ID_NUM_SENS_SET = 101; 00053 const int ID_STAT_THRES_SET = 102; 00054 const int ID_DYN_THRES_SET = 103; 00055 const int ID_COM_BTN_RTF = 104; 00056 const int ID_COM_BTN_IS = 105; 00057 00058 //ID of Timer 00059 const int ID_TIMER = 106; 00060 } 00061 00063 namespace skin_pub { 00065 //addresses of registers in RAM 00067 00069 const uint8_t AppData_CommandByte[2] = {0,0xC0}; 00071 const uint8_t AppData_DynLimit[2] = {0,0xC2}; 00073 const uint8_t readadr_hi = 1; 00075 const uint8_t readadr_lo = 0; 00076 00077 00079 //replacements 00081 00082 const bool sens_not_changed = false; 00083 const bool sens_changed = true; 00084 00085 00087 //values for function OnPublish 00089 00090 const uint8_t OneByte = 1; 00091 const uint8_t OneStep = 1; 00092 const uint8_t NoStep = 0; 00093 const uint8_t EightSteps = 8; 00094 const uint8_t EndOfChainMarker = 254; 00095 00097 //Default values 00099 00101 const uint8_t stat_thres_default = 10; 00102 } 00103 00105 00123 class MyFrame : public wxFrame 00124 { 00125 public: 00127 MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); 00128 00130 //functions of menubar 00132 00133 private: 00135 void OnQuit(wxCommandEvent& event); 00137 void OnAbout(wxCommandEvent& event); 00138 00139 00141 //Functions that are accessed at a button click 00143 00145 void OnRamToFlash(wxCommandEvent& event); 00147 void OnNumSensSet(wxCommandEvent& event); 00149 void OnStatThresSet(wxCommandEvent& event); 00151 void OnDynThresSet(wxCommandEvent& event); 00153 void OnInitSkin(wxCommandEvent& event); 00154 00155 00157 //common functions 00159 00161 00167 void subTopic(wxTimerEvent& evt); 00168 00170 00181 void ShowDialog(wxString wxstr, bool successfullychanged); 00182 00183 00185 //Variables 00187 00188 //Menu Bar 00189 00191 wxMenuBar *menubar; 00193 wxMenu *file; 00194 00195 //Text Windows 00196 00198 wxTextCtrl *twindow_num_sens_nv; 00200 wxTextCtrl *twindow_stat_thres_fs; 00202 wxTextCtrl *twindow_stat_thres_ts; 00204 wxTextCtrl *twindow_stat_thres_nv; 00206 wxTextCtrl *twindow_dyn_thres_cv; 00208 wxTextCtrl *twindow_dyn_thres_nv; 00209 00210 //Timer 00212 00217 wxTimer *timer_; 00218 00220 //ROS publisher / Subscriber 00222 00224 SkinConfig skin_config_; 00225 00227 00230 bool bchange; 00231 00232 }; 00233 00234 00235 00236 00237 00238 00239 #endif /* CONFIG_USER_INTERFACE_H_ */