@adeunis/codecs

中文文档
1.7.1发布于 2024/03/15MITTypeScriptCommonJS近 30 天下载 2206

adeunis codecs source

原始使用文档
文档目录7 节
  1. Install
  2. Basic usage
  3. CLI
  4. Decoder
  5. Encoder
  6. Demonstration (HTML pages)
  7. Product / Codec type association table

Adeunis codecs

JavaScript/Node.js library of Adeunis codecs to decode/encode Adeunis products data frames.

Install

npm i @adeunis/codecs
npm i --save-dev @types/node

Basic usage

const codec = require('@adeunis/codecs');

// All product types are defined in DecoderProducts enum (src/shared/product.enum.ts)
const productType = 'analog';
const payloadValue = '42500110000002100000';
let payloadResult;

console.log(`Decoding ${productType} frame => ${payloadValue}`);

const decoder = new codec.Decoder();

// Configure the decoder for the appropriate device 
decoder.setDeviceType(productType);

// Decode the given payload
let parserResult = decoder.decode(payloadValue);

// Incompatible frame and product
if (parserResult.error) {
    payloadResult = 'decoding issue';
} else {
    // Display result
    payloadResult = JSON.stringify(parserResult, null, 2);
}

console.log(payloadResult);

CLI

Executables for Windows, Linux and MacOS can be built from the sources using the following commands at the root folder:

  • npm run start

And one of :

  • npm run pack:exe
  • npm run pack:linux
  • npm run pack:mac

Usage with node: node bin/codec.js <command> [<args> ...] [-- <options>] Usage with executable: codec <command> [<args> ...] [-- <options>]

Available commands:

  • decode: Decode frame
  • encode: Encode frame
  • help: Show help

Available options:

  • -v, --version: Print version
  • ...: Command specific options

Decoder

Usage: codec decode <frame1> [<frame2> ...] [--deviceType <device_type>] [--network lora868|sigfox] [--csv] [--json]

Encoder

Usage: codec encode <device_type> <frame_code> [--network lora868|sigfox] [-- <encode_options>]

Demonstration (HTML pages)

Basic demo pages are available in generic\src\demo\ directory

You can also visit the demonstration web page

Product / Codec type association table

ProductReferenceAPP FW versionMin codecs libCodec type to select
Analog / Analog PWR8180BA, 8181BA, ARF8201AA, ARF8200AA1.3.x1.3.0analog
Analog2 / Analog2 PWR8180BA, 8181BA, ARF8201AA, ARF8200AA2.1.x1.7.1analog2
Breath8377AA, 8377CA2.4.x1.6.0breath
Comfort8275AA, 8275CA< 2.1.00.4.2comfort
Comfort28275AA, 8275CA>= 2.1.x1.4.0comfort2
Comfort CO28373AA, 8373CA2.2.x1.5.0comfortCo2
Comfort Serenity8373[A/B/C/D/I/J/K/L]R1.1.x1.7.1comfortSerenity
Dry Contacts8170BA, 8171BA1.3.x0.4.2dc or drycontacts (since lib 1.4.0)
Dry Contacts 28170BA, 8171BA2.1.x1.4.0drycontacts2
DeltaP8283AA, 8283CA1.5.x or 2.0.x1.0.0deltap
Modbus8240AA, 8240BA, 8240CA2.x.x1.7.1modbus
Motion8276AA, 8276CA1.5.x1.0.0motion
Motion 28276AA, 8276CA2.0.x1.2.0motion
Pulse / Pulse ATEX8230AA, 8230CA, 8230GA, 8230HA1.2.x0.4.2pulse
Pulse 3 / Pulse 3 ATEX8230AA, 8230CA, 8230GA, 8230HA2.0.x1.1.0pulse3
Pulse 4 / Pulse 4 ATEX8230AA, 8230CA, 8230GA, 8230HA2.1.x1.4.0pulse4
Pulse 4 NB-IoT8335AA2.0.x0.4.2pulse4nbiot
Repeater Sigfox8168AA2.x.x0.4.2repeater
Temp / Temp 2S8180BA, 8181BA, 8180BA2, 8181BA21.3.x0.4.2temp
Temp 3 / Temp 2S 38180BA, 8181BA 8180BA2, 8181BA22.0.x1.1.0temp3
Temp 4 / Temp 2S 48180BA, 8181BA, 8180BA2, 8181BA22.1.x1.4.0temp4
Temp 4 / Temp 2S 4 IP688180BCA, 8181BCA, 8180BCB, 8181BCB2.1.x1.4.0temp4
TIC CBE/LINKY MONO8250AA1.4.x1.3.0ticCbeLinkyMono
TIC CBE/LINKY TRI8250AA1.4.x1.3.0ticCbeLinkyTri
TIC PME-PMI8250AA1.4.x1.4.0ticPmePmi

Please note that :

  • RTU firmware version has no impact on the codec type to select
  • Bundles use the same type than the standard product

版本与发布记录

@adeunis/codecs 共发布 10 个版本,首次发布于 2019/11/29;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.7.1latest2024/03/152 年前
1.7.02024/02/132 年前
1.6.12021/10/285 年前
1.6.02021/10/285 年前
1.5.02021/05/075 年前
1.4.02020/12/215 年前

关于 @adeunis/codecs 的常见问题

@adeunis/codecs 是什么?

adeunis codecs source

如何安装 @adeunis/codecs?

在项目目录运行 npm install @adeunis/codecs,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 codec,可以用 npx codec 直接运行。

@adeunis/codecs 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adeunis/codecs 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adeunis/codecs 可以商用吗?

@adeunis/codecs 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adeunis/codecs 的下载量有多少?

根据 npm 官方下载统计,@adeunis/codecs 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,206 次,日均约 74 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adeunis/codecs 还在维护吗?

最新版本 1.7.1 发布于 2024/03/15(2 年前);至今共发布 10 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/11/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。