npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fujiy/wccp

v0.1.0

Published

WASA Common Command&Telemetry Protocol

Readme

WASA Common Command&Telemetry Protocol

コマンドおよびテレメトリに用いる,統一されたシリアライズフォーマット.

目的

コマンドやテレメトリのフォーマットを規定する. バイナリ形式でデータを表現することで,テキストフォーマットと比べてデータサイズを削減する.

パケットの内容についてはスキーマレス,すなわちパケットの定義を知らなくてもある程度はデコード可能とする.これにより各所でスキーマ定義を共有する手間を削減し,迅速な開発を可能にする.

CANやUARTを用いた有線通信,LoRa等による無線通信,SDカードへの記録等に用いる. バスによって接続された同一システム内におけるのローカルな情報のやり取りに加えて, 無線等により連携した複数の独立したシステム間の通信にも用いる.

パケットフォーマット

パケットを情報の単位とする.パケットはヘッダ部と,0以上32未満のエントリからなる. エントリの順序は保持されなければならない.

| 項目 | サイズ | | ---- | ------ | | ヘッダ | 4 byte | | エントリ*N | 1N ~ 5N byte | | CRC8 | 1 byte |

ヘッダ

| 項目 | サイズ | 備考 | | ---- | ------ | ----- | | 種別 | 1 bit | 0:コマンド,1:テレメトリ | | パケット種別ID | 7 bit | 0x7F以外の値.基本的にASCIIコードにおける英数字 | | 送信元システムID | 3 bit | 0: ローカル | | 送信元ノードID | 5 bit | バス内におけるノードID(後述) | | 送信先システムID | 3 bit | 0:リモートに送信しない,0b111:ブロードキャスト | | エントリ数 | 5 bit | エントリの数.パケットのバイト数ではない | | シーケンス番号 | 8 bit | 送信元ノード毎にインクリメントされる値 |

エントリ

エントリはデータの種類を表すタイプと,データ自体であるペイロード部からなる. 一つのパケットの中に同じタイプのエントリが含まれていてもよく, その場合は配列のように解釈すると便利である.

| 項目 | サイズ | | ---- | ------ | | タイプ | 1 byte | | ペイロード | 0~4 byte |

タイプ

ユーザーが指定するタイプは64~127の範囲の値,ASCIIコードでA~Z, a~zを基本とし, その下位6bitを用いる.上位2bitはペイロードのサイズ(バイト数)を表す.

上位2bitとペイロードのサイズの対応は

  • 11: 4 byte
  • 10: 2 byte
  • 01: 1 byte
  • 00: 0 byte

である.

ペイロード

ペイロードは0~4byteのリトルエンディアンのバイト列である. バイト列をどのデータ型として解釈するかは自由である. 言い換えると,パケットのデータのみを見てデータ型を判別することはできず, 別途スキーマを知っている必要がある.

データ型が何であるかにかかわらず,ペイロードの上位2あるいは3あるいは4 byteが0x00である場合には, そのバイトを省略してサイズを決定する.

データ型

標準でサポートする,ペイロードのデータ型を解釈する方法を以下に示す.

| データ型 | サイズ (byte) | | ---- | ------ | | bytes | 4 | | uint32 | 4 | | uint16 | 2 | | uint8 | 1 | | int32 | 4 | | int16 | 2 | | int8 | 1 | | float32 | 4 | | float16 | 2 | | void | 0 |

符号付き整数は2の補数,浮動小数点数はIEEE 754で定められた表現である. float16は半精度浮動小数点数(10進で約3桁の精度)である.

バス

上述のパケットプロトコルを用いたバスについて規定する.

共通規定

ノードID

ハートビート

CAN バス

拡張ID (29 bit)

| 項目 | サイズ | | ---- | ------ | | 種別 | 1 bit | | パケット種別ID | 7 bit | | 送信元システムID | 3 bit | | 送信元ノードID | 5 bit | | IDフィールド | 8 bit | | フレーム番号 | 5 bit |

UART バス

モジュール間をUARTでデイジーチェーン接続する. モジュールあたり2つのUARTを使用する. 両端同士を接続してリング状にすることで信頼性を向上させる.

Node ID

フォーマット

| 項目 | サイズ | | ---- | ------ | | Node ID | 1 byte | | シーケンス番号 | 1 byte | | パケット | 3~ byte |

上位レイヤー

共有変数