Subversion Repositories FlightCtrl

Rev

Rev 181 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 181 Rev 208
Line 26... Line 26...
26
    public String  err_log="none";
26
    public String  err_log="none";
Line 27... Line 27...
27
 
27
 
Line 28... Line -...
28
 
-
 
-
 
28
 
29
    public final int MAX_DEVICES=10;
29
    public final int MAX_DEVICES=10;
30
 
30
 
31
    public RemoteDevice[] remote_devices;
31
 
Line -... Line 32...
-
 
32
    public int remote_device_count=0;  
-
 
33
    public String[] remote_device_name;
-
 
34
    public String[] remote_device_mac;
-
 
35
 
-
 
36
 
-
 
37
    public void search_again()
-
 
38
    {
-
 
39
        try
-
 
40
            {
-
 
41
                remote_device_count=0;          
-
 
42
                searching=true;
-
 
43
                m_DscrAgent.startInquiry(DiscoveryAgent.GIAC,this);
-
 
44
            }
-
 
45
        catch (BluetoothStateException ex)
-
 
46
            {
-
 
47
                error=true;
-
 
48
                err_log+="Problem in searching the blue tooth devices\n" + ex;
-
 
49
               
32
    public int remote_device_count=0;  
50
            }
33
    public String[] remote_device_name;
51
       
Line 34... Line -...
34
    public String[] remote_device_mac;
-
 
35
 
52
 
36
 
53
    }
Line 37... Line -...
37
    public BTSearcher()
-
 
-
 
54
 
38
    {
55
    public BTSearcher()
39
 
56
    {
40
        remote_devices=new RemoteDevice[MAX_DEVICES];
57
 
41
        remote_device_name=new String[MAX_DEVICES];
58
        remote_device_name=new String[MAX_DEVICES];
42
        remote_device_mac=new String[MAX_DEVICES];
59
        remote_device_mac=new String[MAX_DEVICES];
Line 43... Line -...
43
 
-
 
44
        remote_device_count=0;          
60
 
45
        try
61
 
46
            {
62
        try
47
                //First get the local device and obtain the discovery agent. 
63
            {
48
                m_LclDevice = LocalDevice.getLocalDevice();
64
                //First get the local device and obtain the discovery agent. 
Line 49... Line 65...
49
                m_DscrAgent=  m_LclDevice.getDiscoveryAgent();
65
                m_LclDevice = LocalDevice.getLocalDevice();
50
     
-
 
-
 
66
                m_DscrAgent=  m_LclDevice.getDiscoveryAgent();
51
                m_DscrAgent.startInquiry(DiscoveryAgent.GIAC,this);
67
     
Line 52... Line 68...
52
            }
68
            }
Line 53... Line -...
53
        catch (BluetoothStateException ex)
-
 
54
            {
-
 
55
                error=true;
-
 
56
                err_log+="Problem in searching the blue tooth devices\n" + ex;
-
 
57
               
-
 
Line 58... Line -...
58
            }
-
 
59
       
-
 
60
    }
-
 
61
 
-
 
62
 
-
 
63
    public void inquiryCompleted(int transID) {
-
 
64
 
69
        catch (BluetoothStateException ex)
65
        try {
70
            {
Line 66... Line 71...
66
            for(int i=0;i<remote_device_count;i++)
71
                error=true;
Line 83... Line 88...
83
    {
88
    {
84
        try
89
        try
85
            {
90
            {
86
                if (remote_device_count!=(MAX_DEVICES-1))
91
                if (remote_device_count!=(MAX_DEVICES-1))
87
                    {
92
                    {
-
 
93
 
-
 
94
                        remote_device_name[remote_device_count]=btDevice.getFriendlyName(true);
88
                        remote_devices[remote_device_count]=btDevice;
95
                        remote_device_mac[remote_device_count]=btDevice.getBluetoothAddress();
89
                        remote_device_count++;
96
                        remote_device_count++;
90
                    }
97
                    }
91
            }
98
            }
92
        catch (Exception e)
99
        catch (Exception e)
93
            {
100
            {