summaryrefslogtreecommitdiff
path: root/src/GarminConvert.hpp
blob: a0b17fe06fe9cc4d354fcda6af061a8522399518 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; coding: utf-8-unix -*-
/***************************************************************************
 *   Copyright (C) 2010 by Oleg Khudyakov                                  *
 *   prcoder@gmail.com                                                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
// ***** BEGIN LICENSE BLOCK *****
////////////////////////////////////////////////////////////////////
// Copyright (c) 2012-2013 RALOVICH, Kristóf                      //
//                                                                //
// This program is free software; you can redistribute it and/or  //
// modify it under the terms of the GNU General Public License    //
// version 2 as published by the Free Software Foundation.        //
//                                                                //
////////////////////////////////////////////////////////////////////
// ***** END LICENSE BLOCK *****
#pragma once


#include <stdintfwd.hpp>
#include <string>
#include <vector>

#define GARMIN_EPOCH 631065600

using namespace std;

class GarminConvert
{
public:
    static double coord(int32_t coord);
    static double altitude(uint16_t alt);
    static double length(uint32_t centimeters);
    static double speed(uint16_t speed);
    static double weight(uint16_t weight);
    static string gmTime(uint32_t time);
    static string localTime(uint32_t time);
    static string gTime(uint32_t time);
    static string gString(uint8_t *str, int maxSize);
    static string gHex(uint8_t *buf, int size);
    static string gHex(vector<uint8_t> &buf);
    static string hexDump(vector<uint8_t> &buf);
};