Git Product home page Git Product logo

codec-report-batch-javascript's Introduction

ENGLISH

Implementation of the executable br_uncompress in JavaScript.

Use

The use cases are given in the files ** example.html ** (on your browser) and ** example.js ** (on nodejs).

It consists of the use of function Module.brUncompress. It takes as arguments:

  • The tag size tagsz
  • A list of tag objects, containing the fields taglbl, resol and sampletype. These objects can optionally contain an lblname field containing the name of the label to display in the output data and a field divide containing a divisor to use for the final calculation of the value measured.
  • The data to decompress in hexadecimal format.
  • Optionally the date of the measurement in ISO format (for example: 2018-11-05T10: 35: 09.685Z)

Build

The br_uncompress.js script cannot be used as is in the browser, the function being exported according to the CommonJS convention. It is necessary that create a bundle, using a tool such as browersify or webpack.

An example is given in the package.json file.

Nashorn

The br_uncompress.js script can be used directly via Nashorn. To see the file example_nashorn.js

Compatible devices

The br_uncompress.js script is currently compatible with VAQAO, to make it compatible with other devices you have to change line 745 :

var data = brUncompress(
	3,  // <<==  the Batch Tag size
	// From here the batch fileds parameter list
	[
		{
			 taglbl: 1,
			 resol: 10,
			 sampletype: 7,
			 divide: 100,
			 lblname: "Temperature"
		},
		{ 
			 taglbl: 2,
			 resol: 100,
			 sampletype: 6,
			 divide: 100,
			 lblname: "Humidity"
		},
		{ 
			 taglbl: 3,
			 resol: 10,
			 sampletype: 6,
			 lblname: "CO2"
		},
		{ 
			 taglbl: 4,
			 resol: 10,
			 sampletype: 6,
			 lblname: "COV"
		},
		{ 
			 taglbl: 5,
			 resol: 10,
			 sampletype: 6,
			 lblname: "Lux"
		}
	],
	msg.payload, // This is the batch frame
	time // Variable for timestamp
 )
;

FRANCAIS

Implémentation de l'exécutable br_uncompress en JavaScript.

Utilisation

Les cas d'utilisation sont donnés dans les fichiers example.html (utilisation dans le navigateur) et example.js (pour une utilisation sur nodejs).

L'utilisation consiste en l'utilisation de la fonction Module.brUncompress. Elle prend comme arguments :

  • La taille de tag tagsz
  • Une liste d'objets tag, contenant les champs taglbl, resol et sampletype. Ces objets peuvent optionnellement contenir un champ lblname contenant le nom du label à afficher dans les données de sortie et un champ divide contenant un diviseur à utiliser pour le cacul final de la valeur mesurée.
  • Les données à décompresser au format hexadécimal.
  • Optionnellement la date de la mesure au format ISO (par exemple : 2018-11-05T10:35:09.685Z)

Build

Le script br_uncompress.js n'est pas utilisable tel quel dans le navigateur, la fonction étant exportée selon la convention CommonJS. Il est nécessaire de réaliser un bundle, à l'aide un outil tel que browersify ou webpack.

Un exemple est donné dans le fichier package.json.

Nashorn

Le script br_uncompress.js est utilisable directement via Nashorn. Voir le fichier example_nashorn.js

Capteurs compatibles

Le script br_uncompress.js est actuellement compatible avec le VAQAO, pour le rendre compatible avec d'autres capteurs il faut modifier la ligne 745 :

var data = brUncompress(
	3,  // <<==  the Batch Tag size
	// From here the batch fileds parameter list
	[
		{
			 taglbl: 1,
			 resol: 10,
			 sampletype: 7,
			 divide: 100,
			 lblname: "Temperature"
		},
		{ 
			 taglbl: 2,
			 resol: 100,
			 sampletype: 6,
			 divide: 100,
			 lblname: "Humidity"
		},
		{ 
			 taglbl: 3,
			 resol: 10,
			 sampletype: 6,
			 lblname: "CO2"
		},
		{ 
			 taglbl: 4,
			 resol: 10,
			 sampletype: 6,
			 lblname: "COV"
		},
		{ 
			 taglbl: 5,
			 resol: 10,
			 sampletype: 6,
			 lblname: "Lux"
		}
	],
	msg.payload, // This is the batch frame
	time // Variable for timestamp
 )
;

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.