项目作者: romainmoreau

项目描述 :
Gas sensing services
高级语言: Java
项目地址: git://github.com/romainmoreau/gas-sensor.git
创建时间: 2017-01-28T17:01:12Z
项目社区:https://github.com/romainmoreau/gas-sensor

开源协议:Apache License 2.0

下载


Gas sensor

To build the projects, simply run mvn clean install.

Web application

Installation

After building the projects, the web application binary will be located at:

  • gas-sensor-web\target\gas-sensor-web.exe (Windows specific)
  • gas-sensor-web\target\gas-sensor-web.jar (All OS)

Configuration

You need to create an application.yml next to the binary before running it:

  1. ze07:
  2. gas-sensors: # Not required, activates the reading from the specified ports of ZE07 sensors if the jserialcomm profile is activated.
  3. -
  4. port-name: COM2 # Required
  5. ze08:
  6. gas-sensors: # Not required, activates the reading from the specified ports of ZE08 sensors if the jserialcomm profile is activated.
  7. -
  8. port-name: COM3 # Required
  9. zh03a:
  10. gas-sensors: # Not required, activates the reading from the specified ports of ZH03A sensors if the jserialcomm profile is activated.
  11. -
  12. port-name: COM4 # Required
  13. zph01:
  14. gas-sensors: # Not required, activates the reading from the specified ports of ZPH01 sensors if the jserialcomm profile is activated.
  15. -
  16. port-name: COM5 # Required
  17. mhz19:
  18. gas-sensors: # Not required, activates the reading from the specified ports of MH-Z19 sensors if the jserialcomm profile is activated.
  19. -
  20. port-name: COM6 # Required
  21. si7021:
  22. gas-sensors: # Not required, activates the reading from the specified ports of Si7021 sensors if the jserialcomm profile is activated.
  23. -
  24. description: _Inside # Not required
  25. port-name: COM7 # Required
  26. -
  27. description: _Outside # Not required
  28. port-name: COM8 # Required
  29. spring:
  30. profiles:
  31. active: jserialcomm # Profile jserialcomm activates the reading from the sensors via the serial port communication. Profile mock activates the reading from mock sensors.
  32. datasource:
  33. url: jdbc:h2:~/gas-sensor-web;DB_CLOSE_ON_EXIT=FALSE # Not required, by default a memory H2 database is created. PostgreSQL JDBC URL are also supported.
  34. jpa:
  35. hibernate:
  36. ddl-auto: update # Not required, but if not added, you will have to create the tables by hand.
  37. logging:
  38. file:
  39. name: gas-sensor-web.log # Not required, default is logging to console only.
  40. server:
  41. port: 8081 # Not required, default is 8080.

Usage

To run it, you can:

  • Double click on gas-sensor-web.exe (Windows specific)
  • Run java -jar gas-sensor-web.jar (All OS)

Java clients

If you need to use the gas sensors in your own Java projects, you can use the Java clients. The only external dependency used by these clients is jSerialComm for handling the serial port communication.

If you want to use all the clients, you can add to your POM this shortcut dependency:

  1. <dependency>
  2. <groupId>fr.romainmoreau.gassensor</groupId>
  3. <artifactId>gas-sensor-client-all</artifactId>
  4. <version>0.1.0-SNAPSHOT</version>
  5. </dependency>

You can also add the clients one by one:

  • ZPH01:
    1. <dependency>
    2. <groupId>fr.romainmoreau.gassensor</groupId>
    3. <artifactId>gas-sensor-client-zph01</artifactId>
    4. <version>0.1.0-SNAPSHOT</version>
    5. </dependency>
  • ZH03A:
    1. <dependency>
    2. <groupId>fr.romainmoreau.gassensor</groupId>
    3. <artifactId>gas-sensor-client-zh03a</artifactId>
    4. <version>0.1.0-SNAPSHOT</version>
    5. </dependency>
  • ZE07:
    1. <dependency>
    2. <groupId>fr.romainmoreau.gassensor</groupId>
    3. <artifactId>gas-sensor-client-ze07</artifactId>
    4. <version>0.1.0-SNAPSHOT</version>
    5. </dependency>
  • ZE08:
    1. <dependency>
    2. <groupId>fr.romainmoreau.gassensor</groupId>
    3. <artifactId>gas-sensor-client-ze08</artifactId>
    4. <version>0.1.0-SNAPSHOT</version>
    5. </dependency>
  • MH-Z19:
    1. <dependency>
    2. <groupId>fr.romainmoreau.gassensor</groupId>
    3. <artifactId>gas-sensor-client-mhz19</artifactId>
    4. <version>0.1.0-SNAPSHOT</version>
    5. </dependency>
  • Si7021:
    1. <dependency>
    2. <groupId>fr.romainmoreau.gassensor</groupId>
    3. <artifactId>gas-sensor-client-si7021</artifactId>
    4. <version>0.1.0-SNAPSHOT</version>
    5. </dependency>

To use a client, you just need to instanciate it and close it when it’s not needed anymore.
You can find a way to instanciate all the existing clients here.