From 73e1328d7046ff37400bbc48f4d9d66a3076358b Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Sat, 14 Mar 2020 20:07:58 +0100 Subject: [PATCH] Branch cleaning --- build.gradle | 3 +-- .../smarthut/models/KnobDimmer.java | 6 +---- .../smarthut/websocket/HouseEndpoint.java | 24 ----------------- .../smarthut/websocket/WebSocketConfig.java | 26 ------------------- 4 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/HouseEndpoint.java delete mode 100644 src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/WebSocketConfig.java diff --git a/build.gradle b/build.gradle index 4f4082f..c7b20f6 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,6 @@ repositories { dependencies { compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final' - compile "org.springframework.boot:spring-boot-starter-websocket" implementation 'org.springframework.boot:spring-boot-starter' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-security' @@ -25,7 +24,7 @@ dependencies { implementation 'org.postgresql:postgresql' compile "io.springfox:springfox-swagger2:2.9.2" compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2' - + implementation('org.springframework.boot:spring-boot-starter-web') { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-json' } diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java index 7f4056b..0a90998 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java @@ -33,11 +33,7 @@ public class KnobDimmer extends Dimmer { dl.setIntensity((dl.getIntensity() + 5) % 105); } else { dl.setIntensity(dl.getIntensity() + (5 - remainder)); - if (dl.getIntensity() == 0) { - dl.setIntensity(100); - } else { - dl.setIntensity(dl.getIntensity() - 5); - } + dl.setIntensity((dl.getIntensity() - 5) % 105); } } } diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/HouseEndpoint.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/HouseEndpoint.java deleted file mode 100644 index 2e6de11..0000000 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/HouseEndpoint.java +++ /dev/null @@ -1,24 +0,0 @@ -package ch.usi.inf.sa4.sanmarinoes.smarthut.websocket; - -import java.io.IOException; -import javax.websocket.*; -import javax.websocket.server.ServerEndpoint; - -@ServerEndpoint( - value = - "theEndpointMustHaveAShotNameBecauseAndreaBritesMartesMaronesIsAVeryNiceProgrammerThatMustTypeThisByHand.exe") // DONE: choose path -public class HouseEndpoint { - private Session session; - - @OnOpen - public void onOpen(Session session) throws IOException {} - - @OnMessage - public void onMessage() throws IOException {} - - @OnClose - public void onClose() {} - - @OnError - public void onError() {} -} diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/WebSocketConfig.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/WebSocketConfig.java deleted file mode 100644 index d5ea39a..0000000 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/websocket/WebSocketConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -package ch.usi.inf.sa4.sanmarinoes.smarthut.websocket; - -import org.springframework.context.annotation.Configuration; -import org.springframework.messaging.simp.config.MessageBrokerRegistry; -import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; -import org.springframework.web.socket.config.annotation.StompEndpointRegistry; -import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; - -@Configuration -@EnableWebSocketMessageBroker -public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { - - @Override - public void registerStompEndpoints(StompEndpointRegistry registry) { - registry.addEndpoint("/house") - .setAllowedOrigins("domainURL") - .withSockJS(); // TODO: set domain URL - } - - /** Creates message brokers in-memory to send and receive messages for topic and queue route */ - @Override - public void configureMessageBroker(MessageBrokerRegistry config) { - config.enableSimpleBroker("/topic/", "/queue/"); - config.setApplicationDestinationPrefixes("/app"); - } -}