Salut
Voila pour mon projet de fin d'étude je cherche a travaillé avec l'api bluecove (technologie bluetooth en java) et J2ME vous l'avez deviné je cherche a faire un contacte pc portable et téléphone nokia via le bluetooth
alors voila je vous expose d'abord mon materiel:
pc portable hp processeur duel core ,200 giga de disque dure ,2 giga de rame avec os ubuntu 10.10 mit a jour et et j'ai installé le driver bluetooth que ubuntu m'a recommandé bref j'ai suivis ce petit cours américain :
http://myexp101.wordpress.com/2011/1...-ubuntu-linux/
pour installé la bibliotheque bluecove sur ubuntu puis j'ai testé un petit programme java:
http://www.miniware.net/mobile/programs/EchoServer.java
pour voir que le bluetooth est bien activé et qu'il puisse détécté la presence de téléphone portable nokia
j'ai créé un projet de teste sous eclipse et j'ai intégré la bibliotheque bluecove a mon projet bref voila le programme :
voila le résultat de l'éxécution sous eclipse :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 import java.io.*; import javax.bluetooth.*; import javax.microedition.io.*; public class EchoServer { public final UUID uuid = new UUID( //the uid of the service, it has to be unique, "27012f0c68af4fbf8dbe6bbaf7aa432a", false); //it can be generated randomly public final String name = "Echo Server"; //the name of the service public final String url = "btspp://localhost:" + uuid //the service url + ";name=" + name + ";authenticate=false;encrypt=false;"; LocalDevice local = null; StreamConnectionNotifier server = null; StreamConnection conn = null; public EchoServer() { try { System.out.println("Setting device to be discoverable..."); local = LocalDevice.getLocalDevice(); local.setDiscoverable(DiscoveryAgent.GIAC); System.out.println("Start advertising service..."); server = (StreamConnectionNotifier)Connector.open(url); System.out.println("Waiting for incoming connection..."); conn = server.acceptAndOpen(); System.out.println("Client Connected..."); DataInputStream din = new DataInputStream(conn.openInputStream()); while(true){ String cmd = ""; char c; while (((c = din.readChar()) > 0) && (c!='\n') ){ cmd = cmd + c; } System.out.println("Received " + cmd); } } catch (Exception e) {System.out.println("Exception Occured: " + e.toString());} } public static void main (String args[]){ EchoServer echoserver = new EchoServer(); } }
Avez vous une idée pour la solution du problème ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 Setting device to be discoverable... BlueCove version 2.1.1-SNAPSHOT on bluez Exception Occured: javax.bluetooth.BluetoothStateException: Bluetooth Device is not ready. [1] Operation not permitted BlueCove stack shutdown completed
Cordialement
Partager