Debian Codegraph @

gobi-api/Gobi_2011-11-28-1533/Core/StdAfx.h

raw
1 /*===========================================================================
2 FILE:
3 StdAfx.h
4
5 DESCRIPTION:
6 Application Framework eXtenstions for Linux
7
8 PUBLIC CLASSES AND FUNCTIONS:
9
10 Copyright (c) 2011, Code Aurora Forum. All rights reserved.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright
15 notice, this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in the
18 documentation and/or other materials provided with the distribution.
19 * Neither the name of Code Aurora Forum nor
20 the names of its contributors may be used to endorse or promote
21 products derived from this software without specific prior written
22 permission.
23
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 POSSIBILITY OF SUCH DAMAGE.
36 ===========================================================================*/
37
38 //---------------------------------------------------------------------------
39 // Pragmas
40 //---------------------------------------------------------------------------
41 #pragma once
42 //---------------------------------------------------------------------------
43 // Includes
44 //---------------------------------------------------------------------------
45 #include <fstream>
46 #include <assert.h>
47 #include <termios.h>
48 #include <string.h>
49 #include <errno.h>
50 #include <algorithm>
51 #include <limits.h>
52 #include <dirent.h>
53 #include <sstream>
54 #include <stdarg.h>
55 #include <time.h>
56 #include <sys/time.h>
57 #include <sys/ioctl.h>
58 #include <sys/stat.h>
59 #include <fcntl.h>
60
61 //---------------------------------------------------------------------------
62 // Macro defination
63 //---------------------------------------------------------------------------
64
65 #define ASSERT( x ) assert( x )
66
67 #ifdef DEBUG
68 #define TRACE printf
69 #else
70 #define TRACE(...)
71 #endif
72
73 //---------------------------------------------------------------------------
74 // data type defination
75 //---------------------------------------------------------------------------
76 #ifndef FALSE
77 #define FALSE 0
78 #endif
79
80 #ifndef TRUE
81 #define TRUE 1
82 #endif
83
84 #ifndef CONST
85 #define CONST const
86 #endif
87
88 typedef void VOID;
89 typedef unsigned long DWORD;
90 typedef int BOOL;
91 typedef unsigned char BYTE;
92 typedef unsigned short WORD;
93 typedef float FLOAT;
94 typedef long long LONGLONG;
95 typedef unsigned long long ULONGLONG;
96 typedef signed char INT8;
97 typedef double DOUBLE;
98
99 typedef int INT;
100 typedef unsigned int UINT;
101 typedef unsigned int * PUINT;
102 typedef INT HANDLE;
103 typedef HANDLE HMODULE;
104
105 typedef char CHAR;
106 typedef short SHORT;
107 typedef long LONG;
108
109 typedef unsigned long ULONG;
110 typedef ULONG * PULONG;
111 typedef ULONG * ULONG_PTR;
112 typedef unsigned short USHORT;
113 typedef USHORT * PUSHORT;
114 typedef unsigned char UCHAR;
115 typedef UCHAR * PUCHAR;
116 typedef char * PSZ;
117
118
119 typedef CONST CHAR * LPCSTR;
120 typedef CHAR * LPSTR;
121
122 typedef BYTE * PBYTE;
123 typedef BOOL * PBOOL;
124 typedef INT * PINT;
125 typedef UINT * LPINT;
126 typedef WORD * PWORD;
127 typedef PWORD LPWORD;
128 typedef LONG * LPLONG;
129 typedef DWORD * PDWORD;
130 typedef VOID * PVOID;
131 typedef PVOID LPVOID;
132 typedef const void * LPCVOID;
133
134 typedef size_t SIZE_T;
135 typedef double DATE;
136
137 // Error code
138 #define NO_ERROR 0L
139 #define ERROR_SUCCESS 0L
140 #define ERROR_NO_MORE_ITEMS 259L
141 #define ERROR_CRC 23L
142 #define ERROR_OUTOFMEMORY 14L
143 #define ERROR_CAN_NOT_COMPLETE 1003L
144 #define ERROR_REVISION_MISMATCH 1306L
145 #define ERROR_BAD_ARGUMENTS 160L
146 #define INVALID_SET_FILE_POINTER -1
147 #define VALID_HANDLE_VALUE 0
148 #define INVALID_HANDLE_VALUE -1
149 #define INVALID_FILE_SZ -1
150
151 #define ERROR_GEN_FAILURE 31L
152 #define ERROR_FILE_NOT_FOUND 2L
153 #define ERROR_NOT_ENOUGH_MEMORY 8L
154 #define ERROR_INVALID_PARAMETER 87L
155 #define ERROR_BAD_FORMAT 11L
156
157
158 // Other Constant definitions
159 #define MAX_PATH 512
160 #define INFINITE 0xffffffff
161
162
163 // SIOCIWFIRSTPRIV = 0x8BE0
164
165 // Device I/O control code for setting QMI service
166 #define QMI_GET_SERVICE_FILE_IOCTL 0x8BE0 + 1
167
168 // Device I/O control code for obtaining device VIDPID
169 #define QMI_GET_VIDPID_IOCTL 0x8BE0 + 2
170
171 // Device I/O control code for obtaining device MEID
172 #define QMI_GET_MEID_IOCTL 0x8BE0 + 3
173
174 // Define the directions for pipes
175 #define READING 0
176 #define WRITING 1