Rev 208 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 208 | Rev 231 | ||
---|---|---|---|
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 | 31 | public RemoteDevice[] remote_devices; |
|
Line 32... | Line -... | ||
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 | - | ||
50 | } |
32 | public int remote_device_count=0; |
51 | 33 | public String[] remote_device_name; |
|
Line -... | Line 34... | ||
- | 34 | public String[] remote_device_mac; |
|
52 | 35 | ||
53 | } |
36 | |
Line 54... | Line -... | ||
54 | - | ||
- | 37 | public BTSearcher() |
|
55 | public BTSearcher() |
38 | { |
56 | { |
39 | |
57 | 40 | remote_devices=new RemoteDevice[MAX_DEVICES]; |
|
58 | remote_device_name=new String[MAX_DEVICES]; |
41 | remote_device_name=new String[MAX_DEVICES]; |
59 | remote_device_mac=new String[MAX_DEVICES]; |
42 | remote_device_mac=new String[MAX_DEVICES]; |
Line -... | Line 43... | ||
- | 43 | ||
60 | 44 | remote_device_count=0; |
|
61 | 45 | try |
|
62 | try |
46 | { |
63 | { |
47 | //First get the local device and obtain the discovery agent. |
64 | //First get the local device and obtain the discovery agent. |
48 | m_LclDevice = LocalDevice.getLocalDevice(); |
Line 65... | Line 49... | ||
65 | m_LclDevice = LocalDevice.getLocalDevice(); |
49 | m_DscrAgent= m_LclDevice.getDiscoveryAgent(); |
66 | m_DscrAgent= m_LclDevice.getDiscoveryAgent(); |
- | |
- | 50 | ||
67 | 51 | m_DscrAgent.startInquiry(DiscoveryAgent.GIAC,this); |
|
Line 68... | Line 52... | ||
68 | } |
52 | } |
Line -... | Line 53... | ||
- | 53 | catch (BluetoothStateException ex) |
|
- | 54 | { |
|
- | 55 | error=true; |
|
- | 56 | err_log+="Problem in searching the blue tooth devices\n" + ex; |
|
- | 57 | ||
Line -... | Line 58... | ||
- | 58 | } |
|
- | 59 | ||
- | 60 | } |
|
- | 61 | ||
- | 62 | ||
- | 63 | public void inquiryCompleted(int transID) { |
|
69 | catch (BluetoothStateException ex) |
64 | |
70 | { |
65 | try { |
Line -... | Line 66... | ||
- | 66 | for(int i=0;i<remote_device_count;i++) |
|
- | 67 | { |
|
- | 68 | remote_device_name[i]=remote_devices[i].getFriendlyName(true); |
|
- | 69 | remote_device_mac[i]=remote_devices[i].getBluetoothAddress(); |
|
71 | error=true; |
70 | |
72 | err_log+="Problem in searching the blue tooth devices\n" + ex; |
71 | } |
73 | 72 | } |
|
74 | } |
73 | catch (Exception e) |
75 | search_again(); |
74 | { |
76 | } |
75 | err_log+="Problem in searching the blue tooth devices"; |
77 | 76 | } |
|
78 | - | ||
79 | public void inquiryCompleted(int transID) { |
- | |
80 | 77 | searching=false; |
|
81 | 78 | } |
|
82 | searching=false; |
79 | |
83 | } |
80 | |
84 | 81 | public void search_again() |
|
85 | 82 | { |