티스토리 뷰
        int byte_int = 0; 
        byte[] rcvByteFinal = new byte[10];  // RF카드 10자리 Byte 세팅
        private void serial_DataReceived(object sender, SerialDataReceivedEventArgs e) 
        { 
            try 
            { 
                if (!serial.IsOpen) return; // serial 오픈 확인.
                int bytes = serial.BytesToRead;
                byte[] buffer = new byte[bytes]; 
                byte[] rcvByte = new byte[bytes]; 
                serial.Read(buffer, 0, bytes); 
                Array.Copy(buffer, 0, rcvByte, 0, bytes); 
               // buffer 0 위치부터 bytes 길이만큼 rcvByte 0~bytes에 복사한다.
                Array.Clear(buffer, 0, bytes); // buffer 초기화 
                Array.Copy(rcvByte, 0, rcvByteFinal, byte_int, bytes); // rcvByteFinal에 넣고 또 놓고. 10자리까지 누적
                byte_int += bytes;  // 누적 Byte Length 
                for (int i = 0; i < bytes; i++) //메인 루프 
                { 
                    if (rcvByte[i] == 0x03) // ETX 종료 Byte를 찾는다.
                    { 
                        if (rcvByteFinal != null) 
                        { 
                            RcvText(rcvByteFinal); // 10자리 RF카드 번호를 모두 받아 왔으니 이제 카드번호를 처리한다. 
                            rcvByteFinal = null; //초기화 
                            rcvByteFinal = new byte[10]; // RF카드번호 10자리 세팅 
                            byte_int = 0; // 누적 byte Length 초기화 
                        } 
                    } 
                } 
                Array.Clear(rcvByte, 0, bytes);  // rcvByte 초기화
            } 
            catch (Exception Ex) 
            { 
                MessageBox.Show(Ex.Message);
            } 
        }
'WPF' 카테고리의 다른 글
| C# DataTable AsEnumerable Sum, Count Linq쿼리 (0) | 2022.02.14 | 
|---|---|
| C# LINQ Left join of DataTables (249) | 2022.02.09 | 
| C# Multiple Order By with LINQ (1) | 2021.06.25 | 
| Mysql Aes_Encrypt 쿼리 == C# Encrypt String(HEX) (3) | 2021.06.14 | 
| Mysql Aes_Decrypt 쿼리 == C# Decrypt String(HEX) (0) | 2021.06.14 | 
- Total
 
- Today
 
- Yesterday
 
- Linux SSH Multi Computer Join
 - ClickOnce 인증서 인증기간 변경
 - c# Encrypt / Decrypt
 - Windows IIS FTP 디렉토리 목록 오류
 - GetCellContent CheckBox Value
 - Xamarin.Ios Firebase Phone Auth
 - Xamarin reCAPTCHA
 - 연산자 뒤에 피연산자가 없습니다.
 - WPF Scrollviewer in ScrollViwer
 - Xamarin SMS OTP Send
 - Microcharts
 - C# LINQ Left join
 - Xamarin.Ios Firebase Phone SMS OTP Send
 - Xamarin Firebase Phone Auth
 - WPF Excel Export Microsoft.Office.Interop 성능향상(열 기준으로 복사)
 - Entry '' has empty native path
 - Label Text LineBreak in Xaml
 - WPF Textbox
 - Xamarin Firebase Phone User Add
 - 서버 수준의 URN 필터
 - 암호 마스터키
 - ssl_client_socket_impl.cc
 - Embeded 한글Font적용
 - Xamarin.Ios Firebase Phone User Add
 - WPF Datagrid Cell Value Change
 - SkiaSharp
 - FileStream Add Byte
 - Xamarin.Forms
 
| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 
| 23 | 24 | 25 | 26 | 27 | 28 | 29 | 
| 30 |