diff --git a/app/javax.mail-api-1.4.7.jar b/app/javax.mail-api-1.4.7.jar new file mode 100644 index 0000000000000000000000000000000000000000..187cbe34841a5dbaa2aa890f436406a2fb790a27 Binary files /dev/null and b/app/javax.mail-api-1.4.7.jar differ diff --git a/app/nbproject/project.properties b/app/nbproject/project.properties index 67291becf913e173ea5f12d635d4bf2202a087da..436e6a4dbafb667dee519c8c80b33f040e04925e 100644 --- a/app/nbproject/project.properties +++ b/app/nbproject/project.properties @@ -30,13 +30,15 @@ dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= file.reference.bluecove-2.1.1-SNAPSHOT.jar=bluecove-2.1.1-SNAPSHOT.jar +file.reference.javax.mail-api-1.4.7.jar=javax.mail-api-1.4.7.jar includes=** # Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects jar.archive.disabled=true jar.compress=false javac.classpath=\ ${javafx.classpath.extension}:\ - ${file.reference.bluecove-2.1.1-SNAPSHOT.jar} + ${file.reference.bluecove-2.1.1-SNAPSHOT.jar}:\ + ${file.reference.javax.mail-api-1.4.7.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/app/src/BluetoothJavaServer/src/edu/kufpg/bluetooth/server/BluetoothThread.java b/app/src/BluetoothJavaServer/src/edu/kufpg/bluetooth/server/BluetoothThread.java index 7cba2be0fe181a418064abda20fa2ba6254d1611..db831b7738d44b3186cbcbb27dedde5f065e716f 100644 --- a/app/src/BluetoothJavaServer/src/edu/kufpg/bluetooth/server/BluetoothThread.java +++ b/app/src/BluetoothJavaServer/src/edu/kufpg/bluetooth/server/BluetoothThread.java @@ -39,6 +39,7 @@ public class BluetoothThread extends Thread { connection.getInputStream().read(payload); this.buffer = new String(payload, StandardCharsets.UTF_8); notifyObserver(); + } catch (Exception e) { System.out.println("Could not read stream" + e); } diff --git a/app/src/Vue/FXMLVue.fxml b/app/src/Vue/FXMLVue.fxml index 0a5958ce04b3bb88838afca0ee5003b8273ecf55..7266249557101b1e66cd8fa3180b1ea0aa55c8fd 100644 --- a/app/src/Vue/FXMLVue.fxml +++ b/app/src/Vue/FXMLVue.fxml @@ -12,6 +12,7 @@ <?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.RowConstraints?> +<?import javafx.scene.layout.VBox?> <?import javafx.scene.text.Font?> <GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="350.0" prefWidth="440.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Vue.FXMLVueController"> @@ -123,9 +124,10 @@ <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> </columnConstraints> <rowConstraints> - <RowConstraints maxHeight="60.0" minHeight="10.0" prefHeight="60.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="61.0" minHeight="2.333343505859375" prefHeight="44.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="135.66665649414062" minHeight="10.0" prefHeight="105.0" vgrow="SOMETIMES" /> + <RowConstraints maxHeight="63.0" minHeight="10.0" prefHeight="63.0" vgrow="SOMETIMES" /> + <RowConstraints maxHeight="92.0" minHeight="0.0" prefHeight="31.0" vgrow="SOMETIMES" /> + <RowConstraints maxHeight="135.66665649414062" minHeight="0.0" prefHeight="48.0" vgrow="SOMETIMES" /> + <RowConstraints maxHeight="135.66665649414062" minHeight="10.0" prefHeight="105.0" vgrow="SOMETIMES" /> </rowConstraints> <children> <HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="10.0"> @@ -153,9 +155,18 @@ <Font size="14.0" /> </font> </Label> - <CheckBox fx:id="arrosageAuto" mnemonicParsing="false" onAction="#clickAuto" text="Désactivé" /> + <CheckBox fx:id="arrosageAuto" mnemonicParsing="false" onAction="#clickAuto" prefHeight="22.0" prefWidth="81.0" text="Désactivé" /> </children> </HBox> + <VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" spacing="10.0" GridPane.halignment="CENTER" GridPane.rowIndex="3" GridPane.valignment="CENTER"> + <children> + <Button fx:id="buttonBluetooth" mnemonicParsing="false" onAction="#clickActivationBluetooth" text="Activation bluetooth" /> + <Label fx:id="activationMessage" text="Connection bluetooth désactivée" /> + </children> + <GridPane.margin> + <Insets bottom="10.0" top="10.0" /> + </GridPane.margin> + </VBox> </children> <GridPane.margin> <Insets left="10.0" right="10.0" /> diff --git a/app/src/Vue/FXMLVueController.java b/app/src/Vue/FXMLVueController.java index a997008bb9311025c86c5b9bf627e65320b8bc85..9af57ced11d2f91077c02a58ed456cabaf9fd7c7 100644 --- a/app/src/Vue/FXMLVueController.java +++ b/app/src/Vue/FXMLVueController.java @@ -62,24 +62,20 @@ public class FXMLVueController implements Initializable { private Button buttonAccueil; @FXML private Button buttonConfig; + @FXML + private Button buttonBluetooth; + @FXML + private Label activationMessage; private boolean isConnected = false; + private BluetoothManager bluetoothManager; + /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { - - /** - BluetoothManager bluetoothManager = new BluetoothManager(this); - bluetoothManager.launch(); - - try { - bluetoothManager.startThread(); - } catch (Exception ex) { - Logger.getLogger(FXMLVueController.class.getName()).log(Level.SEVERE, null, ex); - } - **/ + bluetoothManager = new BluetoothManager(this); //Put the gridPane Accueil visible accueil.setVisible(true); @@ -144,6 +140,25 @@ public class FXMLVueController implements Initializable { } else arrosageAuto.setText("Désactivé"); } + + @FXML + private void clickActivationBluetooth(ActionEvent event) { + + if(!this.isConnected){ + isConnected = bluetoothManager.launch(); + } + + if(isConnected){ + try { + bluetoothManager.startThread(); + this.activationMessage.setText("Connection bluetooth activée"); + this.buttonBluetooth.setDisable(true); + } catch (Exception ex) { + Logger.getLogger(FXMLVueController.class.getName()).log(Level.SEVERE, null, ex); + + } + } + } public void update(BluetoothThread t){ // MAJ LA VUE