File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes using indexOf(), how to just take the RSSI value and display it ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "using indexOf(), how to just take the RSSI value and display it ?" Watch "using indexOf(), how to just take the RSSI value and display it ?" New topic
Author

using indexOf(), how to just take the RSSI value and display it ?

motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
TYPE=WIFI|TIME=1263867796390|ID=00:1e:c1:4c:c5:ce|NAME=3Com|RSSI=-87|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867796390|ID=00:1f:27:55:f7:70|NAME=USMHotspot|RSSI=-76|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867796390|ID=00:24:c3:31:0f:e0|NAME=csusm|RSSI=-92|WEP=true|INFR=true


The above is part of log file.
Im new in Java, so using indexOf(), how can i just take the RSSI value and display it ?
How to calculate the average signal strength for different wireless access point ?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18997
    
  40


Why don't you take a look at all the methods of the java.lang.String class? Surely, there are other methods along with indexOf() that could be useful?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
Henry Wong wrote:
Why don't you take a look at all the methods of the java.lang.String class? Surely, there are other methods along with indexOf() that could be useful?

Henry

TYPE=WIFI|TIME=1263867778390|ID=00:24:c3:31:2b:e0|NAME=csusm|RSSI=-93|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:12:17:7b:33:04|NAME=csusm|RSSI=-80|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1f:27:55:f7:70|NAME=USMHotspot|RSSI=-70|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1e:13:ee:3e:40|NAME=USMHotspot|RSSI=-85|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:24:c3:31:b8:80|NAME=csusm|RSSI=-91|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:90:4c:60:04:02|NAME=csusm|RSSI=-94|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1b:0d:d6:6d:50|NAME=USMHotspot|RSSI=-70|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1a:a2:dc:a0:60|NAME=USMHotspot|RSSI=-86|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1e:c1:4c:c5:ce|NAME=3Com|RSSI=-94|WEP=true|INFR=true

Acually how can i read the data line by line and categorize them with ID and its own RSSI value, after that i need to calculate the average value for specific ID ?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18997
    
  40

motress zlting wrote:
Acually how can i read the data line by line and categorize them with ID and its own RSSI value, after that i need to calculate the average value for specific ID ?



To read the file into your program, you can start with the IO tutorial....

http://java.sun.com/docs/books/tutorial/essential/io/

Once you have the data read, you can either parse it with methods from the java.lang.String class, mention earlier. Or if you are more adventurous, you can take a look at the regular expressions tutorial...

http://java.sun.com/docs/books/tutorial/essential/regex/

And once you parsed the values, you can take a look at the java.lang.Integer class to convert it to values that you can use to calculate the averages.

Henry
motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
Henry Wong wrote:
motress zlting wrote:
Acually how can i read the data line by line and categorize them with ID and its own RSSI value, after that i need to calculate the average value for specific ID ?



To read the file into your program, you can start with the IO tutorial....

http://java.sun.com/docs/books/tutorial/essential/io/

Once you have the data read, you can either parse it with methods from the java.lang.String class, mention earlier. Or if you are more adventurous, you can take a look at the regular expressions tutorial...

http://java.sun.com/docs/books/tutorial/essential/regex/

And once you parsed the values, you can take a look at the java.lang.Integer class to convert it to values that you can use to calculate the averages.

Henry



Actually i want to the following step :
1.scan line -> find ID -> new ID -> get ID -> scan its own RSSI value -> get RSSI value
2.scan line -> find next ID -> match previous ID
-> if same with previous ID -> get the RSSI value
-> if not same -> create a place to store new ID and its RSSI value
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: using indexOf(), how to just take the RSSI value and display it ?