GithubHelp home page GithubHelp logo

obd-server's Introduction

obd-server

REST API for storing OBD-II readings from Android OBD-II Reader.

Attention: the storage is ephemeral since it relies on an in-memory database. I've made this decision for the sake of deployment simplicity.

Pre-requisites

  1. JDK 8
  2. Maven 3.3.0 or newer

Build

mvn clean package

Run

mvn spring-boot:run

Test

Add records

$ ./tests/put_some_stuff.sh
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Sun, 02 Aug 2015 21:07:12 GMT

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Sun, 02 Aug 2015 21:07:12 GMT

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Sun, 02 Aug 2015 21:07:12 GMT

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Sun, 02 Aug 2015 21:07:12 GMT

Read records for a certain VIN

Reading records is a paginated operation. Set page (defaults to 0) and size (defaults to 100) query parameters if you want to paginate.

./tests/read_testvin_json.sh
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 02 Aug 2015 21:14:14 GMT

{
  "content":[
    {
      "id":1,
      "version":0,
      "latitude":40.0,
      "longitude":-8.1,
      "timestamp":1234567890,
      "vin":"testvin",
      "readings":{
        "rpm":"3000",
        "speed":"55"
      }
    },
    {
      "id":2,
      "version":0,
      "latitude":40.1,
      "longitude":-8.2,
      "timestamp":1234568999,
      "vin":"testvin",
      "readings":{
        "rpm":"3200",
        "speed":"65"
      }
    },
    {
      "id":3,
      "version":0,
      "latitude":40.2,
      "longitude":-8.3,
      "timestamp":1234589999,
      "vin":"testvin",
      "readings":{
        "rpm":"4000",
        "speed":"75"
      }
    }
  ],
  "last":true,
  "totalPages":1,
  "totalElements":3,
  "size":100,
  "number":0,
  "sort":null,
  "first":true,
  "numberOfElements":3
}

obd-server's People

Contributors

pires avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obd-server's Issues

Cant run server

I have tried everything, I have tried running the server-0.1-SNAPSHOT.jar which throws an exception about the domains.xml not found, and the original-server-0.1-SNAPSHOT.jar gives an error about the manifest being missing. I have followed the readme to the last letter

JDK version problem

Hi, I'm not sure you are still supporting this library.
I just downloaded your library and ran this command:
mvn clean package

After downloading a lot of things I got following messages:
`Detected JDK Version: 1.6.0-65 is not in the allowed range [1.7,).

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO]

[INFO] OBD Server ......................................... FAILURE [ 44.478 s]

[INFO] Entity Model ....................................... SKIPPED

[INFO] REST ............................................... SKIPPED

[INFO] Server executable .................................. SKIPPED

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------`

I'm having Java version 1.8 on my machine. Do you have any idea how can I fix it?
Thanks.

Requesting all VINs, not only specific/known VINs

JSON Request Call 'http://localhost/obd/?vin=testvin' requires to know the specific VIN. In some use cases the VINs are not known in advance. Is there a possibility to request/get records/content of all VINs from server - surely, this can produce a lot of data in a single response but in my case it would be great.
Additionally, a more elegant way could be to provide a solution to request/get a list of all/unique VINs.

Project build output path & server start command

The server start command in chapter 2.2.2) of README instructions maybe incorrect. In my case, the compile/jar output was not in 'server/' but in 'server/target/'. This requires to change the start command to: 'java -jar server/target/server-< version >.jar'.

JSON structure for direct importing to external database/application

Relating to provide an easy way to get use of the data output, would it be beneficial to store the obd parameters as per individual and not in one JSON object ("readings")? Unconfigured/Unattended direct importing to external database/application (like PostgreSQL) works fine - but leads to the following result:

JSON-Input:
[{"latitude":40.0,"longitude":-8.1,"timestamp":1234567890,"vin":"testvin","readings":{"speed":"55","rpm":"3000"}}]

DB:

latitude longitude timestamp vin readings
40.0 -8.1 1234567890 testvin {"speed":"55","rpm":"3000"}

In my opinion, for using the data it seems to be easier to handle with the following JSON structure:

JSON-Input:
[{"latitude":40.0,"longitude":-8.1,"timestamp":1234567890,"vin":"testvin","speed":"55","rpm":"3000"}]

DB:

latitude longitude timestamp vin speed rpm
40.0 -8.1 1234567890 testvin 55 3000

Data technically not especially elegant but perhabs more compatible without specify parser/importer of external database/application or run complex processing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.