GpsDebug

 

/*****************************************************************************

* Filename:
* ---------
*  GpsDebug.c
*
* Project:
* --------
*   xygps
*
* Description:
* ------------
*   about Debug
*
* Author:
* -------
*  harisucici  2011.10.24
*
*****************************************************************************/
 
/*****************************************************************************
*  file include 
*****************************************************************************/
 /*****************************file include end**********************************/
 
/*****************************************************************************
*  globle  date define
*****************************************************************************/
/*******************************date define end********************************/
 
#include "GpsDebug.h"
 
#ifdef WIN32
 
#include "stdafx.h"
 
void writelog(const char *format)
{            
    XygpsWChar szPath[128] = { 0 };
    XygpsChar szLog[1024];
 
    memset(szPath, 0, sizeof(szPath));
    gps_config_get_tf_dir(szPath, sizeof(szPath));
    
    gps_str_cat(szPath, L"Modis_debug.log");
 
    gps_file_fullname_add_write(0, szPath, format, strlen(format));
}
 
#endif  //end GPS_DEBUG

 

 

#ifndef _GPS_DEBUG_H_
#define _GPS_DEBUG_H_
 
#include "GpsPlatform.h"
 
#ifdef GPS_DEBUG
 
#define  gps_trace(x)\
{\
      xy_trace##x;\
      xy_trace("%s,%d\n\n",__FILE__, __LINE__);\
}
 
void gps_trace_dump(const char* str,void* p_dump,int len);
 
extern void PutUARTBytes(int port, unsigned char  *data, unsigned short int len);
#define   UartTrace(X)\
{\
      do{\
        char temp[1024];\
        sprintf(temp, "%s %s %d\r\n",X, __FILE__, __LINE__);\
        PutUARTBytes(0,  (unsigned char *) temp , strlen(temp));\
      }while(0);\
}
 
 
#ifdef ASSERT
#undef ASSERT
#endif
 
#define ASSERT(expr) if(!(expr)) do{ gps_trace(("\nAssert fail: (%s)",#expr)); }while(0);
        
#else
 
#define gps_trace(x)
#define gps_trace_dump(x)
#define   UartTrace(X) 
#ifdef ASSERT
#undef ASSERT
#endif
 
#define ASSERT(expr)
 
 
#endif //GPS_DEBUG
 
#define GPS_ASSERT ASSERT
 
#endif //_GPS_DEBUG_H_
posted @ 2011-11-30 14:08  harisucici  阅读(305)  评论(0编辑  收藏  举报