SRK Version of mDot LoRa_Sensormode_SRK
Dependencies: libmDot mbed-rtos mbed
Fork of mDot_LoRa_Sensornode by
uBlox.cpp
00001 /* 00002 * uBlox.cpp 00003 * 00004 * Created on: 16.05.2016 00005 * Author: Adrian 00006 */ 00007 00008 #include "uBlox.h " 00009 00010 uBlox::uBlox(mbed::RawSerial* serial) { 00011 decoder = new Decoder(serial); 00012 this->serial = serial; 00013 this->config = new uBloxConfig(); 00014 } 00015 00016 uBlox::~uBlox() { 00017 delete decoder; 00018 } 00019 00020 unsigned long uBlox::getTimeOfWeekMs(){ 00021 return decoder->getLastPoslhh().iTOW; 00022 } 00023 00024 float uBlox::getLongitude(){ 00025 return (float) (decoder->getLastPoslhh().lon) / 10000000; 00026 } 00027 00028 float uBlox::getLatitude(){ 00029 return (float) (decoder->getLastPoslhh().lat) / 10000000; 00030 } 00031 00032 signed long uBlox::getHeightAboveEllipsoid(){ 00033 return decoder->getLastPoslhh().height; 00034 } 00035 00036 signed long uBlox::getHeightAboveMeanSeaLevel(){ 00037 return decoder->getLastPoslhh().hMSL; 00038 } 00039 00040 unsigned long uBlox::getHorizontalAccuracyEstimate(){ 00041 return decoder->getLastPoslhh().hAcc; 00042 } 00043 00044 unsigned long uBlox::getVerticalAccuracyEstimate(){ 00045 return decoder->getLastPoslhh().vAcc; 00046 } 00047 00048 void uBlox::init(uBLOX_MODE desiredMode){ 00049 config->build(desiredMode); 00050 std::vector< std::vector<uint8_t> > initialConfigurationStrings = config->getInitialConfigurationString(); 00051 00052 for(uint8_t i = 0 ; i < initialConfigurationStrings.size() ; i++){ 00053 sendConfigurationString( initialConfigurationStrings.at(i) ); 00054 } 00055 00056 } 00057 00058 void uBlox::sendConfigurationString(std::vector<uint8_t> commandString){ 00059 for(uint8_t i = 0 ; i < commandString.size() ; i++){ 00060 uint8_t character = commandString.at(i); 00061 serial->putc(character); 00062 } 00063 00064 osDelay(100); 00065 } 00066 00067 00068 00069
Generated on Wed Jul 13 2022 09:23:48 by 1.7.2