diff --git a/iot-common/iot-base/pom.xml b/iot-common/iot-base/pom.xml
index 931ab2f..fc919f0 100644
--- a/iot-common/iot-base/pom.xml
+++ b/iot-common/iot-base/pom.xml
@@ -7,18 +7,8 @@
0.0.1-SNAPSHOT
- iot-annotation
-
- Maven
- http://maven.apache.org/
- 2001
-
-
-
- website
- scp://webhost.company.com/www/website
-
-
+ iot-base
+ iot-base
UTF-8
@@ -34,14 +24,22 @@
spring-context
-
- maven-site-plugin
+ org.springframework.boot
+ spring-boot-maven-plugin
- en,fr
+
+ true
+
+
+
+ repackage
+
+
+
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AlarmRepeatEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AlarmRepeatEnum.java
new file mode 100644
index 0000000..d66f1d1
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AlarmRepeatEnum.java
@@ -0,0 +1,19 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 闹铃重复次数
+* 作者:吴林
+* */
+// 0:响铃一次(time指定的时间) 1:每天 2:指定星期
+public enum AlarmRepeatEnum {
+ ONE(0, "指定时间响铃一次"),
+ EVERY_DAY(1, "每天"),
+ WEEK(2, "指定星期"),
+ ;
+ AlarmRepeatEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AskTypeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AskTypeEnum.java
new file mode 100644
index 0000000..b46a298
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AskTypeEnum.java
@@ -0,0 +1,47 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 问答枚举
+* 作者:吴林
+* */
+// 0 大预言普通问答 1 天气 2 音乐 3 闹钟 4talk_answer_config配置回答
+public enum AskTypeEnum {
+ LANGUAGE_MODEL(0, "大语言模型"),
+ WEATHER(1, "天气"),
+ SOUND(2, "音乐"),
+ ALARM(3, "闹钟"),
+ SYS_CONFIG(4, "后台配置的"),
+ ;
+ AskTypeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public AskTypeEnum getEnumWithCode(Integer c){
+ for (AskTypeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public AskTypeEnum getEnumWithName(String name){
+ for (AskTypeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/DeviceTypeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/DeviceTypeEnum.java
new file mode 100644
index 0000000..0f8ef19
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/DeviceTypeEnum.java
@@ -0,0 +1,63 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 设备类型枚举
+* 作者:吴林
+* */
+// 0 果Box 1智能插座 2智能大灯 3智能窗帘驱动 4智能窗户关闭 5智能台灯
+// 6智能桌子 7智能椅子 8智能风扇 9智能空调(遥控器) 10智能冰箱 11智能洗碗机
+// 12智能电热水器 13温度传感器 14空气质量传感器 15光线传感器 16雨量传感器
+//17闭门器
+public enum DeviceTypeEnum {
+ GUO_BOX(0, "果box"),
+ ELECTRIC_SOCKET(1, "智能插座"),
+ BIG_LIGHT(2, "智能大灯"),
+ CURTAIN_DRIVE(3, "智能窗帘驱动"),
+ WINDOW_DRIVE(4, "智能窗户关闭"),
+ DESK_LAMP(5, "智能台灯"),
+ DESK(6, "智能桌子"),
+ SEAT(7, "智能椅子"),
+ ELECTRIC_FAN(8, "智能风扇"),
+ AIR_CONDITIONING_CONTROL(9, "智能空调(遥控器)"),
+ ICEBOX(10, "智能冰箱"),
+ DISHWASHER(11, "智能洗碗机"),
+ ELECTRIC_WATER(12, "智能电热水器"),
+ TEMPERATURE_SENSOR(13, "温度传感器"),
+ AIR_QUALITY_SENSOR(14, "空气质量传感器"),
+ LIGHT_SENSOR(15, "光线传感器"),
+ RAIN_SENSOR(16, "雨量传感器"),
+ DOOR_CLOSER(17, "闭门器"),
+ ;
+ DeviceTypeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public DeviceTypeEnum getEnumWithCode(Integer c){
+ for (DeviceTypeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public DeviceTypeEnum getEnumWithName(String name){
+ for (DeviceTypeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/IsDeleteEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/IsDeleteEnum.java
new file mode 100644
index 0000000..b7a7751
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/IsDeleteEnum.java
@@ -0,0 +1,13 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 是否删除
+* 作者:吴林
+* */
+// 0:系统内置 1:指定声音
+public enum IsDeleteEnum {
+ NOT_DELETE,//未删除
+ DELETE,//删除
+ ;
+
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/MarkModeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/MarkModeEnum.java
new file mode 100644
index 0000000..7dc1942
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/MarkModeEnum.java
@@ -0,0 +1,44 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 设备运行场景类型
+* 作者:吴林
+* */
+// 0 无场景 1营销模式
+public enum MarkModeEnum {
+ NONE(0, "无场景"),
+ MARKETING(1, "营销模式"),
+ ;
+ MarkModeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public MarkModeEnum getEnumWithCode(Integer c){
+ for (MarkModeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public MarkModeEnum getEnumWithName(String name){
+ for (MarkModeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/OpenTypeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/OpenTypeEnum.java
new file mode 100644
index 0000000..27d791f
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/OpenTypeEnum.java
@@ -0,0 +1,48 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 开放平台类型
+* 作者:吴林
+* */
+// 0 语言模型 1:音乐 2 有声读物 3 天气 4 导航
+public enum OpenTypeEnum {
+ LANGUAGE_MODEL(0, "大语言模型"),
+ MUSIC(1, "音乐"),
+ SOUND(2, "有声读物"),
+ WEATHER(3, "天气"),
+ NAVIGATION(4, "导航"),
+ ;
+ OpenTypeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public OpenTypeEnum getEnumWithCode(Integer c){
+ for (OpenTypeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public OpenTypeEnum getEnumWithName(String name){
+ for (OpenTypeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/OtaModeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/OtaModeEnum.java
new file mode 100644
index 0000000..7dcbb6d
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/OtaModeEnum.java
@@ -0,0 +1,45 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* OTA模式类型
+* 作者:吴林
+* */
+// 0:手动升级 1:自动升级 2强制升级
+public enum OtaModeEnum {
+ USER_CONTROL(0, "手动升级"),
+ AUTO(1, "自动"),
+ FORCE(2, "强制"),
+ ;
+ OtaModeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public OtaModeEnum getEnumWithCode(Integer c){
+ for (OtaModeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public OtaModeEnum getEnumWithName(String name){
+ for (OtaModeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/RunModeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/RunModeEnum.java
new file mode 100644
index 0000000..6d69a8b
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/RunModeEnum.java
@@ -0,0 +1,45 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 设备运行模式类型
+* 作者:吴林
+* */
+// 0 普通模式 1成人模式 2儿童模式
+public enum RunModeEnum {
+ NORMAL(0, "普通模式"),
+ ADULT(1, "成人模式"),
+ CHILDREN(1, "儿童模式"),
+ ;
+ RunModeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public RunModeEnum getEnumWithCode(Integer c){
+ for (RunModeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public RunModeEnum getEnumWithName(String name){
+ for (RunModeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/SoundTypeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/SoundTypeEnum.java
new file mode 100644
index 0000000..12387e3
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/SoundTypeEnum.java
@@ -0,0 +1,45 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 声音类型
+* 作者:吴林
+* */
+// 0:系统内置 1:指定声音
+public enum SoundTypeEnum {
+ INNER(0, "系统内置"),
+ APPOINT(1, "指定的"),
+ ;
+ SoundTypeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public SoundTypeEnum getEnumWithCode(Integer c){
+ for (SoundTypeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public SoundTypeEnum getEnumWithName(String name){
+ for (SoundTypeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/SuggestionTypeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/SuggestionTypeEnum.java
new file mode 100644
index 0000000..e975670
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/SuggestionTypeEnum.java
@@ -0,0 +1,45 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 反馈意见类型类型
+* 作者:吴林
+* */
+// 0:设备问题 1 技能服务 2 app问题
+public enum SuggestionTypeEnum {
+ DEVICE(0, "手动升级"),
+ SKILL(1, "技能"),
+ APP(2, "强制"),
+ ;
+ SuggestionTypeEnum(Integer c, String n){
+ code = c;
+ name = n;
+ }
+ private Integer code;
+ private String name;
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public SuggestionTypeEnum getEnumWithCode(Integer c){
+ for (SuggestionTypeEnum e:values()
+ ) {
+ if(e.getCode().compareTo(c) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+ public SuggestionTypeEnum getEnumWithName(String name){
+ for (SuggestionTypeEnum e:values()
+ ) {
+ if(e.getName().compareTo(name) == 0){
+ return e;
+ }
+ }
+ return null;
+ }
+}
diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/YesNo.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/YesNo.java
new file mode 100644
index 0000000..a1dc15c
--- /dev/null
+++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/YesNo.java
@@ -0,0 +1,13 @@
+package com.qiuguo.iot.base.enums;
+
+/*
+* 是否
+* 作者:吴林
+* */
+// 0:否 1:是
+public enum YesNo {
+ NO,//未删除
+ YES,//删除
+ ;
+
+}
diff --git a/iot-common/pom.xml b/iot-common/pom.xml
index a54a387..52e711b 100644
--- a/iot-common/pom.xml
+++ b/iot-common/pom.xml
@@ -20,17 +20,6 @@
8
UTF-8
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- true
-
-
-
-
+
\ No newline at end of file
diff --git a/iot-modules/iot-box-websocket/pom.xml b/iot-modules/iot-box-websocket/pom.xml
index 0b17847..816c876 100644
--- a/iot-modules/iot-box-websocket/pom.xml
+++ b/iot-modules/iot-box-websocket/pom.xml
@@ -35,9 +35,10 @@
jetty-util
9.4.9.v20180320
+
com.qiuguo.iot
- iot-annotation
+ iot-base
0.0.1-SNAPSHOT
compile
@@ -48,6 +49,13 @@
org.springframework.boot
spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
diff --git a/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/handler/BoxWebSocketHandler.java b/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/handler/BoxWebSocketHandler.java
index e6becb5..ff1d31b 100644
--- a/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/handler/BoxWebSocketHandler.java
+++ b/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/handler/BoxWebSocketHandler.java
@@ -2,6 +2,7 @@ package com.qiuguo.iot.box.websocket.handler;
import com.google.protobuf.InvalidProtocolBufferException;
import com.qiuguo.iot.base.annotation.WebSocketMapping;
+import com.qiuguo.iot.base.enums.IsDeleteEnum;
import com.qiuguo.iot.box.websocket.cmd.UserInfo;
import com.qiuguo.iot.box.websocket.protobuf.MsgProtocol;
import com.qiuguo.iot.box.websocket.runner.FluxBatchRunner;
@@ -32,7 +33,6 @@ public class BoxWebSocketHandler implements WebSocketHandler {
/**
* 所有websocket连接管理容器
**/
- //CountDownLatch countDownLatch = new CountDownLatch(5);
FluxBatchRunner batchRunner = new FluxBatchRunner<>(20, data -> {
log.info("begin:: thread={} 大小:{}", Thread.currentThread().getName(), data.size());
for (MsgProtocol.Msg msg:data
@@ -43,6 +43,7 @@ public class BoxWebSocketHandler implements WebSocketHandler {
//info.sendData(msg);
}
}
+
//data.clear();
@@ -110,74 +111,6 @@ public class BoxWebSocketHandler implements WebSocketHandler {
*/
return Mono.zip(input, output).then();
- /*Flux output = session.receive()
- .concatMap(mapper -> {
- try {
- log.info("concatMap");
- MsgProtocol.Msg reqMsg = getMsg(mapper.getPayload());
- MsgProtocol.User user1 = MsgProtocol.User.parseFrom(reqMsg.getData());
- UserInfo userInfo = null;
- Long id = user1.getUserId();
- if(!group.containsKey(user1.getUserId())){
- userInfo = new UserInfo(session, Flux.create(sink->{return sink;}, id));
- userInfo.setUser(user1);
- userInfo.setSession(session);
- group.put(user1.getUserId(), userInfo);
- }else{
- userInfo = group.get(user1.getUserId());
- }
- if(reqMsg.getCmdId().getNumber() == MsgProtocol.Msg.CmdId.SEND_STATUS_REQ_VALUE){
- MsgProtocol.Msg reqMsg1 = reqMsg.toBuilder().setCmdId(MsgProtocol.Msg.CmdId.SYNC_STATUS_RSP).build();
- return Flux.just(reqMsg1);
-
- }
-
- } catch (InvalidProtocolBufferException e) {
- throw new RuntimeException(e);
- }
-
- return Flux.empty();
- }).map(value -> {
- log.info("map");
-
- CountDownLatch countDownLatch = new CountDownLatch(1);
- FluxBatchRunner batchRunner = new FluxBatchRunner<>(20, data -> {
- log.info("begin:: thread={} 大小:{}", Thread.currentThread().getName(), data.size());
- ByteBufAllocator allocator = new PooledByteBufAllocator();
- DataBufferFactory factory = new NettyDataBufferFactory(allocator);
- DataBuffer dataBuffer = factory.wrap(value.toByteArray());
- //DataBuffer dataBuffer = factory.allocateBuffer();
- WebSocketMessage webSocketMessage = new WebSocketMessage(WebSocketMessage.Type.BINARY, dataBuffer);
- FluxProcessor fluxProcessor = EmitterProcessor.create().serialize();
- FluxSink messageSink = fluxProcessor.sink();
- for (UserInfo info:data
- ) {
- messageSink.next(info.getSession().binaryMessage(Flux.just(webSocketMessage)));
- Mono outputClient = info.getSession().send(Flux.create(sink -> {
- senderMap.put(info.getUser().getUserId(), new WebSocketSender(info.getSession(), sink));
- }));
- }
- countDownLatch.countDown();
- //System.out.printf("begin:: thread=%s; data=%s", Thread.currentThread().getName());
-
- log.info("end:: thread={}", Thread.currentThread().getName());
- //System.out.printf("end:: thread=%s; size=%s%n", Thread.currentThread().getName(), data.size());
- });
- //IntStream.range(0, 100).forEach(batchRunner::add);
- group.values().forEach(batchRunner::add);
- batchRunner.doFinal();
- try {
- countDownLatch.await();
- }catch (Exception e){
-
- }
- //log.info("进来");
- //group.forEach(batchRunner::add);
-
- return session.textMessage("");
- });
- return session.send(output);*/
- //return null;
}
public MsgProtocol.Msg getMsg(DataBuffer data) throws InvalidProtocolBufferException {
diff --git a/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/runner/FluxBatchRunner.java b/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/runner/FluxBatchRunner.java
index 0c265e3..dc5c30e 100644
--- a/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/runner/FluxBatchRunner.java
+++ b/iot-modules/iot-box-websocket/src/main/java/com/qiuguo/iot/box/websocket/runner/FluxBatchRunner.java
@@ -34,7 +34,8 @@ public class FluxBatchRunner {
//Schedulers.elastic() //无限制的弹性线程池,可以一直创建线程
//Schedulers.boundedElastic() //有界的弹性线程池,它会回收闲置的线程,默认是60s;它对创建的线程数做了限制,默认值为CPU内核数x 10,达到上限后,最多可提交10万个任务;
//Schedulers.fromExecutorService() 根据我们自定义线程池进行引用;
- scheduler = Schedulers.single();//可重用单个线程
+ //scheduler = Schedulers.single();//可重用单个线程
+ scheduler = Schedulers.newSingle("webSendBox");//新的可重用单个线程
records = new ArrayList<>(batchSize);
}
@@ -82,7 +83,7 @@ public class FluxBatchRunner {
//需要多线程执行必须使用parallel+runOn 如下
//Flux.just(records).parallel().runOn(scheduler).subscribe(data ->consumer.accept(data));
}
-
+/*
public static void main(String[] args) {
try {
CountDownLatch countDownLatch = new CountDownLatch(5);
@@ -103,7 +104,7 @@ public class FluxBatchRunner {
}catch (Exception e){
}
- }
+ }*/
}
diff --git a/iot-modules/pom.xml b/iot-modules/pom.xml
index 660a70d..c7ce7c3 100644
--- a/iot-modules/pom.xml
+++ b/iot-modules/pom.xml
@@ -52,16 +52,4 @@
provided
-
-
-
-
-
- maven-site-plugin
-
- en,fr
-
-
-
-