Skip to content

Commit

Permalink
add llh parser
Browse files Browse the repository at this point in the history
  • Loading branch information
froquede committed Nov 4, 2020
1 parent 87b55a5 commit 283fa84
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const rtklib = require('rtklib');
let config = rtklib.JSON2config(json);
```

- llh2JSON

```js
const rtklib = require('rtklib');
let llh = rtklib.llh2JSON(myLlhLine);
```

## Telnet
- constructor
```js
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const telnet = require('./telnet.js');
module.exports = {
config2JSON: parser.parseConfig,
JSON2config: parser.generateConfig,
llh2JSON: parser.getllh,
telnet
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rtklib",
"version": "1.0.0",
"version": "1.1.0",
"description": "utility to work with RTKLIB using node.js",
"main": "index.js",
"scripts": {
Expand Down
26 changes: 25 additions & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,29 @@ function generateConfig(data) {
return config
}

function getllh(data) {
if (data == '') return {}

let splitted = data.split(' ').join(' ').split(' ').join(' ').split('\n').join('').split(' ');
return {
date: splitted[0],
hour: splitted[1],
lat: splitted[2],
lon: splitted[3],
h: splitted[4],
type: splitted[5],
vsat: splitted[6],
sdn: splitted[7],
sde: splitted[8],
sdu: splitted[9],
sdne: splitted[10],
sdeu: splitted[11],
sdun: splitted[12],
age: splitted[13],
ratio: splitted[14]
};
}

function getDate() {
let d = new Date();
let year = d.getFullYear()
Expand All @@ -45,5 +68,6 @@ function getDate() {

module.exports = {
parseConfig,
generateConfig
generateConfig,
getllh
}

0 comments on commit 283fa84

Please sign in to comment.