File: apgHelper.h

package info (click to toggle)
libapogee3 3.2%2B20221221183454-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 9,284 kB
  • sloc: cpp: 26,737; sh: 8; makefile: 3
file content (95 lines) | stat: -rw-r--r-- 2,665 bytes parent folder | download | duplicates (3)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*! 
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright(c) 2010 Apogee Instruments, Inc. 
*
* \brief namespace helper for the apg library 
* 
*/ 


#ifndef APGHELPER_INCLUDE_H__ 
#define APGHELPER_INCLUDE_H__ 

#include <string>
#include <vector>
#include <stdarg.h>
#include <stdint.h>

#include "CameraInfo.h" 

//#define DEBUGGING_CAMERA
//#define DEBUGGING_CAMERA_STATUS

namespace apgHelper 
{ 

    void DebugMsg( const char *fmt, ... );
    void LogDebugMsg(const int size, const char *fmt, va_list ap);
	void LogVerboseMsg(const std::string & fileName,
	const std::string & msg, const int32_t lineNum, const std::string & type);

	void LogErrorMsg(const std::string & fileName,
			const std::string & msg, const int32_t lineNum);

    void LogWarningMsg(const std::string & fileName,
			const std::string & msg, const int32_t lineNum);
   /*!
    *  Creates a string with the following format filename(lineNumber):msgStr
    * \param [in] fileName 
    * \param [in] msgStr
    * \param [in] lineNum
    * \return std::string message.
    */
    std::string mkMsg(const std::string & fileName, 
        const std::string & msgStr, 
        const int32_t lineNum);

    /*!
    *  Creates a string with the following format filename(lineNumber):errStr:errorType
    * \param [in] fileName 
    * \param [in] errStr
    * \param [in] lineNum
    * \param [in] errType
    * \return std::string message.
    */
    std::string mkMsg(const std::string & fileName, 
        const std::string & errStr, 
        const int32_t lineNum,
        const Apg::ErrorType errType);


   /*!
    *  Takes the input, forms an error message, creates a std::runtime error, assigns
    *  the error message to the what string and finally throws the error.
    * \param [in] fileName 
    * \param [in] errStr
    * \param [in] lineNum
    * \param [in] errType
    */
    void throwRuntimeException(const std::string & fileName, 
        const std::string & errStr, 
        const int32_t lineNum,
        const Apg::ErrorType errType);

    void ApogeeSleep( uint32_t TimeInMs );

     Apg::LedState ConvertUShort2ApnLedState( const uint16_t value );

     bool IsEqual(double x, double y);

     uint32_t SizeT2Uint32( size_t value );
     int32_t SizeT2Int32( size_t value );
     uint16_t SizeT2Uint16( size_t value );
     uint8_t SizeT2Uint8( size_t value );

     int32_t OsInt2Int32( int value );

     std::string GetCfgFileName();
     std::string GetCamCfgDir();
     std::string GetCfgDir();
}

#endif