LEAPS 中心

LEAPS 中心 是一个网络应用程序,提供设备管理、网络管理以及整个网络的位置和遥测数据的可视化.

主要功能

  • 2D和3D网格提供实时位置更新,并将网络中的设备可视化.

  • 其他有用的功能包括用户管理、区域管理、区域历史、平面图管理、位置历史和位置热图.

  • The LEAPS 中心 通过 MQTT BrokerLEAPS 服务器 互联. 它作为一项服务在 Linux 和 Windows 上运行

安装

系统要求

Docker的系统要求因操作系统而异.

  • 对于 Linux,您需要 64 位架构、兼容的内核版本和特定的内核功能.

  • 在 Windows 上,在启用虚拟化的 Windows 10上使用 Docker Desktop

  • 在 macOS 上,请使用配备 macOS 10.13 或更新版本的Docker Desktop. 在硬件方面,建议至少配备 2GB 内存以及足够的 CPU 和磁盘空间.

注解

有关最新详情,请参阅`Docker <https://docs.docker.com/>`_官方文档.

说明

  1. 在电脑上安装 Docker

在 Linux 上安装 Docker Desktop <https://docs.docker.com/desktop/install/linux-install/>`_

此外,您还可以参考以下命令进行安装:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh
sudo usermod -aG docker $USER

在 Windows 上安装 Docker Desktop <https://docs.docker.com/desktop/install/windows-install/>`_

  1. 准备配置软件包

  • 创建包含 配置文件 的 leaps_center 目录

    • leaps-center-web.conf

    • 应用程序.属性

    • leaps-center-history.properties

    • leaps-center-web.properties

  • Or you can download the LEAPS 中心 configuration package (LEAPS_CENTER_DOCKER.zip).

  1. 在电脑上打开命令提示符或终端窗口.

  • Navigate to the directory where you extracted from the LEAPS 中心 configuration package.

例如,在 Ubuntu (Linux) 上:

cd LEAPS_CENTER_DOCKER/
  1. 安装 LEAPS 中心 Docker 软件包并运行:

docker run -d -p 80:8080/tcp --name some_name -v /path/to/data/data/:/app/data/ -e LEAPS_CENTER_HOME=/app/data/ leapslabs/leaps_center:tag sh -c "cd /app &&  java -jar leaps-center-web.jar"

其中 some_name 是要分配给容器的名称,tag 是指定要使用的 leaps-center-web 版本的标记.

leaps_center 映像必须与外部挂载的文件夹一起运行,该文件夹包含配置文件以及应用程序日志和配置/节点历史数据库的空间.

选项 -v /path/to/data/:/app/data/ 将位于 /path/to/data/ 的文件夹挂载到内部的 /app/data 文件夹. 数据文件夹必须包含以下文件.

  • 推荐的运行选项

    • --user $(id -u):$(id -g) 在特定用户和组下运行实例.

    • --restart unless-stopped 在服务器崩溃时自动重启实例.

  • 可选运行选项

    • --security-opt seccomp=unconfined 在 32 位 Raspberry Pi 镜像(Raspbian)上需要这个选项,因为它包含一个过时的 seccomp 库,其中的一个错误会对 Docker 镜像产生负面影响(无法连接到 MQTT 服务器). 该选项允许我们覆盖这一问题.

  1. @Todo: will be correct soon

例如,在 Ubuntu (Linux) 上:

docker run -d -p 80:8080/tcp --name leaps_center -v $PWD/leaps_center/:/app/data/ -e LEAPS_CENTER_HOME=/app/data/ leapslabs/leaps_center:latest sh -c "cd /app &&  java -jar leaps-center-web.jar"

Unable to find image 'leapslabs/leaps_center:latest' locally
latest: Pulling from leapslabs/leaps_center
a458657ccc71: Pull complete
Digest: sha256:a19b127656d41d8607f043c2c83924e5b9a5cbd4dc23cfbed070be3b9cfc6b9a
Status: Downloaded newer image for leapslabs/leaps_center:latest
320d3768289874e063619f75faca7a24dd75a08884df8cd8fb2cc9b54c6f0a46
  1. 确认安装成功,运行:

例如,在 Ubuntu (Linux) 上:

docker ps

CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS                          PORTS     NAMES
b1145b72db35   leapslabs/leaps_center:latest   "sh -c 'cd /app &&  …"   37 seconds ago   11 seconds ago                            leaps_center
  1. @Todo: will be correct soon

../../../_images/lc_login.png

@Todo: will be correct soon

配置文件

  • leaps-center-web.conf

    JAVA_OPTS="-Xms256m -Xmx512m -Xss256k"
    
  • 应用程序.属性

  • leaps-center-history.properties

  • leaps-center-web.properties

    该配置文件控制应用程序日志记录.

    spring.main.banner-mode=OFF
    
    logging.level.root=OFF
    logging.level.global.leaps.center.mqtt=OFF
    logging.level.global.leaps.center.init=OFF
    logging.level.global.leaps.center.service=OFF
    logging.level.global.leaps.center.history.filter=OFF
    logging.level.global.leaps.center.history.service=OFF
    logging.level.global.leaps.center.history=OFF
    logging.level.global.leaps.center.web.component=OFF
    logging.level.global.leaps.center.web.rest=OFF
    logging.level.global.leaps.center.web.sse=OFF
    logging.level.global.leaps.center.web=OFF
    logging.level.global.leaps.center=OFF
    

    该配置文件控制节点位置历史记录.

    #
    #       LEAPS - Low Energy Accurate Positioning System - LEAPS Center.
    #
    #       Copyright (c) 2016-2021, LEAPS.
    #
    #       Licensed under the Apache License, Version 2.0 (the "License");
    #       You may not use this file except in compliance with the License.
    #       You may obtain a copy of the License at
    #
    #       http://www.apache.org/licenses/LICENSE-2.0
    #
    #       Unless required by applicable law or agreed to in writing, software
    #       distributed under the License is distributed on an "AS IS" BASIS,
    #       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    #       See the License for the specific language governing permissions and
    #       limitations under the License.
    #
    
    # history enabled (default false)
    history.enabled=false
    history.position.enabled=true
    history.zone.enabled=true
    
    # use node position message timestamp (default true)
    history.use.position.timestamp=false
    
    # =======================================================================================================
    # Export Options
    # =======================================================================================================
    
    # add headers (default false)
    history.export.headers=false
    
    # maximum number of records (default 1000000)
    history.export.max.lines=1000000
    
    # compress export file (default true)
    history.export.compress=true
    
    # number of decimal places for x, y, z values (default 4)
    history.export.position.decimal.places=2
    
    # format network id to hex value (default true)
    history.export.hex.network.id=true
    
    # format node  ID to hex value (default true)
    history.export.hex.node.id=true
    
    # =======================================================================================================
    # Position History Options
    # =======================================================================================================
    
    # interval time to add a history record (default 10000)
    history.node.position.interval.time=10000
    
    # minimun quality value (default 0)
    history.node.position.min.quality=0
    
    # =======================================================================================================
    # Heatmap Options
    # =======================================================================================================
    # maximum number of records for heatmap (default 100000)
    heatmap.max.results=100000
    
    # =======================================================================================================
    # Purge Options
    # =======================================================================================================
    
    # time to purge database records in days (default 30 days)
    history.purge.time=30
    
    # backup purged records to a file in /history folder (default false)
    history.purge.backup.records=true
    
    # max number of backup files (default 10)
    history.purge.max.backup.files=5
    
    # =======================================================================================================
    # DBMS (SQLITE, POSTGRESQL, MY_SQL, ORACLE, SQL_SERVER or CUSTOM)
    # =======================================================================================================
    
    # History - SQLite Database Example (default).
    # history.dbms=SQLITE
    # history.db.jdbc.url=jdbc:sqlite:leaps-center-history.db
    # history.db.username=
    # history.db.password=
    
    # History - PostgreSQL Database Example
    # history.dbms=POSTGRESQL
    # history.db.jdbc.url=jdbc:postgresql://localhost:5432/leaps_center_history
    # history.db.username=leaps_center
    # history.db.password=pwd
    
    # History - Oracle Database Example
    # Important! To use Oracle DBMS is mandatory to change global.leaps.center.history.entity.NetworkNodeHistory.id @Id generation strategy to GenerationType.AUTO or GenerationType.SEQUENCE. Oracle does not support GenerationType.IDENTITY.
    # history.dbms=ORACLE
    # history.db.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
    # history.db.jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521/XE
    # history.db.username=leaps_center
    # history.db.password=pwd
    
    # History - MySQL Database Example
    # history.dbms=MY_SQL
    # history.db.jdbc.url=jdbc:mysql://localhost:3306/leaps_center
    # history.db.username=leaps_center
    # history.db.password=pwd
    
    # History - SQL Server Database Example
    # TODO: It needs to be tested.
    # history.dbms=SQL_SERVER
    # history.db.jdbc.url=jdbc:sqlserver://localhost:1433;databaseName=leaps_center_history;integratedSecurity=true
    # history.db.jdbc.url=jdbc:jtds:sqlserver://localhost:1433/leaps_center_history;instance=SQLEXPRESS;
    # history.db.username=leaps_center
    # history.db.password=pwd
    
    # History - Custom Database
    # history.dbms=CUSTOM
    
    # Hibernate Dialect
    # history.db.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    
    # JDBC driver class
    # history.db.jdbc.driver.class=org.postgresql.Driver
    

    该配置文件控制 leaps_center 应用程序.

    #
    #       LEAPS - Low Energy Accurate Positioning System - LEAPS Center.
    #
    #       Copyright (c) 2016-2021, LEAPS.
    #
    #       Licensed under the Apache License, Version 2.0 (the "License");
    #       you may not use this file except in compliance with the License.
    #       You may obtain a copy of the License at
    #
    #       http://www.apache.org/licenses/LICENSE-2.0
    #
    #       Unless required by applicable law or agreed to in writing, software
    #       distributed under the License is distributed on an "AS IS" BASIS,
    #       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    #       See the License for the specific language governing permissions and
    #       limitations under the License.
    #
    
    # database (SQLITE, POSTGRESQL, MY_SQL, ORACLE, SQL_SERVER or CUSTOM)
    db.dbms=SQLITE
    
    # History - SQLite Database Example.
    # dbms=SQLITE
    # db.jdbc.url=jdbc:sqlite:leaps-center-db
    # db.username=
    # db.password=
    
    # History - PostgreSQL Database Example
    # db.dbms=POSTGRESQL
    # db.jdbc.url=jdbc:postgresql://localhost:5432/leaps_center
    # db.username=postgres
    # db.password=qwe123
    
    # History - Oracle Database Example
    # Important! To use Oracle DBMS is mandatory to change global.leaps.center.entity.NetworkNodeHistory.id @Id generation strategy to GenerationType.AUTO or GenerationType.SEQUENCE. Oracle does not support GenerationType.IDENTITY.
    # db.dbms=ORACLE
    # db.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
    # db.jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521/XE
    # db.username=leaps_center
    # db.password=q1w2e3r4t5
    
    # History - MySQL Database Example
    # db.dbms=MY_SQL
    # db.jdbc.url=jdbc:mysql://localhost:3306/leaps_center
    # db.username=root
    # db.password=qwe123
    
    # History - SQL Server Database Example
    # db.dbms=SQL_SERVER
    # db.jdbc.url=jdbc:sqlserver://localhost:1433;databaseName=leaps_center_history;integratedSecurity=true
    # db.jdbc.url=jdbc:jtds:sqlserver://localhost:1433/leaps_center_history;instance=SQLEXPRESS;
    # db.username=leaps_center
    # db.password=qwe123
    
    # History - Custom Database
    # db.dbms=CUSTOM
    
    # Hibernate Dialect
    # db.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    
    # JDBC driver class
    # history.db.jdbc.driver.class=org.postgresql.Driver
    # db.jdbc.url=jdbc:postgresql://localhost:5432/leaps_center
    # db.username=postgres
    # db.password=qwe123
    # db.jdbc.driver.class=
    # db.hibernate.dialect=
    
    # show sql (default false)
    # db.jpa.show-sql=false
    
    # format sql (default false)
    # db.jpa.format-sql=false
    
    # =======================================================================================================
    # network
    # =======================================================================================================
    
    # enable the registration of networks with mqtt connection type = HOST. (default true)
    network.mqtt.connection.by.host.enabled=true
    
    # enable the registration of networks with mqtt connection type = PAN_ID. (default false)
    network.mqtt.connection.by.network.id.enable=false
    
    # enable the registration of networks with web client connection by websocket. (default false)
    network.web.client.connection.by.web.socket=false
    
    # create the default network if it does not exist when starting. (default true)
    network.create.default.network=true
    # network.create.default.floor.plan=true
    
    network.default.id=
    network.default.name=Default
    
    # PAN_ID or HOST
    network.default.mqtt.connection.type=HOST
    
    # WS or SSE
    network.default.web.client.connection.type=SSE
    
    # MQTT
    mqtt.host=
    mqtt.ws.port=15675
    mqtt.tcp.port=1883
    mqtt.username=dwmuser
    mqtt.password=dwmuser
    # Enable/Disable TLS
    #mqtt.tls=
    # CA_SIGNED_CERTIFICATE (signed by a publicly trusted CA), CA_FILE_CERTIFICATE (file certificate);
    #mqtt.tls.certificate.type=CA_SIGNED_CERTIFICATE
    # TLS Protocol: TLS_V1 (TLSv1), TLS_V1_1 (TLSv1.1), TLS_V1_2 (TLSv1.2), TLS_V1_3(TLSv1.3);
    #mqtt.tls.protocol=TLS_V1_2
    #mqtt.tls.certificate.file=/user/.../leaps-center.crt
    mqtt.topic.prefix=dwm
    mqtt.tag.topic.prefix=node
    mqtt.anchor.topic.prefix=node
    
    # =======================================================================================================
    # floorplan settings
    # =======================================================================================================
    # size in pixels (default 2048)
    floorplan.max.image.dimension.size=2048
    
    # =======================================================================================================
    # scene settings
    # =======================================================================================================
    # size in cm (default 50cm)
    scene.grid.size=50
    # color in int (default 0xD8D8D8)
    scene.grid.color=0xD8D8D8
    # max grid visibility distance in meters (default 100)
    scene.grid.max.visibility.distance=100
    # zoom min in meters (default 2)
    scene.zoom.min=2
    # zoom max in meters (default 100)
    scene.zoom.max=100
    
    # =======================================================================================================
    # web server settings
    # =======================================================================================================
    
    # http session timeout
    server.servlet.session.timeout=120m
    
    # maximum number of http sessions per user (-1 is unlimited)
    server.max.sessions.per.user=-1
    
    # mod-jk/ajp connector configuration
    tomcat.ajp.enabled=false
    # tomcat.ajp.port=8009
    # tomcat.ajp.secret.required=false
    # tomcat.apr.enabled=false
    
    # server port (2-65535)
    server.port=8080
    
    # enable / disable https
    server.ssl.enabled=false
    # keystore format
    # server.ssl.key-store-type=PKCS12
    # keystore location
    # server.ssl.key-store=D:\\Leaps\\tls\\springboot.p12
    # keystore alias
    # server.ssl.key-alias=springboot
    # keystore password
    # server.ssl.key-store-password=password
    # SSL protocol to use
    # server.ssl.protocol=TLS
    # Enabled SSL protocols
    # server.ssl.enabled-protocols=TLSv1.2
    

开始

默认情况下,登录账户的用户名为 admin,密码为 admin.

LEAPS 服务器 Docker

  • @Todo: will be correct soon

  • @Todo: will be correct soon

  • @Todo: will be correct soon

  • @Todo: will be correct soon

网络配置

要配置网络,请进入菜单并选择 Networks.

../../../_images/lc_select_networks.png

网络管理对话框将弹出. 默认情况下已经设置了本地主机网络,网络 ID 为 0x1234.

../../../_images/lc_list_networks.png

要创建新网络,请单击右下角的 Add 按钮.

现在,填写所需的配置参数:

  • 名称

  • 网络类型

  • 主机

  • TCP 端口

  • 用户名

  • 主题前缀

填写完毕后,点击 Save 按钮连接并接收网络 ID.

../../../_images/lc_config_networks_1234.png

如果不知道网络 ID,可以使用 LEAPS 管理器 或 Shell 查找.

最后,您可以单击 Test 按钮检查连接情况,然后单击 Save 按钮保存配置.

节点配置

要配置节点,需要事先将节点分配到特定网络.

选择指定节点的网络,查看网络详细信息. 然后,您就可以开始配置节点了.

有关可配置为网关、锚点或标记节点的节点,请参阅以下详细信息

../../../_images/lc_config_gateway.png
../../../_images/lc_config_anchor.png
../../../_images/lc_config_tag.png

平面图

要配置平面图,请进入菜单并选择 Floor Plans.

../../../_images/lc_menu.png

点击右下角的 Add 按钮.

../../../_images/lc_floor_plans_add.png

然后,导入要配置的平面图并填写相应参数.

../../../_images/lc_floor_plans_create.png

填写完毕后,点击 Save 按钮保存配置. 使用 Visible 复选框启用地图上的可见性.

../../../_images/lc_floor_plans_udk1.png

区域

要配置区段,请进入菜单并选择 Zones.

../../../_images/lc_menu.png

点击右下角的 Add 按钮.

../../../_images/lc_floor_plans_add.png

然后,填写相应参数,并为 Save 添加配置.

用户

要配置用户,请进入菜单并选择 Users.

../../../_images/lc_menu.png

默认情况下,应用程序已预先配置了一个管理员账户和一个普通账户.

../../../_images/lc_user_list.png

适用于管理员账户或普通账户.

../../../_images/lc_user_admin.png
../../../_images/lc_user_common.png

应用程序接口授权

  1. 用户需要向/login发送一个简单的HTTP POST,并传递以下参数(以admin:admin为例).

    • 用户名: admin

    • 密码:admin

    • 记住我:开启

  2. 登录后会生成 JSESSIONID cookie,用户需要在后续请求中使用它.

    注解

    1. 这不是强制性的,如果用户使用了它,会在响应中添加另一个 cookie(cookie REMEMBERME),用户可以在后续请求中使用它.

    2. @Todo: will be correct soon

下面是一个用 Java 编写的请求和查询网络的代码示例:

../../../_images/api-authorization.png

更多详情,请参阅以下两段视频,一段使用 Postman,另一段使用 Java 代码

Postman


Java Client


故障排除

  • @Todo: will be correct soon

  • @Todo: will be correct soon