1.首次提交
commit
66b2bf6493
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.derunht.scy</groupId>
|
||||
<artifactId>ArmFxDataAcquisition</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.derunht.main</groupId>
|
||||
<artifactId>main-server</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>main-server</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<junit.version>5.9.1</junit.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>17.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>17.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.derunht.door</groupId>
|
||||
<artifactId>door-server</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.derunht.preview</groupId>
|
||||
<artifactId>preview-server</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.derunht.tool</groupId>
|
||||
<artifactId>tool-server</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Default configuration for running with: mvn clean javafx:run -->
|
||||
<id>default-cli</id>
|
||||
<configuration>
|
||||
<mainClass>com.derunht.main.mainserver/com.derunht.main.mainserver.HelloApplication
|
||||
</mainClass>
|
||||
<launcher>app</launcher>
|
||||
<jlinkZipName>app</jlinkZipName>
|
||||
<jlinkImageName>app</jlinkImageName>
|
||||
<noManPages>true</noManPages>
|
||||
<stripDebug>true</stripDebug>
|
||||
<noHeaderFiles>true</noHeaderFiles>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,27 @@
|
|||
package com.derunht.main.mainserver;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HelloApplication extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
|
||||
stage.setTitle("Hello!");
|
||||
stage.setScene(scene);
|
||||
stage.initStyle(StageStyle.UNDECORATED);//无装饰窗口样式,
|
||||
stage.setFullScreen(true);//全屏
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.derunht.main.mainserver;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
public class HelloController {
|
||||
@FXML
|
||||
private Label welcomeText;
|
||||
|
||||
@FXML
|
||||
protected void onHelloButtonClick() {
|
||||
welcomeText.setText("Welcome to JavaFX Application!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package com.derunht.main.mainserver.abstracts;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
|
||||
public abstract class AbDemo {
|
||||
public byte address;
|
||||
|
||||
public int com;
|
||||
public int time;
|
||||
|
||||
//等待次数
|
||||
public int count;
|
||||
|
||||
//全部等待次数
|
||||
public int countSize;
|
||||
public abstract void Encrypt();
|
||||
public abstract void Encrypt2();
|
||||
|
||||
public Boolean isStart = true;
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
List<String> list2 = new ArrayList<>();
|
||||
// </String>
|
||||
// Map<String,String> map = new HashMap<>();
|
||||
|
||||
public AbDemo(int time, int com, byte address) {
|
||||
this.time = time;
|
||||
this.com = com;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可以调用多次 每次入参不同
|
||||
* */
|
||||
public void send(String data){
|
||||
System.out.println("发送逻辑"+data);
|
||||
list.add(data);
|
||||
// map.put(data,"加入成功");
|
||||
}
|
||||
|
||||
public void atOnceSend(String data){
|
||||
|
||||
list2.add(data);
|
||||
//立即加入map队列
|
||||
// list.add(data);
|
||||
// map.put(data,"加入成功");
|
||||
}
|
||||
public void start(){
|
||||
if (list.size() == 0){
|
||||
return;
|
||||
}
|
||||
new Thread(()->{
|
||||
while (isStart){
|
||||
try {
|
||||
|
||||
for (String s : list) {
|
||||
//查询发送缓存
|
||||
//如果没有缓存则立即发送
|
||||
//如果有缓存count+1 不发送
|
||||
//如果count>5 则发送 countSize=count+countSize count清0
|
||||
//countSize最大值超过30 设置设备离线
|
||||
Thread.sleep(time);
|
||||
System.out.println("发送1"+s);
|
||||
// HelloApplication.map.put(s,"发送1"+s);
|
||||
}
|
||||
// map.forEach((k,v)->{
|
||||
//
|
||||
// });
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void start2(){
|
||||
if (list2.size() == 0){
|
||||
return;
|
||||
}
|
||||
new Thread(()->{
|
||||
while (isStart){
|
||||
try {
|
||||
|
||||
for (String s : list2) {
|
||||
Thread.sleep(time);
|
||||
System.out.println(System.currentTimeMillis()+"发送2"+s);
|
||||
//睡眠后立即发送
|
||||
}
|
||||
// map.forEach((k,v)->{
|
||||
//
|
||||
// });
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void stop(AbDemo objects){
|
||||
isStart = false;
|
||||
objects = null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.derunht.main.mainserver.abstracts.extend;
|
||||
|
||||
|
||||
import com.derunht.main.mainserver.abstracts.AbDemo;
|
||||
|
||||
public class AbDemoExtend extends AbDemo {
|
||||
|
||||
|
||||
public AbDemoExtend(int time, int com, byte address) {
|
||||
super(time, com, address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Encrypt() {
|
||||
send("1");
|
||||
send("2");
|
||||
send("3");
|
||||
start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Encrypt2() {
|
||||
atOnceSend("1");
|
||||
atOnceSend("1");
|
||||
atOnceSend("1");
|
||||
start2();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.derunht.main.mainserver.services;
|
||||
|
||||
public interface Demo {
|
||||
|
||||
void decode();
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.derunht.main.mainserver.services.impl;
|
||||
|
||||
|
||||
import com.derunht.main.mainserver.services.Demo;
|
||||
|
||||
public class DemoServiceImpl implements Demo {
|
||||
@Override
|
||||
public void decode() {
|
||||
System.out.println("decode1");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.derunht.main.mainserver.services.impl;
|
||||
|
||||
|
||||
import com.derunht.main.mainserver.services.Demo;
|
||||
|
||||
public class DemoServiceImpl2 implements Demo {
|
||||
@Override
|
||||
public void decode() {
|
||||
System.out.println("DemoServiceImpl2");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
module com.derunht.main.mainserver {
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
|
||||
requires org.controlsfx.controls;
|
||||
|
||||
requires gson;
|
||||
|
||||
requires lombok;
|
||||
|
||||
opens com.derunht.main.mainserver to javafx.fxml;
|
||||
exports com.derunht.main.mainserver;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.derunht.main.mainserver.HelloController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
|
||||
</padding>
|
||||
|
||||
<Label fx:id="welcomeText"/>
|
||||
<Button text="Hello!" onAction="#onHelloButtonClick"/>
|
||||
</VBox>
|
Loading…
Reference in New Issue