Hi Traud and thx for answer.
One thread was your actual posted. The other one i dont know more.
Meantime i found that i have to send a couple of commands in order to get a right answer. There are more than 10 commands i have to send i think before i can get the manufacturer and IMEI. The joke is, i tried it with a Sony Ericsson and it was a success. I got the manufacturer, model and the imei. After that i tried it with other phones. By the LG KC780 i dont got any profiles with profile browsing, i think the command isnt mandatory only optional and this LG don't support it, damn. The Samsung, here a SGH-i8510, ends with an exception (Error: Failed to read(byte[]); [10053] An established connection was aborted by the software in your host machine.) I got the profiles but to establish a HFP-Connection it came to this error after i have sent the first AT-command.
Now i am at a hard point for my software to find a good and going solution.
If you wonder why i have so many loops of lineRead. I need it to get all the answers because if i only try a lineRead after the right at-command, the stream has a answer from a at-command before, the answer is slower so i have count all answers in my sniffer to find the lineread where the right data are in. I hope you understand my english 
I know that this solution dont work, because the answers differs from phone to phone. It is actual only a solution for my own Sony Ericsson K750 phone.
Here now my actual code of the hfp-connection.
Code:
public static void main(String[] args) throws IOException, InterruptedException {
int test = ServicesSearch.element.size();
System.out.println("size: " + test);
int index = ServicesSearch.element.indexOf("BT_HFP_AG");
System.out.println("index: " + index);
String conStr = ServicesSearch.serviceFound.elementAt(index);
StreamConnection con = (StreamConnection)Connector.open(conStr);
communicate( con);
}
private static void communicate(StreamConnection con) throws InterruptedException {
try{
OutputStream out = con.openOutputStream();
InputStream in = con.openInputStream();
PrintWriter pWriter = new PrintWriter(new OutputStreamWriter(out));
BufferedReader bReader = new BufferedReader(new InputStreamReader(in));
pWriter.write("AT+BRSF=7\r"); //Retrieve AG Supported Features
pWriter.flush();
wait(1000);
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){ // my actual solution waiting for the answer of the phone
lineRead = bReader.readLine(); // to fill the stream
}
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){ // there are more answers i need so i have to got all i think
lineRead = bReader.readLine();
}
pWriter.write("AT+CIND=?\r"); //Get supported indicators
pWriter.flush();
wait(1000);
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){ //waiting for the first answer of AT+CIND=?
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){ // the second answer
lineRead = bReader.readLine();
}
pWriter.write("AT+CIND?\r");
pWriter.flush();
wait(1000);
lineRead = "";
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
pWriter.write("AT+CMER=3,0,0,1\r");
pWriter.flush();
wait(1000);
lineRead = "";
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
pWriter.write("AT+CHLD=?\r");
pWriter.flush();
wait(1000);
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
...... here are more lineRead Loops ........
.......
.......
pWriter.write("AT+CGMI\r"); // this command sends the manufacturer
pWriter.flush();
wait(500);
pWriter.write("AT+GMM\r"); //this command sends the model
pWriter.flush();
wait(500);
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
String manufacturer = lineRead;
System.out.println("Manufacturer: " + manufacturer);
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
pWriter.write("AT+GMR\r");
pWriter.flush();
wait(500);
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
String model = lineRead;
System.out.println("ModelName: " + model);
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
pWriter.write("AT+NREC=0\r");
pWriter.flush();
wait(500);
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
pWriter.write("AT+CMEE=1\r");
pWriter.flush();
wait(500);
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
pWriter.write("AT+CLIP=1\r");
pWriter.flush();
wait(500);
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
pWriter.write("AT+CGSN\r"); // this command sends the IMEI
pWriter.flush();
wait(500);
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = "";
lineRead = bReader.readLine();
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
// System.out.println("AG: " + lineRead);
pWriter.write("AT+CCWA=1\r");
pWriter.flush();
wait(500);
// lineRead += bReader.readLine();
pWriter.write("AT+CMGF=0\r");
pWriter.flush();
wait(500);
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
lineRead = null;
while(lineRead == null || lineRead.isEmpty()){
lineRead = bReader.readLine();
}
String IMEI = lineRead;
System.out.println("IMEI: " + IMEI);
out.close(); in.close(); con.close();
}
catch(IOException ioe){
System.out.println("Error: " + ioe.getMessage());
try {
con.close();
} catch (IOException ex) {
Logger.getLogger(HFPConnection.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
I know that this is a bad written code but i am learning actual java and in this case i have often no idea how i can write the right code or routines.
Greetings
Skywalker