Skip to content

Commit

Permalink
Code Update
Browse files Browse the repository at this point in the history
  • Loading branch information
BMSVieira committed Jan 19, 2024
1 parent e5c019c commit 13d6f53
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 44 deletions.
9 changes: 3 additions & 6 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<div class="mb-5 mb-lg-0 mb-lg-3" style="text-align:center; margin-top:70px; margin-bottom:28px!important;">
<img src="img/logo.png" style="max-width:300px; width:40%;">
<p style=" font-size: 32pt; color: white; font-family: 'Cairo', sans-serif;">Managing NMEA Sentences</p>
<a href="https://github.com/BMSVieira/lwder.js" target="_blank" style="cursor:pointer;" class="btn btn-dark btn-sm ">View on Github</a>
<a href="https://github.com/BMSVieira/nmea.js" target="_blank" style="cursor:pointer;" class="btn btn-dark btn-sm ">View on Github</a>
</div>
</div>
</div>
Expand All @@ -75,7 +75,7 @@
NMEA Information
</div>
<div class="col-lg-12">
<pre id="lms_console" style="background-color: #070b0f; padding: 15px; height:250px; overflow-y:hidden; border-radius:8px;"></pre>
<pre id="lms_console" style="background-color: #070b0f; padding: 15px; height:250px; border-radius:8px;"></pre>
</div>


Expand All @@ -90,7 +90,6 @@
// Initialize nmea
const example = new Nmea();

/*
document.getElementById("lms_console").insertAdjacentHTML("beforeend", "<p class='pre_nmea'><b style='color:#ededed'>Time:</b> "+example.getInfo("time", "$GPRMC,001225,A,2832.1834,N,08101.0536,W,12,25,251211,1.2,E,A*03")+"</p>");
document.getElementById("lms_console").insertAdjacentHTML("beforeend", "<p class='pre_nmea'><b style='color:#ededed'>positionStatus:</b> "+example.getInfo("positionStatus", "$GPRMC,001225,A,2832.1834,N,08101.0536,W,12,25,251211,1.2,E,A*03")+"</p>");
document.getElementById("lms_console").insertAdjacentHTML("beforeend", "<p class='pre_nmea'><b style='color:#ededed'>coordinates:</b> "+example.getInfo("coordinates", "$GPRMC,001225,A,2832.1834,N,08101.0536,W,12,25,251211,1.2,E,A*03")+"</p>");
Expand All @@ -100,9 +99,7 @@
document.getElementById("lms_console").insertAdjacentHTML("beforeend", "<p class='pre_nmea'><b style='color:#ededed'>magneticVariation:</b> "+example.getInfo("magneticVariation", "$GPRMC,001225,A,2832.1834,N,08101.0536,W,12,25,251211,1.2,E,A*03")+"</p>");
document.getElementById("lms_console").insertAdjacentHTML("beforeend", "<p class='pre_nmea'><b style='color:#ededed'>magneticVariationDirection:</b> "+example.getInfo("magneticVariationDirection", "$GPRMC,001225,A,2832.1834,N,08101.0536,W,12,25,251211,1.2,E,A*03")+"</p>");
document.getElementById("lms_console").insertAdjacentHTML("beforeend", "<p class='pre_nmea'><b style='color:#ededed'>checksum:</b> "+example.getInfo("checksum", "$GPRMC,001225,A,2832.1834,N,08101.0536,W,12,25,251211,1.2,E,A*03")+"</p>");
*/
console.log(example.getInfo("checksum", "$GPGGA,092751.000,5321.6802,N,00630.3371,W,1,8,1.03,61.7,M,55.3,M,,*75"));

console.log(example.getInfo("date", "$GPRMC,001225,A,2832.1834,N,08101.0536,W,12,25,251211,1.2,E,A*03"));

});
</script>
Expand Down
41 changes: 3 additions & 38 deletions js/nmea.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ class Nmea {

getInfo(property, sentence) {

console.log(this.nmea);

// Check if source if from constructor or parameter
sentence = this.checkSource(sentence);

Expand All @@ -256,47 +258,10 @@ class Nmea {


}





getGPGGA(sentence)
{

// GPGGA
console.log(this.nmea.gpgga.sentenceType(sentence));
console.log(this.nmea.gpgga.coordinates(sentence));
console.log(this.nmea.gpgga.time(sentence));
console.log(this.nmea.gpgga.fixType(sentence));
console.log(this.nmea.gpgga.satellites(sentence));
console.log(this.nmea.gpgga.hdop(sentence));
console.log(this.nmea.gpgga.altitude(sentence));
console.log(this.nmea.gpgga.altitudeUnits(sentence));
console.log(this.nmea.gpgga.checksum(sentence));

}

getGPRMC(sentence)
{

// GPRMC
console.log(this.nmea.gprmc.sentenceType(sentence));
console.log(this.nmea.gprmc.time(sentence));
console.log(this.nmea.gprmc.positionStatus(sentence));
console.log(this.nmea.gprmc.coordinates(sentence));
console.log(this.nmea.gprmc.speed(sentence));
console.log(this.nmea.gprmc.heading(sentence));
console.log(this.nmea.gprmc.date(sentence));
console.log(this.nmea.gprmc.magneticVariation(sentence));
console.log(this.nmea.gprmc.magneticVariationDirection(sentence));
console.log(this.nmea.gprmc.checksum(sentence));
}

}

// Export module to use it in browser and NodeJS
try {
module.exports = exports = Lwder;
module.exports = exports = Nmea;
} catch (e) {}

1 change: 1 addition & 0 deletions js/nmea.min.js

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

0 comments on commit 13d6f53

Please sign in to comment.