├── .gitattributes └── EV_XPSlaveTestSystem ├── BMU_CAN_XP.xls ├── ControlCAN.dll ├── DeviceOperate.dll ├── config.property ├── icons ├── Thumbs.db ├── error_16.png ├── fail.png ├── ok.png ├── ok_16.png └── unKnown.png ├── jna.jar ├── kerneldlls ├── CAN232.dll ├── CANETE.dll ├── CANET_TCP.dll ├── PC104C2.dll ├── PC104CAN.dll ├── PCI5121.dll ├── gisadll.dll ├── gpcidll.dll ├── isa5420.dll ├── kerneldll.ini └── usbcan.dll ├── lib ├── comm.jar └── jxl.jar ├── src ├── org │ └── eclipse │ │ └── wb │ │ └── swt │ │ └── SWTResourceManager.java └── user │ ├── CanDriver │ ├── CanController.java │ ├── CanDriver.java │ ├── CanDriverAdapter.java │ ├── VCI_CAN_OBJ.java │ └── VCI_INIT_CONFIG.java │ ├── CheckTask │ ├── BreathCmdTask.java │ ├── CheckThread.java │ ├── DriverReviceTask.java │ └── DriverSendTask.java │ ├── CheckTest │ ├── CheckAbs.java │ ├── ReadData.java │ ├── TestChekStep.java │ └── WriteData.java │ ├── Method │ ├── ExcelUtils.java │ └── ResultCache.java │ ├── frame │ ├── Mainframe.java │ ├── ParamaterFrame.java │ ├── QRcodeFrame.java │ ├── TabFrame.java │ ├── TestFrame.java │ ├── TestFrameAbs.java │ └── dialog │ │ └── MessageDialog.java │ ├── model │ ├── DataRow.java │ ├── ParamRow.java │ ├── PromptMsg.java │ └── ResultModel.java │ ├── service │ ├── CSVFile.java │ ├── ExportDataService.java │ └── Persistent.java │ └── util │ ├── CSVUtils.java │ ├── DataTypeUtil.java │ ├── DateUtil.java │ ├── MyLogger.java │ ├── MyQueue.java │ ├── NumberUtils.java │ ├── Property.java │ ├── ReadConfigUtils.java │ ├── StringUtils.java │ ├── TextVerifyListener.java │ └── TiCommandCompare.java └── testType.properties /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/BMU_CAN_XP.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/BMU_CAN_XP.xls -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/ControlCAN.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/ControlCAN.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/DeviceOperate.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/DeviceOperate.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/config.property: -------------------------------------------------------------------------------- 1 | #1502068420655 2 | #Mon Aug 07 09:13:40 CST 2017 3 | CREATE_FILE_TIME=1502068420655 4 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/icons/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/icons/Thumbs.db -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/icons/error_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/icons/error_16.png -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/icons/fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/icons/fail.png -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/icons/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/icons/ok.png -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/icons/ok_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/icons/ok_16.png -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/icons/unKnown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/icons/unKnown.png -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/jna.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/jna.jar -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/CAN232.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/CAN232.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/CANETE.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/CANETE.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/CANET_TCP.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/CANET_TCP.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/PC104C2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/PC104C2.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/PC104CAN.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/PC104CAN.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/PCI5121.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/PCI5121.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/gisadll.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/gisadll.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/gpcidll.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/gpcidll.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/isa5420.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/isa5420.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/kerneldll.ini: -------------------------------------------------------------------------------- 1 | [KERNELDLL] 2 | COUNT=17 3 | 1=PCI5121.dll 4 | 2=PCI9810B.dll 5 | 3=USBCAN.dll 6 | 4=USBCAN.dll 7 | 5=PCI9820B.dll 8 | 6=CAN232.dll 9 | 7=PCI5121.dll 10 | 8=CANLite.dll 11 | 9=ISA9620B.dll 12 | 10=ISA5420.dll 13 | 11=PC104CAN.dll 14 | 12=CANETE.dll 15 | 13=DNP9810B.dll 16 | 14=PCI9840B.dll 17 | 15=PC104C2.dll 18 | 16=PCI9820I.dll 19 | 17=CANET_TCP.dll 20 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/kerneldlls/usbcan.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/kerneldlls/usbcan.dll -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/lib/comm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/lib/comm.jar -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/lib/jxl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/lib/jxl.jar -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/org/eclipse/wb/swt/SWTResourceManager.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2011 Google, Inc. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * Google, Inc. - initial API and implementation 10 | *******************************************************************************/ 11 | package org.eclipse.wb.swt; 12 | 13 | import java.io.FileInputStream; 14 | import java.io.IOException; 15 | import java.io.InputStream; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | import org.eclipse.swt.SWT; 20 | import org.eclipse.swt.graphics.Color; 21 | import org.eclipse.swt.graphics.Cursor; 22 | import org.eclipse.swt.graphics.Font; 23 | import org.eclipse.swt.graphics.FontData; 24 | import org.eclipse.swt.graphics.GC; 25 | import org.eclipse.swt.graphics.Image; 26 | import org.eclipse.swt.graphics.ImageData; 27 | import org.eclipse.swt.graphics.RGB; 28 | import org.eclipse.swt.graphics.Rectangle; 29 | import org.eclipse.swt.widgets.Display; 30 | 31 | /** 32 | * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. 33 | *

34 | * !!! IMPORTANT !!! Application code must explicitly invoke the dispose() method to release the 35 | * operating system resources managed by cached objects when those objects and OS resources are no longer 36 | * needed (e.g. on application shutdown) 37 | *

38 | * This class may be freely distributed as part of any application or plugin. 39 | *

40 | * @author scheglov_ke 41 | * @author Dan Rubel 42 | */ 43 | public class SWTResourceManager { 44 | //////////////////////////////////////////////////////////////////////////// 45 | // 46 | // Color 47 | // 48 | //////////////////////////////////////////////////////////////////////////// 49 | private static Map m_colorMap = new HashMap(); 50 | /** 51 | * Returns the system {@link Color} matching the specific ID. 52 | * 53 | * @param systemColorID 54 | * the ID value for the color 55 | * @return the system {@link Color} matching the specific ID 56 | */ 57 | public static Color getColor(int systemColorID) { 58 | Display display = Display.getCurrent(); 59 | return display.getSystemColor(systemColorID); 60 | } 61 | /** 62 | * Returns a {@link Color} given its red, green and blue component values. 63 | * 64 | * @param r 65 | * the red component of the color 66 | * @param g 67 | * the green component of the color 68 | * @param b 69 | * the blue component of the color 70 | * @return the {@link Color} matching the given red, green and blue component values 71 | */ 72 | public static Color getColor(int r, int g, int b) { 73 | return getColor(new RGB(r, g, b)); 74 | } 75 | /** 76 | * Returns a {@link Color} given its RGB value. 77 | * 78 | * @param rgb 79 | * the {@link RGB} value of the color 80 | * @return the {@link Color} matching the RGB value 81 | */ 82 | public static Color getColor(RGB rgb) { 83 | Color color = m_colorMap.get(rgb); 84 | if (color == null) { 85 | Display display = Display.getCurrent(); 86 | color = new Color(display, rgb); 87 | m_colorMap.put(rgb, color); 88 | } 89 | return color; 90 | } 91 | /** 92 | * Dispose of all the cached {@link Color}'s. 93 | */ 94 | public static void disposeColors() { 95 | for (Color color : m_colorMap.values()) { 96 | color.dispose(); 97 | } 98 | m_colorMap.clear(); 99 | } 100 | //////////////////////////////////////////////////////////////////////////// 101 | // 102 | // Image 103 | // 104 | //////////////////////////////////////////////////////////////////////////// 105 | /** 106 | * Maps image paths to images. 107 | */ 108 | private static Map m_imageMap = new HashMap(); 109 | /** 110 | * Returns an {@link Image} encoded by the specified {@link InputStream}. 111 | * 112 | * @param stream 113 | * the {@link InputStream} encoding the image data 114 | * @return the {@link Image} encoded by the specified input stream 115 | */ 116 | protected static Image getImage(InputStream stream) throws IOException { 117 | try { 118 | Display display = Display.getCurrent(); 119 | ImageData data = new ImageData(stream); 120 | if (data.transparentPixel > 0) { 121 | return new Image(display, data, data.getTransparencyMask()); 122 | } 123 | return new Image(display, data); 124 | } finally { 125 | stream.close(); 126 | } 127 | } 128 | /** 129 | * Returns an {@link Image} stored in the file at the specified path. 130 | * 131 | * @param path 132 | * the path to the image file 133 | * @return the {@link Image} stored in the file at the specified path 134 | */ 135 | public static Image getImage(String path) { 136 | Image image = m_imageMap.get(path); 137 | if (image == null) { 138 | try { 139 | image = getImage(new FileInputStream(path)); 140 | m_imageMap.put(path, image); 141 | } catch (Exception e) { 142 | image = getMissingImage(); 143 | m_imageMap.put(path, image); 144 | } 145 | } 146 | return image; 147 | } 148 | /** 149 | * Returns an {@link Image} stored in the file at the specified path relative to the specified class. 150 | * 151 | * @param clazz 152 | * the {@link Class} relative to which to find the image 153 | * @param path 154 | * the path to the image file, if starts with '/' 155 | * @return the {@link Image} stored in the file at the specified path 156 | */ 157 | public static Image getImage(Class clazz, String path) { 158 | String key = clazz.getName() + '|' + path; 159 | Image image = m_imageMap.get(key); 160 | if (image == null) { 161 | try { 162 | image = getImage(clazz.getResourceAsStream(path)); 163 | m_imageMap.put(key, image); 164 | } catch (Exception e) { 165 | image = getMissingImage(); 166 | m_imageMap.put(key, image); 167 | } 168 | } 169 | return image; 170 | } 171 | private static final int MISSING_IMAGE_SIZE = 10; 172 | /** 173 | * @return the small {@link Image} that can be used as placeholder for missing image. 174 | */ 175 | private static Image getMissingImage() { 176 | Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); 177 | // 178 | GC gc = new GC(image); 179 | gc.setBackground(getColor(SWT.COLOR_RED)); 180 | gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); 181 | gc.dispose(); 182 | // 183 | return image; 184 | } 185 | /** 186 | * Style constant for placing decorator image in top left corner of base image. 187 | */ 188 | public static final int TOP_LEFT = 1; 189 | /** 190 | * Style constant for placing decorator image in top right corner of base image. 191 | */ 192 | public static final int TOP_RIGHT = 2; 193 | /** 194 | * Style constant for placing decorator image in bottom left corner of base image. 195 | */ 196 | public static final int BOTTOM_LEFT = 3; 197 | /** 198 | * Style constant for placing decorator image in bottom right corner of base image. 199 | */ 200 | public static final int BOTTOM_RIGHT = 4; 201 | /** 202 | * Internal value. 203 | */ 204 | protected static final int LAST_CORNER_KEY = 5; 205 | /** 206 | * Maps images to decorated images. 207 | */ 208 | @SuppressWarnings("unchecked") 209 | private static Map>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; 210 | /** 211 | * Returns an {@link Image} composed of a base image decorated by another image. 212 | * 213 | * @param baseImage 214 | * the base {@link Image} that should be decorated 215 | * @param decorator 216 | * the {@link Image} to decorate the base image 217 | * @return {@link Image} The resulting decorated image 218 | */ 219 | public static Image decorateImage(Image baseImage, Image decorator) { 220 | return decorateImage(baseImage, decorator, BOTTOM_RIGHT); 221 | } 222 | /** 223 | * Returns an {@link Image} composed of a base image decorated by another image. 224 | * 225 | * @param baseImage 226 | * the base {@link Image} that should be decorated 227 | * @param decorator 228 | * the {@link Image} to decorate the base image 229 | * @param corner 230 | * the corner to place decorator image 231 | * @return the resulting decorated {@link Image} 232 | */ 233 | public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { 234 | if (corner <= 0 || corner >= LAST_CORNER_KEY) { 235 | throw new IllegalArgumentException("Wrong decorate corner"); 236 | } 237 | Map> cornerDecoratedImageMap = m_decoratedImageMap[corner]; 238 | if (cornerDecoratedImageMap == null) { 239 | cornerDecoratedImageMap = new HashMap>(); 240 | m_decoratedImageMap[corner] = cornerDecoratedImageMap; 241 | } 242 | Map decoratedMap = cornerDecoratedImageMap.get(baseImage); 243 | if (decoratedMap == null) { 244 | decoratedMap = new HashMap(); 245 | cornerDecoratedImageMap.put(baseImage, decoratedMap); 246 | } 247 | // 248 | Image result = decoratedMap.get(decorator); 249 | if (result == null) { 250 | Rectangle bib = baseImage.getBounds(); 251 | Rectangle dib = decorator.getBounds(); 252 | // 253 | result = new Image(Display.getCurrent(), bib.width, bib.height); 254 | // 255 | GC gc = new GC(result); 256 | gc.drawImage(baseImage, 0, 0); 257 | if (corner == TOP_LEFT) { 258 | gc.drawImage(decorator, 0, 0); 259 | } else if (corner == TOP_RIGHT) { 260 | gc.drawImage(decorator, bib.width - dib.width, 0); 261 | } else if (corner == BOTTOM_LEFT) { 262 | gc.drawImage(decorator, 0, bib.height - dib.height); 263 | } else if (corner == BOTTOM_RIGHT) { 264 | gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); 265 | } 266 | gc.dispose(); 267 | // 268 | decoratedMap.put(decorator, result); 269 | } 270 | return result; 271 | } 272 | /** 273 | * Dispose all of the cached {@link Image}'s. 274 | */ 275 | public static void disposeImages() { 276 | // dispose loaded images 277 | { 278 | for (Image image : m_imageMap.values()) { 279 | image.dispose(); 280 | } 281 | m_imageMap.clear(); 282 | } 283 | // dispose decorated images 284 | for (int i = 0; i < m_decoratedImageMap.length; i++) { 285 | Map> cornerDecoratedImageMap = m_decoratedImageMap[i]; 286 | if (cornerDecoratedImageMap != null) { 287 | for (Map decoratedMap : cornerDecoratedImageMap.values()) { 288 | for (Image image : decoratedMap.values()) { 289 | image.dispose(); 290 | } 291 | decoratedMap.clear(); 292 | } 293 | cornerDecoratedImageMap.clear(); 294 | } 295 | } 296 | } 297 | //////////////////////////////////////////////////////////////////////////// 298 | // 299 | // Font 300 | // 301 | //////////////////////////////////////////////////////////////////////////// 302 | /** 303 | * Maps font names to fonts. 304 | */ 305 | private static Map m_fontMap = new HashMap(); 306 | /** 307 | * Maps fonts to their bold versions. 308 | */ 309 | private static Map m_fontToBoldFontMap = new HashMap(); 310 | /** 311 | * Returns a {@link Font} based on its name, height and style. 312 | * 313 | * @param name 314 | * the name of the font 315 | * @param height 316 | * the height of the font 317 | * @param style 318 | * the style of the font 319 | * @return {@link Font} The font matching the name, height and style 320 | */ 321 | public static Font getFont(String name, int height, int style) { 322 | return getFont(name, height, style, false, false); 323 | } 324 | /** 325 | * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline 326 | * flags are also supported. 327 | * 328 | * @param name 329 | * the name of the font 330 | * @param size 331 | * the size of the font 332 | * @param style 333 | * the style of the font 334 | * @param strikeout 335 | * the strikeout flag (warning: Windows only) 336 | * @param underline 337 | * the underline flag (warning: Windows only) 338 | * @return {@link Font} The font matching the name, height, style, strikeout and underline 339 | */ 340 | public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { 341 | String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; 342 | Font font = m_fontMap.get(fontName); 343 | if (font == null) { 344 | FontData fontData = new FontData(name, size, style); 345 | if (strikeout || underline) { 346 | try { 347 | Class logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ 348 | Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ 349 | if (logFont != null && logFontClass != null) { 350 | if (strikeout) { 351 | logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ 352 | } 353 | if (underline) { 354 | logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ 355 | } 356 | } 357 | } catch (Throwable e) { 358 | System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ 359 | } 360 | } 361 | font = new Font(Display.getCurrent(), fontData); 362 | m_fontMap.put(fontName, font); 363 | } 364 | return font; 365 | } 366 | /** 367 | * Returns a bold version of the given {@link Font}. 368 | * 369 | * @param baseFont 370 | * the {@link Font} for which a bold version is desired 371 | * @return the bold version of the given {@link Font} 372 | */ 373 | public static Font getBoldFont(Font baseFont) { 374 | Font font = m_fontToBoldFontMap.get(baseFont); 375 | if (font == null) { 376 | FontData fontDatas[] = baseFont.getFontData(); 377 | FontData data = fontDatas[0]; 378 | font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); 379 | m_fontToBoldFontMap.put(baseFont, font); 380 | } 381 | return font; 382 | } 383 | /** 384 | * Dispose all of the cached {@link Font}'s. 385 | */ 386 | public static void disposeFonts() { 387 | // clear fonts 388 | for (Font font : m_fontMap.values()) { 389 | font.dispose(); 390 | } 391 | m_fontMap.clear(); 392 | // clear bold fonts 393 | for (Font font : m_fontToBoldFontMap.values()) { 394 | font.dispose(); 395 | } 396 | m_fontToBoldFontMap.clear(); 397 | } 398 | //////////////////////////////////////////////////////////////////////////// 399 | // 400 | // Cursor 401 | // 402 | //////////////////////////////////////////////////////////////////////////// 403 | /** 404 | * Maps IDs to cursors. 405 | */ 406 | private static Map m_idToCursorMap = new HashMap(); 407 | /** 408 | * Returns the system cursor matching the specific ID. 409 | * 410 | * @param id 411 | * int The ID value for the cursor 412 | * @return Cursor The system cursor matching the specific ID 413 | */ 414 | public static Cursor getCursor(int id) { 415 | Integer key = Integer.valueOf(id); 416 | Cursor cursor = m_idToCursorMap.get(key); 417 | if (cursor == null) { 418 | cursor = new Cursor(Display.getDefault(), id); 419 | m_idToCursorMap.put(key, cursor); 420 | } 421 | return cursor; 422 | } 423 | /** 424 | * Dispose all of the cached cursors. 425 | */ 426 | public static void disposeCursors() { 427 | for (Cursor cursor : m_idToCursorMap.values()) { 428 | cursor.dispose(); 429 | } 430 | m_idToCursorMap.clear(); 431 | } 432 | //////////////////////////////////////////////////////////////////////////// 433 | // 434 | // General 435 | // 436 | //////////////////////////////////////////////////////////////////////////// 437 | /** 438 | * Dispose of cached objects and their underlying OS resources. This should only be called when the cached 439 | * objects are no longer needed (e.g. on application shutdown). 440 | */ 441 | public static void dispose() { 442 | disposeColors(); 443 | disposeImages(); 444 | disposeFonts(); 445 | disposeCursors(); 446 | } 447 | } -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CanDriver/CanController.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CanDriver/CanController.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CanDriver/CanDriver.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CanDriver/CanDriver.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CanDriver/CanDriverAdapter.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CanDriver/CanDriverAdapter.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CanDriver/VCI_CAN_OBJ.java: -------------------------------------------------------------------------------- 1 | package user.CanDriver; 2 | 3 | import com.sun.jna.Structure; 4 | 5 | public class VCI_CAN_OBJ extends Structure 6 | { 7 | public static class ByReference extends VCI_CAN_OBJ implements Structure.ByReference { } 8 | public static class ByValue extends VCI_CAN_OBJ implements Structure.ByValue{} 9 | public int ID; 10 | public int TimeStamp; 11 | public byte TimeFlag; 12 | public byte SendType; 13 | 14 | public byte RemoteFlag; 15 | public byte ExternFlag; 16 | public byte DataLen; 17 | public byte[] Data = new byte[8]; 18 | public byte[] Reserved = new byte[3]; 19 | } 20 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CanDriver/VCI_INIT_CONFIG.java: -------------------------------------------------------------------------------- 1 | package user.CanDriver; 2 | 3 | import com.sun.jna.Structure; 4 | 5 | public class VCI_INIT_CONFIG extends Structure 6 | { 7 | public static class ByReference extends VCI_INIT_CONFIG implements Structure.ByReference { } 8 | public static class ByValue extends VCI_INIT_CONFIG implements Structure.ByValue{} 9 | public int AccCode; 10 | public int AccMask; 11 | public int Reserved; 12 | public byte Filter; 13 | public byte Timing0; 14 | public byte Timing1; 15 | public byte Mode; 16 | } 17 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTask/BreathCmdTask.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CheckTask/BreathCmdTask.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTask/CheckThread.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CheckTask/CheckThread.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTask/DriverReviceTask.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CheckTask/DriverReviceTask.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTask/DriverSendTask.java: -------------------------------------------------------------------------------- 1 | package user.CheckTask; 2 | 3 | import user.CanDriver.CanController; 4 | import user.CanDriver.VCI_CAN_OBJ; 5 | import user.util.MyQueue; 6 | 7 | public class DriverSendTask implements Runnable 8 | { 9 | private MyQueue queue; 10 | private boolean isRun=true; 11 | 12 | public DriverSendTask(MyQueue queue) 13 | { 14 | super(); 15 | this.queue = queue; 16 | } 17 | 18 | 19 | @Override 20 | public void run() 21 | { 22 | while(CanController.getInstance().isConnect()&&isRun){ 23 | VCI_CAN_OBJ.ByReference cmd=queue.get(); 24 | if(cmd!=null){ 25 | CanController.getInstance().sendCmd(cmd); 26 | } 27 | delay(1); 28 | 29 | } 30 | 31 | } 32 | 33 | public void delay(int time){ 34 | try 35 | { 36 | Thread.sleep(time); 37 | } catch (InterruptedException e) 38 | { 39 | // TODO Auto-generated catch block 40 | e.printStackTrace(); 41 | } 42 | } 43 | 44 | public void stop(){ 45 | isRun=false; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTest/CheckAbs.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CheckTest/CheckAbs.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTest/ReadData.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CheckTest/ReadData.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTest/TestChekStep.java: -------------------------------------------------------------------------------- 1 | package user.CheckTest; 2 | 3 | public interface TestChekStep 4 | { 5 | public final static String LOCK="LOCK"; 6 | public final static int NO_OPEN=1; 7 | public final static int OPEN=2; 8 | public final static int OK=3; 9 | public final static int CANCEL=4; 10 | public final static int CLOSE=5; 11 | public int getStepCount(); 12 | public String monitorStep(); 13 | public int getStep(); 14 | public void setStepBegin(int begin); 15 | public void doTest(); 16 | public void stopTest(); 17 | public boolean getResult(); 18 | public void beforeTest(); 19 | public void setMsgBoxStatus(int status); 20 | public int getMsgBoxStatus(); 21 | public void reset(); 22 | public String getResultPrompt(); 23 | } 24 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/CheckTest/WriteData.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/CheckTest/WriteData.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/Method/ExcelUtils.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/Method/ExcelUtils.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/Method/ResultCache.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/Method/ResultCache.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/frame/Mainframe.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/frame/Mainframe.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/frame/ParamaterFrame.java: -------------------------------------------------------------------------------- 1 | package user.frame; 2 | 3 | import java.util.ArrayList; 4 | 5 | import org.eclipse.swt.SWT; 6 | import org.eclipse.swt.widgets.Composite; 7 | import org.eclipse.swt.widgets.Group; 8 | 9 | import user.CheckTest.TestChekStep; 10 | import user.Method.ResultCache; 11 | import org.eclipse.swt.widgets.Label; 12 | import org.eclipse.swt.widgets.Text; 13 | 14 | public class ParamaterFrame extends TestFrameAbs 15 | { 16 | private Group totalGroup; 17 | private Composite comp; 18 | private Text deviceAdrText; 19 | private Text VoltageCountText; 20 | private Text tempCountText; 21 | 22 | 23 | 24 | public ParamaterFrame(Composite parent, int style) 25 | { 26 | super(parent, style); 27 | 28 | testChekSteps = new ArrayList(); 29 | // bsmuCheck = new BsmuCheck(); 30 | // testChekSteps.add(bsmuCheck); 31 | 32 | 33 | // ok=Mainframe.ok; 34 | // error=Mainframe.error; 35 | // green=Mainframe.green; 36 | // red=Mainframe.red; 37 | comp=this; 38 | 39 | totalGroup = new Group(comp, SWT.NONE); 40 | totalGroup.setLocation(10, 10); 41 | totalGroup.setSize(522, 361); 42 | totalGroup.setText("\u9879\u76EE\u53C2\u6570"); 43 | 44 | Label label = new Label(totalGroup, SWT.NONE); 45 | label.setBounds(49, 38, 51, 17); 46 | label.setText("\u8BBE\u5907\u5730\u5740:"); 47 | 48 | Label label_1 = new Label(totalGroup, SWT.NONE); 49 | label_1.setBounds(25, 78, 75, 17); 50 | label_1.setText("\u7535\u538B\u91C7\u6837\u8282\u6570:"); 51 | 52 | Label label_2 = new Label(totalGroup, SWT.NONE); 53 | label_2.setBounds(25, 113, 75, 17); 54 | label_2.setText("\u6E29\u5EA6\u91C7\u6837\u8282\u6570:"); 55 | 56 | deviceAdrText = new Text(totalGroup, SWT.BORDER); 57 | deviceAdrText.setBounds(116, 35, 316, 23); 58 | 59 | VoltageCountText = new Text(totalGroup, SWT.BORDER); 60 | VoltageCountText.setBounds(116, 75, 316, 23); 61 | 62 | tempCountText = new Text(totalGroup, SWT.BORDER); 63 | tempCountText.setBounds(116, 110, 316, 23); 64 | 65 | initResult(); 66 | } 67 | 68 | 69 | 70 | 71 | public void initResult(){ 72 | 73 | // bsmuCheck.beforeTest(); 74 | 75 | 76 | } 77 | public void refreshTables(){ 78 | ResultCache cache=ResultCache.getInstance(); 79 | 80 | // refreshTable(totalTable,cache.getTotalStatus(),1); 81 | // refreshTable(canCelltable,cache.getCAN(),0); 82 | // refreshTable(rs485Table,cache.getRS485(),0); 83 | // refreshTable(cocontactorTable,cache.getCocontactor(),0); 84 | // refreshTable(LedTable,cache.getLED(),0); 85 | // refreshTable(outputTable,cache.getOutputIO(),0); 86 | // refreshTable(inputTable,cache.getInputIO(),0); 87 | // refreshTable(sdCardTable,cache.getSdCard(),0); 88 | // refreshTable(ethernetTable,cache.getEthernet(),0); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/frame/QRcodeFrame.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/frame/QRcodeFrame.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/frame/TabFrame.java: -------------------------------------------------------------------------------- 1 | package user.frame; 2 | 3 | import java.util.List; 4 | 5 | import user.CheckTest.TestChekStep; 6 | import user.service.ExportDataService; 7 | 8 | public interface TabFrame 9 | { 10 | public List getTestCheckSteps(); 11 | 12 | public void refreshTables(); 13 | public void initResult(); 14 | public boolean isCheckIP(); 15 | public ExportDataService getSaveDataService(); 16 | } 17 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/frame/TestFrame.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/frame/TestFrame.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/frame/TestFrameAbs.java: -------------------------------------------------------------------------------- 1 | package user.frame; 2 | 3 | import java.util.List; 4 | import org.eclipse.swt.SWT; 5 | import org.eclipse.swt.graphics.Image; 6 | import org.eclipse.swt.widgets.Composite; 7 | import org.eclipse.swt.widgets.Table; 8 | import org.eclipse.swt.widgets.TableItem; 9 | 10 | import user.CanDriver.CanController; 11 | import user.CheckTest.TestChekStep; 12 | import user.Method.ResultCache; 13 | import user.model.DataRow; 14 | import user.model.ResultModel; 15 | import user.service.ExportDataService; 16 | 17 | public abstract class TestFrameAbs extends Composite implements TabFrame 18 | { 19 | public Image ok,error,green,red; 20 | protected List testChekSteps; 21 | public TestFrameAbs(Composite parent, int style) 22 | { 23 | super(parent, style); 24 | ok=Mainframe.ok; 25 | error=Mainframe.error; 26 | green=Mainframe.green; 27 | red=Mainframe.red; 28 | } 29 | 30 | protected void initTableItem(Table table,List list){ 31 | if(table==null || list==null || list.size()<=0){ 32 | return ; 33 | } 34 | for(ResultModel rm : list){ 35 | try 36 | { 37 | TableItem tableItem = new TableItem(table, SWT.NONE); 38 | tableItem.setText(rm.getRowNum()+""); 39 | tableItem.setText(1,rm.getName()); 40 | //tableItem.setImage(2, error); 41 | } catch (Exception e){ 42 | e.printStackTrace(); 43 | } 44 | } 45 | } 46 | protected void refreshTable(Table table,List models,int startIndex){ 47 | ResultModel model = null; 48 | if(table==null || table.isDisposed()){ 49 | return ; 50 | } 51 | for(int i = 0;i < table.getItemCount();i++) 52 | { 53 | try 54 | { 55 | model = models.get(i); 56 | if(models==null ||model==null){ 57 | continue; 58 | } 59 | String str = model.getName(); 60 | if(str==null){ 61 | continue; 62 | } 63 | table.getItem(i).setText(1,str); 64 | if(model.isResult()){ 65 | table.getItem(i).setImage(2, ok); 66 | }else{ 67 | table.getItem(i).setImage(2, error); 68 | } 69 | } catch (Exception e) 70 | { 71 | e.printStackTrace(); 72 | System.out.println("models.size = " + models.size() + " , table.getItemCount() = " + table.getItemCount()); 73 | 74 | } 75 | } 76 | } 77 | public boolean isCheckIP(){ 78 | return false; 79 | } 80 | public List getTestCheckSteps(){ 81 | return testChekSteps; 82 | } 83 | 84 | @Override 85 | public ExportDataService getSaveDataService() 86 | { 87 | return null; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/frame/dialog/MessageDialog.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/frame/dialog/MessageDialog.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/model/DataRow.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/model/DataRow.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/model/ParamRow.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/model/ParamRow.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/model/PromptMsg.java: -------------------------------------------------------------------------------- 1 | package user.model; 2 | 3 | public class PromptMsg 4 | { 5 | private String message; 6 | private int step; 7 | private int index; 8 | 9 | public PromptMsg() 10 | { 11 | } 12 | 13 | // public PromptMsg(String reVal, int val) 14 | // { 15 | // this.message = reVal; 16 | // this.step = val; 17 | // } 18 | public PromptMsg(String message, int step, int index) 19 | { 20 | super(); 21 | this.message = message; 22 | this.step = step; 23 | this.index = index; 24 | } 25 | 26 | public int getIndex() 27 | { 28 | return index; 29 | } 30 | 31 | 32 | 33 | public void setIndex(int index) 34 | { 35 | this.index = index; 36 | } 37 | 38 | 39 | 40 | public String getMessage() 41 | { 42 | return message; 43 | } 44 | public void setMessage(String message) 45 | { 46 | this.message = message; 47 | } 48 | public int getStep() 49 | { 50 | return step; 51 | } 52 | public void setStep(int step) 53 | { 54 | this.step = step; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/model/ResultModel.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/model/ResultModel.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/service/CSVFile.java: -------------------------------------------------------------------------------- 1 | package user.service; 2 | 3 | 4 | import java.io.File; 5 | import java.io.IOException; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.logging.Level; 9 | 10 | import user.util.CSVUtils; 11 | import user.util.MyLogger; 12 | 13 | public class CSVFile implements Persistent { 14 | 15 | @Override 16 | public int hasSheetByName(String dir,String fileName, String sheetName) { 17 | int ret = -1; 18 | try { 19 | String directory = dir+fileName+System.getProperty("file.separator"); 20 | if(CSVUtils.isExists(directory,directory+sheetName+".csv")){ 21 | ret = 0; 22 | } 23 | } catch (Exception e) { 24 | e.printStackTrace(); 25 | MyLogger.logger.log(Level.INFO, "hasSheetByName Exception", e); 26 | ret = -1; 27 | } 28 | return ret; 29 | } 30 | @Override 31 | public int writeData(String dir, String fileName, String sheetName, List datas) throws IOException { 32 | int ret=-1; 33 | try { 34 | String path=dir+fileName+System.getProperty("file.separator"); 35 | File directory = new File(path); 36 | File file = new File(path+sheetName+".csv"); 37 | ret = CSVUtils.exportCsv(directory, file, datas); 38 | } 39 | catch (Exception e) { 40 | e.printStackTrace(); 41 | MyLogger.logger.log(Level.INFO, "writeData Exception", e); 42 | if(e instanceof IOException){ 43 | throw (IOException)e; 44 | } 45 | } 46 | return ret; 47 | } 48 | @Override 49 | public boolean writeHeader(String dir,String fileName,String sheetName, String[] header) { 50 | try { 51 | if(header==null || header.length<=0){ 52 | return false; 53 | } 54 | List datas = new ArrayList(); 55 | datas.add(header); 56 | return writeData(dir,fileName,sheetName,datas)==1; 57 | } catch (IOException e) { 58 | e.printStackTrace(); 59 | MyLogger.logger.log(Level.INFO, "writeData writeHeader", e); 60 | } 61 | return false; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/service/ExportDataService.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/service/ExportDataService.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/service/Persistent.java: -------------------------------------------------------------------------------- 1 | package user.service; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | /** 6 | * 保存文件 7 | * @author rdtest305 8 | * 9 | */ 10 | public interface Persistent { 11 | /** 12 | * 是否存在SHEET,存在返回sheetID,不存在返回-1 13 | * @param fileName 14 | * @param sheetName 15 | * @return 16 | */ 17 | public int hasSheetByName(String dir,String folder,String fileName); 18 | /** 19 | * 追加数据 20 | * @param dir 21 | * @param fileName 22 | * @param sheetName 23 | * @param datas 24 | * @return -1:不成功 25 | * @throws IOException 26 | */ 27 | public int writeData(String dir,String folder,String fileName,List datas)throws IOException; 28 | /** 29 | * 写标题列是否成功 30 | * @param dir 31 | * @param fileName 32 | * @param sheetName 33 | * @param header 34 | * @return 35 | */ 36 | public boolean writeHeader(String dir,String folder,String fileName,String[] header); 37 | } 38 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/util/CSVUtils.java: -------------------------------------------------------------------------------- 1 | package user.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.BufferedWriter; 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.FileOutputStream; 8 | import java.io.FileReader; 9 | import java.io.IOException; 10 | import java.io.InputStreamReader; 11 | import java.io.OutputStreamWriter; 12 | import java.nio.charset.Charset; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | import java.util.logging.Level; 16 | 17 | import com.sun.org.apache.xerces.internal.util.SecurityManager; 18 | 19 | /** 20 | * CSV操作(导出和导入) 21 | */ 22 | public class CSVUtils { 23 | public static Charset charset=Charset.defaultCharset(); 24 | public static boolean append = true; 25 | public static String separateMark=","; 26 | public static String rowMark="\r\n"; 27 | 28 | 29 | /** 30 | * 导出 31 | * 32 | * @param file csv文件(路径+文件名),csv文件不存在会自动创建 33 | * @param dataList 数据 34 | * @return 35 | */ 36 | public static int exportCsv(File dir,File file, List dataList) { 37 | int sucessNum = -1; 38 | 39 | if(!dirExists(dir)){ 40 | return sucessNum; 41 | } 42 | if(!fileExists(file)){ 43 | return sucessNum; 44 | } 45 | 46 | FileOutputStream out = null; 47 | OutputStreamWriter osw = null; 48 | BufferedWriter bw = null; 49 | try { 50 | int count = 0 ; 51 | out = new FileOutputStream(file,append); 52 | osw = new OutputStreamWriter(out,charset); 53 | bw = new BufferedWriter(osw); 54 | if (dataList != null && !dataList.isEmpty()) { 55 | for(String [] strs:dataList){ 56 | if(strs==null|| strs.length<=0){ 57 | continue; 58 | } 59 | for (int index = 0;index importCsv(File file) { 157 | List dataList = new ArrayList(); 158 | 159 | BufferedReader br = null; 160 | FileInputStream ins =null; 161 | InputStreamReader inr = null; 162 | try { 163 | 164 | ins = new FileInputStream(file); 165 | inr = new InputStreamReader(ins,charset); 166 | br = new BufferedReader(inr); 167 | String line = ""; 168 | while ((line = br.readLine()) != null) { 169 | dataList.add(line); 170 | } 171 | } catch (Exception e) { 172 | } finally { 173 | if (br != null) { 174 | try { 175 | br.close(); 176 | br = null; 177 | } catch (IOException e) { 178 | e.printStackTrace(); 179 | } 180 | } 181 | } 182 | 183 | return dataList; 184 | } 185 | public static boolean isExists(String dir ,String fileName){ 186 | File directory = null; 187 | File file = null; 188 | boolean ret =false; 189 | try { 190 | file = new File(fileName); 191 | directory = new File(dir); 192 | ret = directory.exists() && file.exists(); 193 | } catch (Exception e) { 194 | e.printStackTrace(); 195 | ret =false; 196 | MyLogger.logger.log(Level.INFO, "isExists Exception", e); 197 | 198 | } 199 | return ret; 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/util/DataTypeUtil.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/18814182640/UDS-/40a6718bd852723507a7afeb66e3f0c17da61bea/EV_XPSlaveTestSystem/src/user/util/DataTypeUtil.java -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | package user.util; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Calendar; 6 | import java.util.Date; 7 | 8 | public class DateUtil { 9 | public static final String DATA_FORMAT="yyyy-MM-dd"; 10 | public static final String DATA_FULL_FORMAT="yyyy-MM-dd HH:mm:ss"; 11 | public static final String DATA_FULL_FORMAT2="yyyy-MM-dd HH_mm_ss"; 12 | 13 | public static Date getFormatDate(String date){ 14 | //System.out.println("date = " + date); 15 | 16 | try { 17 | SimpleDateFormat sdf = new SimpleDateFormat(DATA_FORMAT); 18 | if(date!=null){ 19 | return sdf.parse(date); 20 | } 21 | } catch (ParseException e) { 22 | e.printStackTrace(); 23 | } 24 | return null; 25 | } 26 | 27 | public static String formatDate(Date date){ 28 | try { 29 | SimpleDateFormat sdf = new SimpleDateFormat(DATA_FORMAT); 30 | if(date!=null){ 31 | return sdf.format(date); 32 | } 33 | } catch (Exception e) { 34 | //e.printStackTrace(); 35 | } 36 | return null; 37 | } 38 | 39 | 40 | public static String formatFullDate(Date date){ 41 | try { 42 | SimpleDateFormat sdf = new SimpleDateFormat(DATA_FULL_FORMAT); 43 | if(date!=null){ 44 | return sdf.format(date); 45 | } 46 | } catch (Exception e) { 47 | // TODO Auto-generated catch block 48 | e.printStackTrace(); 49 | } 50 | return null; 51 | } 52 | public static String formatFullDate2(Date date){ 53 | try { 54 | SimpleDateFormat sdf = new SimpleDateFormat(DATA_FULL_FORMAT2); 55 | if(date!=null){ 56 | return sdf.format(date); 57 | } 58 | } catch (Exception e) { 59 | // TODO Auto-generated catch block 60 | e.printStackTrace(); 61 | } 62 | return null; 63 | } 64 | public static Date getFormatFullDate(String date){ 65 | try { 66 | SimpleDateFormat sdf = new SimpleDateFormat(DATA_FULL_FORMAT); 67 | if(date!=null){ 68 | return sdf.parse(date); 69 | } 70 | } catch (ParseException e) { 71 | // TODO Auto-generated catch block 72 | e.printStackTrace(); 73 | } 74 | return null; 75 | } 76 | 77 | 78 | public static int getYear(Date date){ 79 | try { 80 | Calendar cal=Calendar.getInstance(); 81 | cal.setTime(date); 82 | 83 | return cal.get(Calendar.YEAR); 84 | } catch (Exception e) { 85 | // TODO Auto-generated catch block 86 | e.printStackTrace(); 87 | } 88 | return 0; 89 | } 90 | 91 | public static int getMonth(Date date){ 92 | try { 93 | Calendar cal=Calendar.getInstance(); 94 | cal.setTime(date); 95 | return cal.get(Calendar.MONTH)+1; 96 | } catch (Exception e) { 97 | // TODO Auto-generated catch block 98 | e.printStackTrace(); 99 | } 100 | return 0; 101 | } 102 | 103 | public static int getDate(Date date){ 104 | try { 105 | Calendar cal=Calendar.getInstance(); 106 | cal.setTime(date); 107 | return cal.get(Calendar.DAY_OF_MONTH); 108 | } catch (Exception e) { 109 | e.printStackTrace(); 110 | } 111 | return 0; 112 | } 113 | 114 | 115 | public static int getHour(Date date){ 116 | try { 117 | Calendar cal=Calendar.getInstance(); 118 | cal.setTime(date); 119 | return cal.get(Calendar.HOUR_OF_DAY); 120 | } catch (Exception e) { 121 | // TODO Auto-generated catch block 122 | e.printStackTrace(); 123 | } 124 | return 0; 125 | } 126 | 127 | public static int getMinute(Date date){ 128 | try { 129 | Calendar cal=Calendar.getInstance(); 130 | cal.setTime(date); 131 | return cal.get(Calendar.MINUTE); 132 | } catch (Exception e) { 133 | // TODO Auto-generated catch block 134 | e.printStackTrace(); 135 | } 136 | return 0; 137 | } 138 | public static int getSecond(Date date){ 139 | try { 140 | Calendar cal=Calendar.getInstance(); 141 | cal.setTime(date); 142 | return cal.get(Calendar.SECOND); 143 | } catch (Exception e) { 144 | // TODO Auto-generated catch block 145 | e.printStackTrace(); 146 | } 147 | return 0; 148 | } 149 | public static long sum(Date d1,Date d2){ 150 | long reval = d1.getTime() + d2.getTime(); 151 | return reval; 152 | } 153 | public static long sub(Date d1,Date d2){ 154 | long reval = d1.getTime() - d2.getTime(); 155 | return Math.abs(reval); 156 | } 157 | 158 | public static int getMonth(long millis){ 159 | Calendar cl = Calendar.getInstance(); 160 | cl.setTimeInMillis(Math.abs(millis)); 161 | int reval = (cl.get(Calendar.YEAR)-1970)*12 + cl.get(Calendar.MONTH); 162 | return reval; 163 | } 164 | public static long getDay(long millis){ 165 | return Math.abs(millis)/(1000*3600*24l); 166 | } 167 | public static int getYear(long millis){ 168 | Calendar cl = Calendar.getInstance(); 169 | cl.setTimeInMillis(Math.abs(millis)); 170 | int reval = (cl.get(Calendar.YEAR)-1970); 171 | return reval; 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/util/MyLogger.java: -------------------------------------------------------------------------------- 1 | package user.util; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | import java.util.logging.FileHandler; 8 | import java.util.logging.Level; 9 | import java.util.logging.Logger; 10 | import java.util.logging.SimpleFormatter; 11 | public class MyLogger { 12 | private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//new SimpleDateFormat("yyyy-MM-dd_HHmmss") ; 13 | 14 | private static final String LOG_FOLDER_NAME = "LoggerFile"; 15 | 16 | private static final String LOG_FILE_SUFFIX = ".log"; 17 | 18 | public final static Logger logger = setLoggerHanlder(Logger.getLogger("my.logger")); 19 | private synchronized static String getLogFilePath() { 20 | StringBuffer logFilePath = new StringBuffer(); 21 | logFilePath.append(System.getProperty("user.dir")); 22 | logFilePath.append(File.separatorChar); 23 | logFilePath.append(LOG_FOLDER_NAME); 24 | // System.out.println("logFilePath.toString():" + logFilePath.toString()); 25 | File file = new File(logFilePath.toString()); 26 | if (!file.exists()) 27 | file.mkdir(); 28 | logFilePath.append(File.separatorChar); 29 | logFilePath.append(sdf.format(new Date())); 30 | logFilePath.append(LOG_FILE_SUFFIX); 31 | 32 | return logFilePath.toString(); 33 | } 34 | 35 | public synchronized static Logger setLoggerHanlder(Logger logger) { 36 | return setLoggerHanlder(logger, Level.ALL); 37 | } 38 | 39 | public synchronized static Logger setLoggerHanlder(Logger logger, 40 | Level level) { 41 | 42 | FileHandler fileHandler = null; 43 | try { 44 | //文件日志内容标记为可追加 45 | fileHandler = new FileHandler(getLogFilePath(), true); 46 | 47 | //以文本的形式输出 48 | fileHandler.setFormatter(new SimpleFormatter()); 49 | 50 | logger.addHandler(fileHandler); 51 | logger.setLevel(level); 52 | 53 | 54 | 55 | } catch (SecurityException e) { 56 | logger.severe(populateExceptionStackTrace(e)); 57 | } catch (IOException e) { 58 | logger.severe(populateExceptionStackTrace(e)); 59 | } 60 | return logger; 61 | } 62 | 63 | private synchronized static String populateExceptionStackTrace(Exception e) { 64 | StringBuilder sb = new StringBuilder(); 65 | sb.append(e.toString()).append("\n"); 66 | for (StackTraceElement elem : e.getStackTrace()) { 67 | sb.append("\tat ").append(elem).append("\n"); 68 | } 69 | return sb.toString(); 70 | } 71 | } -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/util/MyQueue.java: -------------------------------------------------------------------------------- 1 | package user.util; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | public class MyQueue { 7 | private List queue; 8 | private int maxSize=-1; 9 | 10 | public MyQueue(){ 11 | queue=new LinkedList(); 12 | } 13 | 14 | public MyQueue(int maxsize){ 15 | queue=new LinkedList(); 16 | maxSize=maxsize; 17 | } 18 | 19 | public synchronized T get(){ 20 | try { 21 | while(queue.size()<=0){ 22 | this.wait(); 23 | } 24 | } catch (InterruptedException e) { 25 | e.printStackTrace(); 26 | } 27 | return queue.remove(0); 28 | } 29 | 30 | 31 | public synchronized T get(int timeOut){ 32 | long start=System.currentTimeMillis(); 33 | try { 34 | while(queue.size()<=0&&(System.currentTimeMillis()-start) o,int priority){ 56 | if(queue.size()=len){ 22 | return str; 23 | } 24 | StringBuffer sb=new StringBuffer(); 25 | for(int i=0;i=len){ 42 | return str; 43 | } 44 | StringBuffer sb=new StringBuffer(); 45 | sb.append(str); 46 | for(int i=0;i<(len-str.length());i++){ 47 | sb.append(pad); 48 | } 49 | return sb.toString(); 50 | } 51 | 52 | public static void main(String[] args){ 53 | String name="sunwoda"; 54 | String a=lpad(name," ",21); 55 | System.out.println(a.length()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/util/TextVerifyListener.java: -------------------------------------------------------------------------------- 1 | package user.util; 2 | 3 | import org.eclipse.swt.events.VerifyEvent; 4 | import org.eclipse.swt.events.VerifyListener; 5 | import org.eclipse.swt.widgets.Text; 6 | 7 | public class TextVerifyListener implements VerifyListener { 8 | //private int max=1,min=0; 9 | 10 | private int len=3; 11 | public TextVerifyListener() { 12 | super(); 13 | } 14 | public TextVerifyListener(int len) { 15 | super(); 16 | this.len = len; 17 | } 18 | private String getValue(VerifyEvent e){ 19 | if(e.getSource() instanceof Text){ 20 | Text text = (Text)e.getSource(); 21 | return text.getText(); 22 | } 23 | return null; 24 | } 25 | private Integer getFullValue(VerifyEvent e){ 26 | String value = null; 27 | 28 | try{ 29 | value = getValue(e); 30 | if(value!=null){ 31 | return Integer.parseInt(value + e.text); 32 | } 33 | 34 | }catch(NumberFormatException e1 ){ 35 | e1.printStackTrace(); 36 | } 37 | return null; 38 | } 39 | @Override 40 | public void verifyText(VerifyEvent e) { 41 | 42 | boolean b = false; 43 | Text text = null; 44 | String str =""; 45 | if(e.widget instanceof Text){ 46 | text = (Text)e.widget; 47 | str = text.getText()+e.text; 48 | } 49 | System.out.println("text.getText() = "+text.getText() + " , e.text = " + e.text ); 50 | 51 | if("0123456789".indexOf(e.text) >= 0 &&str.length()<=len){ 52 | b = true; 53 | } 54 | 55 | e.doit = b; 56 | return; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/src/user/util/TiCommandCompare.java: -------------------------------------------------------------------------------- 1 | package user.util; 2 | 3 | import java.util.Comparator; 4 | 5 | import user.model.DataRow; 6 | 7 | public class TiCommandCompare implements Comparator{ 8 | 9 | @Override 10 | public int compare(DataRow o1, DataRow o2) { 11 | try { 12 | int subIndex1 = 0 ,index1 = 0 , index2 = 0 ,subIndex2 = 0 ; 13 | subIndex1 =o1.getSubIndex(); 14 | index1=o1.getIndex(); 15 | index2 = o2.getIndex(); 16 | subIndex2 = o2.getSubIndex(); 17 | 18 | int id1=index1*10000+subIndex1; 19 | int id2=index2*10000+ subIndex2; 20 | if(id1-id2<0){ 21 | return -1; 22 | }else if(id1-id2==0){ 23 | return 0; 24 | }else{ 25 | return 1; 26 | } 27 | } catch (Exception e) { 28 | System.out.println(" o1.getvarname = " + o1.getVarName() + " , o1.getvarname = " + o1.getVarName()); 29 | e.printStackTrace(); 30 | } 31 | return 0; 32 | } 33 | private int parseInt(String str){ 34 | int ret = 0 ; 35 | try 36 | { 37 | ret = Integer.parseInt(str); 38 | }catch(Exception e ){ 39 | ret = 0 ; 40 | } 41 | return ret; 42 | } 43 | } -------------------------------------------------------------------------------- /EV_XPSlaveTestSystem/testType.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Mon Nov 07 14:54:56 CST 2016 3 | testType=S2E_BMU12S 4 | --------------------------------------------------------------------------------