Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bsp/sbt.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"sbt","version":"1.4.3","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/Users/maximilian/Library/Java/JavaVirtualMachines/openjdk-15/Contents/Home/bin/java","-Xms100m","-Xmx100m","-classpath","/Users/maximilian/Library/Application Support/JetBrains/IdeaIC2021.2/plugins/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp"]}
{"name":"sbt","version":"1.6.2","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/home/julian/.cache/JetBrains/RemoteDev/dist/28404f7c56bdc_ideaIU-2022.2.1/jbr/bin/java","-Xms100m","-Xmx100m","-classpath","/home/julian/.config/JetBrains/RemoteDev-IU/_home_julian_Documents_Coding_PrivateHome/plugins/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=/home/julian/.config/JetBrains/RemoteDev-IU/_home_julian_Documents_Coding_PrivateHome/plugins/Scala/launcher/sbt-launch.jar"]}
15 changes: 9 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ Debian / maintainerScripts := maintainerScriptsAppendFromFile((Debian/maintaine
Postinst -> sourceDirectory.value / "debian" / "postinst"
)

lazy val akkaVersion = "2.6.17"
lazy val akkaVersion = "2.6.19"

//pi4j java wrapper for WiringPI (deprecated by author may be continued be other)
libraryDependencies ++= Seq("com.pi4j" % "pi4j-core" % "1.2","com.pi4j" % "pi4j-parent" % "1.2")
libraryDependencies ++= Seq("com.pi4j" % "pi4j-core" % "1.4","com.pi4j" % "pi4j-parent" % "1.4")

//scala Test also used by Akka
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.2" % Test

//logback logger used by Akka and scalikejdbc and the whole project
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.6"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.11"

//Akka library for Webserver with Websockets Support
libraryDependencies ++= Seq(
Expand All @@ -82,11 +82,11 @@ libraryDependencies ++= Seq(
"com.h2database" % "h2" % "1.4.200",
"org.scalikejdbc" %% "scalikejdbc-config" % "3.4.0")

libraryDependencies += "org.json4s" % "json4s-jackson_2.13" % "3.6.7"
libraryDependencies += "org.json4s" % "json4s-jackson_2.13" % "4.0.5"

libraryDependencies += "de.mkammerer" % "argon2-jvm" % "2.9.1"
libraryDependencies += "de.mkammerer" % "argon2-jvm" % "2.11"

libraryDependencies += "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.3.0"
libraryDependencies += "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.5.0"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"

Expand All @@ -98,3 +98,6 @@ libraryDependencies += "org.rogach" %% "scallop" % "4.0.4"
enablePlugins(DebianPlugin)
enablePlugins(JavaServerAppPackaging)
enablePlugins(SystemdPlugin)

//show deprecation and feature warnings
scalacOptions ++= Seq("-deprecation", "-feature")
2 changes: 1 addition & 1 deletion src/main/scala/PrivateHome/UI/Websocket/websocket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ object websocket {
*
* @param msg The message that should be send to all connections as a JSON object
*/
def broadcastMsg(msg: json4s.JObject) {
def broadcastMsg(msg: json4s.JObject): Unit = {
for (connection <- ConnectionMap.values) connection(TextMessage.Strict(compact(render(msg))))
}

Expand Down
28 changes: 14 additions & 14 deletions src/main/scala/PrivateHome/UI/console.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ object console {
* This map contains the commands their function and a help description
*/
private val commands = Map(
"help" -> REPLCommand(_ => help(), "Prints all available commands"),
"addController" -> REPLCommand(_ => addController(), "Adds a new Controller that is needed for mqttSwitches."),
"addUser" -> REPLCommand(_ => addUser(), "Adds a new User for the WebGui"),
"addSwitch" -> REPLCommand(_ => addSwitch(false), "Adds a new Switch"),
"addDimmer" -> REPLCommand(_ => addSwitch(true), "Adds a new dimmable Switch"),
"dim" -> REPLCommand(_ => dim(), "Set the dimming value of a dimmable Switch"),
"status" -> REPLCommand(_ => status(), "Show the status of Switches"),
"recreateDatabase" -> REPLCommand(_ => recreate(), "Recreates the Database and deletes all data"),
"safeCreate" -> REPLCommand(_ => safeCreate(), "Adds missing tables to the database"),
"getKey" -> REPLCommand(_ => printControllerKey(), "Displays the Key of a given Controller."),
"programController" -> REPLCommand(_ => programController(), "This will transfer the settings for a Controller"),
"exit" REPLCommand(_ ⇒ exit(), "This will terminate the console")
"help" -> REPLCommand(help, "Prints all available commands"),
"addController" -> REPLCommand(addController, "Adds a new Controller that is needed for mqttSwitches."),
"addUser" -> REPLCommand(addUser, "Adds a new User for the WebGui"),
"addSwitch" -> REPLCommand(() => addSwitch(false), "Adds a new Switch"),
"addDimmer" -> REPLCommand(() => addSwitch(true), "Adds a new dimmable Switch"),
"dim" -> REPLCommand(() => dim(), "Set the dimming value of a dimmable Switch"),
"status" -> REPLCommand(() => status(), "Show the status of Switches"),
"recreateDatabase" -> REPLCommand(recreate, "Recreates the Database and deletes all data"),
"safeCreate" -> REPLCommand(safeCreate, "Adds missing tables to the database"),
"getKey" -> REPLCommand(printControllerKey, "Displays the Key of a given Controller."),
"programController" -> REPLCommand(programController, "This will transfer the settings for a Controller"),
"exit" -> REPLCommand(exit, "This will terminate the console")
)
var socket: UnixDomainSocket = _
var triedConnecting = false
Expand Down Expand Up @@ -105,7 +105,7 @@ object console {
val userInput = readLine("> ")

if (commands.contains(userInput)) {
commands(userInput).methodToCall.apply()
commands(userInput).methodToCall
} else {
println("Unrecognized command. Please try again.")
}
Expand Down Expand Up @@ -439,4 +439,4 @@ object console {
* @param methodToCall the method to call, when the command is executed
* @param description the description to show when the user asks for help
*/
case class REPLCommand(methodToCall: Unit => Unit, description: String)
case class REPLCommand(methodToCall: () => Unit, description: String)