khaled001
Messages postés156Date d'inscriptionmardi 19 août 2008StatutMembreDernière intervention 8 août 2016
-
27 nov. 2012 à 10:02
oumaya -
26 août 2013 à 15:29
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 :
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 :
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();
}
}
voila le résultat de l'éxécution sous eclipse :
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
khaled001
Messages postés156Date d'inscriptionmardi 19 août 2008StatutMembreDernière intervention 8 août 2016 27 nov. 2012 à 12:11
j'ai réussi a lancer le programme en mode console (dans un terminale ) j'ai juste créé un dossier nommé blueJava puis mis tout les fichiers java du programme de teste plus la bibliotheque bluecove mais j'ai tjrs le méme probleme :
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
J'ai fais cette commande : java EchoServer --> tjrs méme probleme
et ensuite ça : sudo java EchoServer --> ça m'a affiché ça :
khaled001
Messages postés156Date d'inscriptionmardi 19 août 2008StatutMembreDernière intervention 8 août 2016 27 nov. 2012 à 16:27
c bon j'ai réussi sous shell (terminal linux) en tapant "sudo su" puis l'execution du programme la liaison bluetooth a marché avec mon téléphone portable nokia
26 août 2013 à 15:29
comment puisse-je lancer java avec un sudo ?