{"id":18318439,"url":"https://github.com/oceanstreamio/nmeaflow","last_synced_at":"2025-04-09T13:54:20.930Z","repository":{"id":202649779,"uuid":"707845000","full_name":"OceanStreamIO/nmeaflow","owner":"OceanStreamIO","description":"Sensor Server Simulator","archived":false,"fork":false,"pushed_at":"2023-10-20T19:51:33.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T07:51:16.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OceanStreamIO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-20T19:43:10.000Z","updated_at":"2023-10-20T19:44:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"214d0b0a-21ca-43ed-9be7-60e75021cc00","html_url":"https://github.com/OceanStreamIO/nmeaflow","commit_stats":null,"previous_names":["oceanstreamio/nmeaflow"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanStreamIO%2Fnmeaflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanStreamIO%2Fnmeaflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanStreamIO%2Fnmeaflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanStreamIO%2Fnmeaflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OceanStreamIO","download_url":"https://codeload.github.com/OceanStreamIO/nmeaflow/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054218,"owners_count":21039951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:09:36.905Z","updated_at":"2025-04-09T13:54:20.901Z","avatar_url":"https://github.com/OceanStreamIO.png","language":"JavaScript","readme":"# NMEAFlow: Sensor Server Simulator\n\nNMEAFlow is a basic CLI tool designed to emulate a sensor server, which can broadcast data from one or more simulated sensors at the same time. The data is read from text files and replayed continuously, at desired intervals. \n\nUse NMEAFlow for developing and testing applications that consume real-time sensor data, without the need for actual sensors. \n\n## Features\n\n- Replay any data from text files\n- Flexible port configuration\n- Extensive logging and error handling\n- Dynamic interval settings\n- Pre-loaded with sample NMEA strings for various marine sensors\n- Types included for TypeScript support\n- Programmatic API for further integration\n\n## Requirements\n\n- Node.js \u003e= v14.x\n- NPM \u003e= v6.x\n\n## Installation\n\n```bash\nnpm install nmeaflow\n```\n\n## Command Line Usage\n\n### Options\n\n| Option                  | Description                                                                                   | Default Value       |\n|-------------------------|-----------------------------------------------------------------------------------------------|---------------------|\n| `--port-start`| Starting port for the simulator                                                                | 4001                |\n| `--port-end`    | Ending port for the simulator                                                                  | 4006                |\n| `-c`, `--config`  | Config file with list of files to replay                                                       |                     |\n| `--id`              | Id for an individual simulator instance                                                        |                     |\n| `-p`, `--port`     | Single port to run an individual simulator instance                                            |                     |\n| `-f`, `--filename`| Filename for an individual simulator instance                                                  |                     |\n| `-i`, `--interval`| Broadcasting interval for an individual simulator instance in milliseconds                     | 10000               |\n| `-a`, `--address` | Address to listen on                                                                           | `localhost`         |\n| `-h`, `--host`            | Listen to all available IPs                                                                    |                     |\n| `--log-level` | Specify log level                                                                              | `debug`             |\n\n### Logging\n\nYou can set the log level either by running using the `--log-level` option or by setting the `LOG_LEVEL` environment variable. \n\nThe log levels are as follows:\n- `error`\n- `warn`\n- `info`\n- `verbose`\n- `debug`\n- `silly`\n- `none`\n\n### Config File\n\nThe config file is a JavaScript file that exports an array of objects. Each object contains the `file`, `id`, and `interval` keys.\n\nExample:\n\n```js\nmodule.exports = [\n  { file: 'gps.txt', id: 'GPS', interval: 10000 },\n  { file: 'trawl.txt', id: 'TRAWL_SONAR', interval: 15000 },\n  { file: 'depthsounder.txt', id: 'DEPTH_SOUNDER', interval: 15000 },\n  { file: 'wind.txt', id: 'WIND', interval: 10000 },\n];\n```\n\nThe `interval` can be either a number (in milliseconds) or a function. The function takes the `id` as argument and should return a number representing the interval in milliseconds.\n\n### Running as an individual instance\n\nTo run the simulator as an individual instance you need to specify the individual parameters, as follows:\n\n```bash\nnmeaflow -p 4000 -f sample_data.txt -id Sensor01 --interval 10000\n```\n\nThis will run the simulator with id `Sensor01` on port 4000, reading data from the file `sample_data.txt`, and broadcasting the data every 10,000 milliseconds (or 10 seconds).\n\n## Programmatic API\n\nNMEAFlow comes with type definitions, enabling easy integration into TypeScript projects. Here's an example:\n\n```ts\nimport { NMEAFlow } from 'nmeaflow';\n\nconst options = {\n  address: 'localhost',\n  port: 4001,\n  filename: 'custom_data.txt',\n  interval: 2000,\n};\n\nconst simulator = new NMEAFlow(options);\nsimulator.start()\n  .then(() =\u003e {\n    console.log('Simulator started');\n  })\n  .catch((err) =\u003e {\n    console.error('Failed to start simulator', err);\n  });\n```\n\n## License\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foceanstreamio%2Fnmeaflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foceanstreamio%2Fnmeaflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foceanstreamio%2Fnmeaflow/lists"}