2012-08-14 3 views
3

C#에서 응용 프로그램 장치의 현재 무선 신호 강도를 얻고 표시하는 방법이 있습니까? 타이머를 통한 연결 여부를 감지하는 응용 프로그램이 있지만 현재 신호 강도를 알아야하며 상태 표시 줄에 그래픽으로 표시해야합니다. 아래는 몇 초마다 기본 연결을 탐지하는 현재 코드입니다. 강도를 표시하려면 무엇을 추가해야합니까? 고맙습니다. 타이머 코드는 S.O. 간단하게 다운로드 managedwifi.codeplex.comWindows 폼에서 네트워크 신호 강도 가져 오기 및 표시

: 사용자 : parapura의 라지 쿠마르

private void Form1_Load(object sender, EventArgs e) 
    {         
     //create an object to hold app settings FIRST 

     appsetting apps = new appsetting(); 
     apps.getsetting(); 
     netMessage.Clear(); 

     //creates a timer for refresh rate on connectivity check 

     var timer = new Timer(); 
     timer.Tick += new EventHandler(timer_Tick); 
     timer.Interval = 2000; //2 seconds 
     timer.Start();    
    } 


    //starts the timer 
void timer_Tick(object sender, EventArgs e) 
{ 
    //if connection is not detected 
    if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() ==f 
    false) 
    { 
     //clear the buffer 
     netMessage.Clear(); 

     //turn RED indicator on and display message 
     netConnect.BackColor = Color.Red; 
     this.netMessage.Text = ("No Connection"); 
     noConn = true;//set "No connection" to true 
     conn= false; 

    } 
    else 
     //turn GREEN indicator on and display message 
     netConnect.BackColor = Color.Lime; 
     this.netMessage.Text = ("Connected"); 
     conn = true;// set connection to "true 
     noConn = false; 

      //if box is red but connection is established, turn it back to green 


      if (noConn == true && 
      System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == 
      true) 
      { 
       netConnect.BackColor = Color.Lime; 
       this.netMessage.Text = ("Connected"); 
       conn = true; 
       noConn = false; 
      } 

}    


    //need to display signal strength in a text box with color codes or status bar HERE     
+1

아마도 [이 응답 (http://stackoverflow.com/a/3274126/1220971)에서 [이 질문 (http://stackoverflow.com/questions/3273967/detect-wifi- connectivity-in-c-sharp)가 도움이 될 수 있습니다. – Bridge

답변

0

다른 질문에 대한 몇 가지 조사 및 참조 후, 나는에 주어진 오픈 소스 API를 통해 내 문제를 해결할 수 있었다 api를 클릭 한 다음 add-> csproj를 통해 프로젝트에 추가하십시오.

WlanClient 클래스에서 제공되는 'public int RSSI'를 사용하십시오.

건배