Skip to content

Commit

Permalink
wip to test idea
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Feb 13, 2025
1 parent a2c33ca commit 30f8693
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
} = require('./nmea')
const path = require('path')
const fs = require('fs')
const { type } = require('os')

module.exports = function (app) {
var plugin = {
Expand Down Expand Up @@ -85,20 +86,27 @@ module.exports = function (app) {
}

function buildSchemaFromSentences (plugin) {
Object.keys(plugin.sentences).forEach(key => {
var sentence = plugin.sentences[key]
const throttlePropname = getThrottlePropname(key)
plugin.schema.properties[key] = {
title: sentence['title'],
type: 'boolean',
default: false
}
plugin.schema.properties[throttlePropname] = {
title: `${key} throttle ms`,
type: 'number',
default: 0

plugin.schema.properties['Active Conversions'] = {
type: 'array',
items: {
type: 'object',
properties: {
"Sentence": {
"type": "string",
"enum": Object.keys(plugin.sentences).map(key => `${key}: ${plugin.sentences[key].title}`)
},
"Minimum interval (milliseconds)": {
"type": "number",
"description": "Minimum interval between sentences"
},
"Event": {
"type": "string",
"description": "Event name to emit the sentence"
}
}
}
})
}
}

function loadSentences (app, plugin) {
Expand Down

0 comments on commit 30f8693

Please sign in to comment.