SRK Version of mDot LoRa_Sensormode_SRK

Dependencies:   libmDot mbed-rtos mbed

Fork of mDot_LoRa_Sensornode by Adrian Mitevski

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers uBloxConfig.cpp Source File

uBloxConfig.cpp

00001 /*
00002  * uBloxConfig.cpp
00003  *
00004  *  Created on: May 30, 2016
00005  *      Author: Adrian
00006  */
00007 
00008 #include "uBloxConfig.h "
00009 
00010 uBloxConfig::uBloxConfig() {
00011     uint8_t commandArray_1 [16] = {0xB5,0x62,0x06,0x57,0x08,0x00,0x01,0x00,0x00,0x00,0x20,0x4E,0x55,0x52,0x7B,0xC3};
00012     connectCommandAndString(UBLOX_GNSS_ON,commandArray_1,16);
00013 
00014     uint8_t commandArray_2 [16] = {0xB5,0x62,0x06,0x57,0x08,0x00,0x01,0x00,0x00,0x00,0x50,0x4F,0x54,0x53,0xAC,0x85};
00015     connectCommandAndString(UBLOX_GNSS_OFF,commandArray_2,16);
00016 
00017     uint8_t commandArray_3 [10] = {0xB5,0x62,0x06,0x11,0x02,0x00,0x08,0x00,0x21,0x91};
00018     connectCommandAndString(UBLOX_CONTINUOUS_MODE,commandArray_3,10);
00019 
00020     uint8_t commandArray_4 [10] = {0xB5,0x62,0x06,0x11,0x02,0x00,0x08,0x01,0x22,0x92};
00021     connectCommandAndString(UBLOX_POWER_SAVE_MODE,commandArray_4,10);
00022 
00023     uint8_t commandArray_5 [10] = {0xB5,0x62,0x06,0x11,0x02,0x00,0x08,0x04,0x25,0x95};
00024     connectCommandAndString(UBLOX_ECO_MODE,commandArray_5,10);
00025 
00026     uint8_t commandArray_6 [28] = {0xB5,0x62,0x06,0x00,0x14,0x00,0x01,0x00,0x00,0x00,0xD0,0x08,0x00,0x00,0x80,
00027             0x25,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x9A,0x79};
00028     connectCommandAndString(UBLOX_DISABLE_ALL_STRING,commandArray_6,28);
00029 
00030     uint8_t commandArray_7 [16] = {0xB5,0x62,0x06,0x01,0x08,0x00,0x01,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x13,0xBE};
00031     connectCommandAndString(UBLOX_ENABLE_POSLLH_STRING,commandArray_7,16);
00032 
00033 }
00034 
00035 uBloxConfig::~uBloxConfig() {
00036     // TODO Auto-generated destructor stub
00037 }
00038 
00039 void uBloxConfig::build(uBLOX_MODE desiredMode){
00040     switch(desiredMode){
00041 
00042     case uBLOX_MODE_0:
00043         initialCommands.push_back(configCommands[UBLOX_DISABLE_ALL_STRING]);
00044         initialCommands.push_back(configCommands[UBLOX_ENABLE_POSLLH_STRING]);
00045         initialCommands.push_back(configCommands[UBLOX_ECO_MODE]);
00046         initialCommands.push_back(configCommands[UBLOX_GNSS_ON]);
00047         break;
00048 
00049     case uBLOX_MODE_1:
00050         initialCommands.push_back(configCommands[UBLOX_DISABLE_ALL_STRING]);
00051         initialCommands.push_back(configCommands[UBLOX_ENABLE_POSLLH_STRING]);
00052         initialCommands.push_back(configCommands[UBLOX_CONTINUOUS_MODE]);
00053         initialCommands.push_back(configCommands[UBLOX_GNSS_ON]);
00054         break;
00055 
00056     case uBLOX_MODE_2:
00057         initialCommands.push_back(configCommands[UBLOX_DISABLE_ALL_STRING]);
00058         initialCommands.push_back(configCommands[UBLOX_ENABLE_POSLLH_STRING]);
00059         initialCommands.push_back(configCommands[UBLOX_POWER_SAVE_MODE]);
00060         initialCommands.push_back(configCommands[UBLOX_GNSS_ON]);
00061         break;
00062 
00063     case uBLOX_MODE_3:
00064         initialCommands.push_back(configCommands[UBLOX_DISABLE_ALL_STRING]);
00065         initialCommands.push_back(configCommands[UBLOX_GNSS_OFF]);
00066         break;
00067 
00068     }
00069 
00070 
00071 }
00072 
00073 std::vector< std::vector<uint8_t> > uBloxConfig::getInitialConfigurationString(){
00074     return initialCommands;
00075 }
00076 
00077 void uBloxConfig::connectCommandAndString(std::string command, uint8_t* string, uint8_t stringSize){
00078     std::vector <uint8_t> commandVector(string, string + stringSize);
00079     configCommands[command] = commandVector;
00080 }
00081