GithubHelp home page GithubHelp logo

device-onboarding-exercise's Introduction

Instructions
============

You will need node.js and yarn installed

Node - https://nodejs.org/en/download/
Yarn - https://classic.yarnpkg.com/en/docs/install

Run `yarn install` in the root of the project to install dependencies

Run `yarn test` to run the test.

Task
====

Below is the manufacturer specification for a payload from an RTS Icemeter Water Detect device.

mapper.test.js contains a test that a payload can be converted to a JSON object that contains that values
packed into the payload. You do not need to modify the test.

Implement code in the mapData function in src/main/mapper.js that will take the hex string as input, and return
an object that contains the values from the payload. You will probably find the built-in NodeJS Buffer class to be helpful,
you do not need external libraries.

Water Detect specification
==========================

Big endian (MSB first) two hex characters per byte.

Txflags (1 Byte)
Sensor.WaterPresent(1 Byte)
Sensor.Water(1 Byte)
Sensor.Battery (1 Byte)
RTX.Value (4 Bytes)

Description:
Txflags(8 bit) are a bit mask as follows:
0 (1) = Power Up (Ignore content may not be valid)
1 (2) = State Change (Will be sent 15 -20 seconds after change)
2 (4) = Periodic Update (Keep alive message currently sent once every 12hours)

WaterPresent(8 bit) is a boolean
0 = NoWater/ False
1 = WaterDetected / True

Water(8 bit)is the raw analogue value more for info purposes
>= 200 Nowater
<= 150 Water is present

Battery(8 bit) is the converted value of the battery apply the following formula to get back to volts

V = Value X 0.0209

RTX.Value(32 bit)is just a free running counter running 1 second increments, it can be used as a time reference.

device-onboarding-exercise's People

Contributors

revbingo avatar

Stargazers

Andy Sweetman avatar

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.