From 35bdc3cfc6f71990986b7ad53f1f3302f0313e90 Mon Sep 17 00:00:00 2001 From: yipeng Date: Tue, 18 May 2021 18:30:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/config/DeviceRemoteConfig.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java index 8bc1b62..66648a2 100644 --- a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java +++ b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java @@ -20,6 +20,8 @@ import org.apache.commons.lang3.StringUtils; public class DeviceRemoteConfig implements Serializable { private static final Set SET = new ConcurrentHashSet<>(); private Map data = new HashMap<>(); + private Map customData = new HashMap<>(); + /** 在线状态 */ private volatile boolean online; @@ -37,6 +39,18 @@ public class DeviceRemoteConfig implements Serializable { log.info("after parseAndAdd: {}", getAll()); } + public Object put(Object key, Object val){ + return this.customData.put(key,val); + } + + public Object get(Object key){ + return this.customData.get(key); + } + + public Object remove(Object key){ + return this.customData.remove(key); + } + @SuppressWarnings("unchecked") public static DeviceRemoteConfig parse(String line) { return new DeviceRemoteConfig(JsonUtil.fromJson(line, Map.class)); -- Gitee From 5463c2a67ca3a344e8d14c060b0b11940dd3b5d2 Mon Sep 17 00:00:00 2001 From: yipeng Date: Tue, 18 May 2021 18:40:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iotos/softgateway/core/config/DeviceRemoteConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java index 66648a2..7b71b3d 100644 --- a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java +++ b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java @@ -39,15 +39,15 @@ public class DeviceRemoteConfig implements Serializable { log.info("after parseAndAdd: {}", getAll()); } - public Object put(Object key, Object val){ + public Object putCustom(Object key, Object val){ return this.customData.put(key,val); } - public Object get(Object key){ + public Object getCustom(Object key){ return this.customData.get(key); } - public Object remove(Object key){ + public Object removeCustom(Object key){ return this.customData.remove(key); } -- Gitee From 322b85f1ec7a5dfb4e49d29dc25ea433f1ebae3a Mon Sep 17 00:00:00 2001 From: yipeng Date: Tue, 18 May 2021 20:09:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java index 7b71b3d..e5f49de 100644 --- a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java +++ b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java @@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils; public class DeviceRemoteConfig implements Serializable { private static final Set SET = new ConcurrentHashSet<>(); private Map data = new HashMap<>(); + /** 自定义属性 */ private Map customData = new HashMap<>(); /** 在线状态 */ -- Gitee From 9c7567129840c1671dcd6fd54046942e31adae0c Mon Sep 17 00:00:00 2001 From: yipeng Date: Tue, 18 May 2021 20:09:29 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/config/DeviceRemoteConfig.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java index 7b71b3d..8465d85 100644 --- a/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java +++ b/framework-core/src/main/java/me/hekr/iotos/softgateway/core/config/DeviceRemoteConfig.java @@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils; public class DeviceRemoteConfig implements Serializable { private static final Set SET = new ConcurrentHashSet<>(); private Map data = new HashMap<>(); + /** 自定义属性 */ private Map customData = new HashMap<>(); /** 在线状态 */ @@ -39,14 +40,30 @@ public class DeviceRemoteConfig implements Serializable { log.info("after parseAndAdd: {}", getAll()); } + /** + * 增加自定义属性信息 + * @param key + * @param val + * @return + */ public Object putCustom(Object key, Object val){ return this.customData.put(key,val); } + /** + * 获取自定义信息 + * @param key + * @return + */ public Object getCustom(Object key){ return this.customData.get(key); } + /** + * 删除自定义信息 + * @param key + * @return + */ public Object removeCustom(Object key){ return this.customData.remove(key); } -- Gitee