Skip to content

Commit

Permalink
NORSUB-eMRU: v2.0.0
Browse files Browse the repository at this point in the history
NORSUB-eMRU: v2.0.0
  • Loading branch information
crisconru authored Jul 23, 2024
2 parents 636febe + 7c199fc commit 4501386
Show file tree
Hide file tree
Showing 16 changed files with 519 additions and 582 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/norsub-emru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:

- name: 🧑‍🔬 Tests
run: "npm run norsub-emru:test"

- name: 🛠️ Build
run: "npm run norsub-emru:build"

publish:
name: 🚀 Publish
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions packages/nmea-parser/protocols/norsub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ protocols:
- name: status
type: uint32
description: "0 - Error\n
1 - No Error"
- protocol: NORSUB2
standard: false
Expand Down Expand Up @@ -89,7 +88,6 @@ protocols:
- name: status
type: uint32
description: "0 - Error\n
1 - No Error"
- protocol: NORSUB6
standard: false
Expand Down Expand Up @@ -153,7 +151,6 @@ protocols:
- name: status
type: uint32
description: "0 - Error\n
1 - No Error"
- protocol: NORSUB7
standard: false
Expand Down
39 changes: 24 additions & 15 deletions packages/norsub-emru/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Norsub eMRU Parser

![npm (scoped)](https://img.shields.io/npm/v/%40coremarine/norsub-emru)
[![publish](https://github.com/core-marine-dev/norsub-emru/actions/workflows/publish.yml/badge.svg)](https://github.com/core-marine-dev/norsub-emru/actions/workflows/publish.yml)
![npm](https://img.shields.io/npm/dy/%40coremarine/norsub-emru)
![npm (scoped)](https://img.shields.io/npm/v/%40coremarine/norsub-emru) [![publish](https://github.com/core-marine-dev/norsub-emru/actions/workflows/publish.yml/badge.svg)](https://github.com/core-marine-dev/norsub-emru/actions/workflows/publish.yml) ![npm](https://img.shields.io/npm/dy/%40coremarine/norsub-emru)

Library to read NMEA-like sentences of Norsub eMRU devices. It works same as [NMEA-Parser library](https://www.npmjs.com/package/@coremarine/nmea-parser) and it has the same API. The only nuance is it gives metadata of the device status if the sentence bring that info.

To understand how it works, please look the info of [NMEA-Parser library](https://www.npmjs.com/package/@coremarine/nmea-parser).

The complete output with metadata it is shown below.
`PNORSUBx` sentences contains `status` property in the metada as

```typescript
type Status = {
Expand Down Expand Up @@ -73,33 +71,44 @@ type Status = {
}
}
}
```
The complete output with metadata it is shown below.
```typescript
type NMEASentence = {
// Sentence ID
sentence: string,
// Array just with the data of each field (easier to just read data and not fields metadata)
data: Array<string | number | boolean | null>,
id: string,
// Array with ordered fields and their metadata
fields: Array<{
payload: Array<{
name: string,
data: string | number | boolean | null,
metadata?: Status,
value: string | number | bigint | boolean | null,
type: 'string' | 'boolean' | 'uint8' | 'uint16' | 'uint32' | 'uint64' | 'int8' | 'int16' | 'int32' | 'int64' | 'float32' | 'float64' | 'unknown',
units?: string,
note?: string,
description?: string,
metadata?: any
}>,
// Metadata which can be computed fields from payload fields
metadata?: any,
// Protocol information
protocol: {
name: string,
standard: boolean,
version: string,
},
// UTC timestamp when the sentence was parsed
timestamp: number,
received: number,
// Whole ASCII string sentence
raw: string,
sample: string,
// Sentence checksum
checksum: number
checksum: {
sample: string,
value: number
}
// Sentence talker
talker?: null | { id: string, description: string }
talker?: {
value: string,
description: string
}
}
```
10 changes: 5 additions & 5 deletions packages/norsub-emru/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coremarine/norsub-emru",
"version": "1.1.0",
"version": "2.0.0",
"description": "Library to work with eMRU devices of NorSub company",
"author": "Core Marine",
"license": "MIT",
Expand Down Expand Up @@ -45,19 +45,19 @@
},
"scripts": {
"protocols": "node yaml-to-json.js ./protocols/norsub.yaml ./src/norsub.ts",
"build": "npm run protocols && npm run format && tsup",
"build": "npm run format && tsup",
"lint": "ts-standard",
"format": "ts-standard --fix",
"test": "npm run protocols && vitest",
"test": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@coremarine/nmea-parser": "^1.7.0",
"@coremarine/nmea-parser": "^2.1.2",
"@schemasjs/valibot-numbers": "^1.0.13",
"@schemasjs/validator": "^1.0.1"
},
"peerDependencies": {
"valibot": ">=0.31.0"
"valibot": ">=0.36.0"
},
"ts-standard": {
"ignore": [
Expand Down
Loading

0 comments on commit 4501386

Please sign in to comment.