Commit 02eeb6f984a35cd2088e336bdefb92a1d22d1416

Authored by xiemeng
1 parent 6c5745bf

update 0315

... ... @@ -98,6 +98,7 @@ struct TTYInfoStruct
98 98 DWORD rgbBGColor ;
99 99 BOOL DownloadReday;
100 100 DWORD tickcountFinish; //Íê³ÉÏÂÔØµÄʱ¼ä
  101 + BYTE unOpenedPortAry[255];
101 102 char szFileName[MAX_PATH];
102 103 #endif
103 104 } TTYInfo;
... ...
... ... @@ -78,7 +78,7 @@ BEGIN
78 78 CONTROL "No Writing",IDC_NOWRITINGCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,89,58,10
79 79 CONTROL "No Status",IDC_NOSTATUSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,109,54,10
80 80 CONTROL "No Events",IDC_NOEVENTSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,99,68,10
81   - PUSHBUTTON "Send",IDC_SENDBTN,100,0,50,12
  81 + PUSHBUTTON "Send",IDC_SENDBTN,100,0,50,12,NOT WS_VISIBLE
82 82 EDITTEXT IDC_STATIC_BINPATH,0,13,192,12,ES_AUTOHSCROLL | ES_READONLY
83 83 PUSHBUTTON "select file",IDC_BUTTON2_SEC_BINFILE,50,0,50,12
84 84 END
... ...
... ... @@ -4,6 +4,7 @@
4 4 Version="9.00"
5 5 Name="MyMTTTY"
6 6 ProjectGUID="{DB698040-BB0E-4432-BEF5-5101ED44C10B}"
  7 + RootNamespace="MyMTTTY"
7 8 TargetFrameworkVersion="0"
8 9 >
9 10 <Platforms>
... ... @@ -57,7 +58,7 @@
57 58 AssemblerListingLocation=".\Release/"
58 59 ObjectFile=".\Release/"
59 60 ProgramDataBaseFileName=".\Release/"
60   - WarningLevel="3"
  61 + WarningLevel="1"
61 62 SuppressStartupBanner="true"
62 63 />
63 64 <Tool
... ... @@ -73,7 +74,7 @@
73 74 />
74 75 <Tool
75 76 Name="VCLinkerTool"
76   - OutputFile=".\Release/MyMTTTY.exe"
  77 + OutputFile=".\Release/BlueFlashTool.exe"
77 78 LinkIncremental="1"
78 79 SuppressStartupBanner="true"
79 80 ProgramDatabaseFile=".\Release/MyMTTTY.pdb"
... ... @@ -165,7 +166,7 @@
165 166 />
166 167 <Tool
167 168 Name="VCLinkerTool"
168   - OutputFile=".\Debug/MyMTTTY.exe"
  169 + OutputFile=".\Debug/BlueFlashTool.exe"
169 170 LinkIncremental="2"
170 171 SuppressStartupBanner="true"
171 172 GenerateDebugInformation="true"
... ...
... ... @@ -19,6 +19,7 @@
19 19 -----------------------------------------------------------------------------*/
20 20
21 21 #include <windows.h>
  22 +#include <commctrl.h>
22 23 #include "mttty.h"
23 24
24 25 #define AMOUNT_TO_READ 512
... ... @@ -239,6 +240,8 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV)
239 240 strncpy(ascbufpercent, pchar_percent + 12, 2);
240 241 Flashed_percent = atoi(ascbufpercent);
241 242 sprintf(ascbufpercent, "下载已完成%d\r\n", Flashed_percent);
  243 + PostMessage(GetDlgItem(ghWndStatusDlg, IDC_TRANSFERPROGRESS), PBM_SETPOS, Flashed_percent, 0);
  244 +
242 245 OutputABuffer(hTTY, ascbufpercent);
243 246 TTYInfo.DownloadReday = FALSE;
244 247 }
... ...
... ... @@ -78,13 +78,9 @@ BOOL CALLBACK GetADWORDProc( HWND, UINT, WPARAM, LPARAM );
78 78 DCB dcbTemp;
79 79
80 80 #ifdef __OPTEK_EDIT__
81   -char * szBaud[] = {
82   - "115200*1", "115200*2", "115200*4", "115200*8"
83   -};
  81 +//char * szBaud[] = { "115200*1", "115200*2", "115200*4", "115200*8" };
84 82
85   -DWORD BaudTable[] = {
86   - (CBR_115200)*1,(CBR_115200)*2,(CBR_115200)*4,(CBR_115200)*8
87   -} ;
  83 +//DWORD BaudTable[] = { (CBR_115200)*1,(CBR_115200)*2,(CBR_115200)*4,(CBR_115200)*8 } ;
88 84
89 85 #else
90 86 char * szBaud[] = {
... ... @@ -277,20 +273,15 @@ void UpdateTTYInfo()
277 273 char gszPort_Temp[20] = {0};
278 274 #endif
279 275 GetDlgItemText(ghWndToolbarDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort));
280   -#ifdef __OPTEK_EDIT__
  276 +#if 0//def __OPTEK_EDIT__
281 277 if (gszPort[3] - '0' > 0 && gszPort[4] - '0' > 0)
282 278 {
283 279 wsprintf(gszPort_Temp,"\\\\.\\%s%d","COM", (gszPort[3] - '0' )*10 + (gszPort[4] - '0'));
284 280 memset(gszPort, 20, sizeof(char));
285 281 strcpy(gszPort, gszPort_Temp);
286   - /*MessageBox(NULL, gszPort, "TEST---", MB_OK);*/
287 282 }
288 283 #endif
289   - BAUDRATE(TTYInfo) = GetdwTTYItem( ghWndToolbarDlg,
290   - IDC_BAUDCOMBO,
291   - szBaud,
292   - BaudTable,
293   - sizeof(BaudTable)/sizeof(BaudTable[0]));
  284 + //BAUDRATE(TTYInfo) = GetdwTTYItem( ghWndToolbarDlg, IDC_BAUDCOMBO, szBaud, BaudTable, sizeof(BaudTable)/sizeof(BaudTable[0]));
294 285
295 286 PARITY(TTYInfo) = GetbTTYItem( ghWndToolbarDlg,
296 287 IDC_PARITYCOMBO,
... ... @@ -539,13 +530,13 @@ BOOL SettingsDlgInit( HWND hDlg )
539 530 {
540 531 char szBuffer[ MAXLEN_TEMPSTR ], szTemp[ MAXLEN_TEMPSTR ] ;
541 532 WORD wCount, wMaxCOM, wPosition ;
542   -#ifdef __OPTEK_EDIT__
  533 +#if 0//def __OPTEK_EDIT__
543 534 int cmdT[MAXPORTS];
544 535 #endif
545 536 wMaxCOM = MAXPORTS ;
546 537 strcpy(szTemp, "COM");
547 538
548   -#ifdef __OPTEK_EDIT__
  539 +#if 0//def __OPTEK_EDIT__
549 540 memset(cmdT,0,sizeof(cmdT));
550 541 EnumAllComPort(cmdT);
551 542 //for (int i=0;i<10;i++)
... ... @@ -557,7 +548,7 @@ BOOL SettingsDlgInit( HWND hDlg )
557 548 // fill port combo box and make initial selection
558 549 //
559 550 for (wCount = 0; wCount < wMaxCOM; wCount++) {
560   -#ifdef __OPTEK_EDIT__
  551 +#if 0//def __OPTEK_EDIT__
561 552 //wsprintf( szBuffer, "%s%d", (LPSTR) szTemp, wCount + 1 ) ;
562 553 if (cmdT[wCount])
563 554 {
... ... @@ -566,9 +557,14 @@ BOOL SettingsDlgInit( HWND hDlg )
566 557 (LPARAM) (LPSTR) szBuffer ) ;
567 558 }
568 559 #else
569   - wsprintf( szBuffer, "%s%d", (LPSTR) szTemp, wCount + 1 ) ;
  560 + for (wCount = 0; wCount < 255; wCount++)
  561 + {
  562 + if (TTYInfo.unOpenedPortAry[wCount] == 0)
  563 + continue;;
  564 + wsprintf( szBuffer, "%s%d", (LPSTR) szTemp, TTYInfo.unOpenedPortAry[wCount] ) ;
570 565 SendDlgItemMessage( hDlg, IDC_PORTCOMBO, CB_ADDSTRING, 0,
571 566 (LPARAM) (LPSTR) szBuffer ) ;
  567 + }
572 568 #endif
573 569 }
574 570
... ... @@ -580,10 +576,7 @@ BOOL SettingsDlgInit( HWND hDlg )
580 576 //
581 577 // fill baud combo box and make initial selection
582 578 //
583   - FillComboBox( GetDlgItem( hDlg, IDC_BAUDCOMBO ),
584   - szBaud, BaudTable,
585   - sizeof( BaudTable ) / sizeof( BaudTable[ 0 ] ),
586   - BAUDRATE( TTYInfo ) ) ;
  579 + //FillComboBox( GetDlgItem( hDlg, IDC_BAUDCOMBO ), szBaud, BaudTable, sizeof( BaudTable ) / sizeof( BaudTable[ 0 ] ), BAUDRATE( TTYInfo ) ) ;
587 580
588 581 //
589 582 // fill data bits combo box and make initial selection
... ... @@ -816,34 +809,22 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
816 809 fRet = FALSE;
817 810 break;
818 811 case IDC_BUTTON2_SEC_BINFILE:
819   -{
820   - if (strlen(TTYInfo.szFileName) == 0)
821 812 {
822   - #ifdef __OPTEK_EDIT__
823   - char * szFilter = "bin Files\0*.bin\0";
824   - #else
825   - char * szFilter = "Text Files\0*.TXT\0";
826   - #endif
  813 + char *szFilter = "bin Files\0*.bin\0";
827 814 OPENFILENAME ofn = { 0 };
828 815 ofn.lStructSize = sizeof(OPENFILENAME);
829 816 ofn.hwndOwner = ghWndTTY;
830 817 ofn.lpstrFilter = szFilter;
831 818 ofn.lpstrFile = TTYInfo.szFileName;
832 819 ofn.nMaxFile = MAX_PATH;
833   - #ifdef __OPTEK_EDIT__
834   - ofn.lpstrTitle = "Select file";
835   - #else
836   - ofn.lpstrTitle = "Send File";
837   - #endif
  820 + ofn.lpstrTitle = "Select File";
838 821 ofn.Flags = OFN_FILEMUSTEXIST;
839 822 if (!GetOpenFileName(&ofn)) break;
840 823 if (strlen(TTYInfo.szFileName) != 0)
841 824 {
842 825 SetWindowText(GetDlgItem(hWndDlg, IDC_STATIC_BINPATH), TTYInfo.szFileName);
843   - ShowWindow(GetDlgItem(hWndDlg, IDC_BUTTON2_SEC_BINFILE),0);
844   - //SetWindowText(GetDlgItem(hWndDlg, IDC_BUTTON2_SEC_BINFILE), "ÏÂÔØÈí¼þ");
  826 + //ShowWindow(GetDlgItem(hWndDlg, IDC_BUTTON2_SEC_BINFILE), 0);
845 827 }
846   -
847 828 #ifdef __OPTEK_EDIT__
848 829 UpdateStatus(TTYInfo.szFileName);
849 830 #else
... ... @@ -851,9 +832,8 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
851 832 TransferFileTextStart(TTYInfo.szFileName);
852 833 #endif
853 834 }
854   - } break;
855   -
856   -#ifdef __OPTEK_EDIT__
  835 + break;
  836 + #ifdef __OPTEK_EDIT__
857 837 case IDC_SENDBTN: // send button pressed
858 838 if (!EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_PORTCOMBO), FALSE))
859 839 {
... ... @@ -874,7 +854,7 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
874 854 }
875 855 fRet = FALSE;
876 856 break;
877   -#endif
  857 + #endif
878 858 case IDC_COMMEVENTSBTN: // comm events button pressed
879 859 DialogBox(ghInst, MAKEINTRESOURCE(IDD_COMMEVENTSDLG), ghwndMain, CommEventsProc);
880 860 fRet = FALSE;
... ...
... ... @@ -251,6 +251,8 @@ void TransferFileTextStart(LPCTSTR lpstrFileName)
251 251 HMENU hMenu;
252 252 UINT MenuFlags ;
253 253
  254 + //if (TRANSFERRING(TTYInfo)) return;
  255 +
254 256 //
255 257 // open the file
256 258 //
... ... @@ -797,7 +799,7 @@ int fileCheck(char *fData,char *dataLen)
797 799 baaddr[2] = (unsigned char)(ticks.LowPart>>16)&0x000000ff;
798 800
799 801 wsprintf(szMessage, "bt bdaddr:0x%02x%02x%02x%02x%02x%02x\r\n",baaddr[5],baaddr[4],baaddr[3],baaddr[2],baaddr[1],baaddr[0]);
800   - UpdateStatus(szMessage);
  802 + OutputABuffer(ghWndTTY, szMessage);
801 803 }
802 804 else
803 805 {
... ... @@ -928,8 +930,11 @@ DWORD WINAPI TransferThreadProc(LPVOID lpV)
928 930 // set up transfer metrics
929 931 if (!GetTransferSizes(hFileHandle, &dwPacketSize, &dwMaxPackets, &dwFileSize))
930 932 fAborting = TRUE;
931   - else {
932   - SendMessage(hWndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, dwMaxPackets+1));
  933 + else
  934 + {
  935 +
  936 + SendMessage(hWndProgress, PBM_SETRANGE32, (WPARAM)0, (LPARAM)(100));
  937 + //SendMessage(hWndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
933 938 SendMessage(hWndProgress, PBM_SETSTEP, (WPARAM) 1, 0);
934 939 SendMessage(hWndProgress, PBM_SETPOS, 0, 0);
935 940 }
... ...
... ... @@ -341,8 +341,6 @@ void WriterFile(PWRITEREQUEST pWrite)
341 341 //
342 342 // update progress indicator (even if aborting)
343 343 //
344   - if (!PostMessage(pWrite->hWndProgress, PBM_STEPIT, 0, 0))
345   - ErrorReporter("PostMessage (file transfer status)");
346 344
347 345 return;
348 346 }
... ...
Please register or login to post a comment